mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-25 17:29:22 +01:00
Avoid importing torch in one-click-installer (#4064)
This commit is contained in:
parent
55a685d999
commit
c0fca23cb9
11
one_click.py
11
one_click.py
@ -53,7 +53,16 @@ def cpu_has_avx2():
|
|||||||
|
|
||||||
|
|
||||||
def torch_version():
|
def torch_version():
|
||||||
from torch import __version__ as torver
|
for sitedir in site.getsitepackages():
|
||||||
|
if "site-packages" in sitedir and conda_env_path in sitedir:
|
||||||
|
site_packages_path = sitedir
|
||||||
|
break
|
||||||
|
|
||||||
|
if site_packages_path:
|
||||||
|
torch_version_file = open(os.path.join(site_packages_path, 'torch', 'version.py')).read().splitlines()
|
||||||
|
torver = [line for line in torch_version_file if '__version__' in line][0].split('__version__ = ')[1].strip("'")
|
||||||
|
else:
|
||||||
|
from torch import __version__ as torver
|
||||||
return torver
|
return torver
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user