"git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "4cb5d7decc08f4c7c136f81b2b5f1c74ebffbc62"
Commit 4903fcde authored by rusty1s's avatar rusty1s
Browse files

error handling

parent b9198f0e
...@@ -11,13 +11,12 @@ try: ...@@ -11,13 +11,12 @@ try:
torch.ops.load_library(importlib.machinery.PathFinder().find_spec( torch.ops.load_library(importlib.machinery.PathFinder().find_spec(
library, [osp.dirname(__file__)]).origin) library, [osp.dirname(__file__)]).origin)
except OSError as e: except OSError as e:
if 'undefined symbol' in str(e): major, minor = [int(x) for x in torch.__version__.split('.')[:2]]
major, minor = [int(x) for x in torch.__version__.split('.')[:2]] t_major, t_minor = expected_torch_version
t_major, t_minor = expected_torch_version if major != t_major or (major == t_major and minor != t_minor):
if major != t_major or (major == t_major and minor != t_minor): raise RuntimeError(
raise RuntimeError( f'Expected PyTorch version {t_major}.{t_minor} but found '
f'Expected PyTorch version {t_major}.{t_minor} but found ' f'version {major}.{minor}.')
f'version {major}.{minor}.')
raise OSError(e) raise OSError(e)
if torch.version.cuda is not None: # pragma: no cover if torch.version.cuda is not None: # pragma: no cover
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment