mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-23 00:18:20 +01:00
Avoid importing torch in one-click-installer (#4064)
This commit is contained in:
parent
55a685d999
commit
c0fca23cb9
@ -53,6 +53,15 @@ def cpu_has_avx2():
|
|||||||
|
|
||||||
|
|
||||||
def torch_version():
|
def torch_version():
|
||||||
|
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
|
from torch import __version__ as torver
|
||||||
return torver
|
return torver
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user