mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-18 20:27:58 +00:00
Update binding.py
This commit is contained in:
parent
3f5f1ab517
commit
566491c2fa
@ -12,7 +12,6 @@ from typing import Callable
|
||||
from lollms.paths import LollmsPaths
|
||||
from ascii_colors import ASCIIColors
|
||||
|
||||
|
||||
import tempfile
|
||||
import requests
|
||||
import shutil
|
||||
@ -421,48 +420,7 @@ class LLMBinding:
|
||||
full_data+=yaml_data
|
||||
|
||||
return full_data
|
||||
|
||||
@staticmethod
|
||||
def check_torch_version(min_version):
|
||||
import torch
|
||||
# Extract torch version from __version__ attribute with regular expression
|
||||
current_version_float = float('.'.join(torch.__version__.split(".")[:2]))
|
||||
# Check if the current version meets or exceeds the minimum required version
|
||||
return current_version_float >= min_version
|
||||
|
||||
@staticmethod
|
||||
def reinstall_pytorch_with_cuda():
|
||||
result = subprocess.run(["pip", "install", "--upgrade", "torch", "torchvision", "torchaudio", "--no-cache-dir", "--index-url", "https://download.pytorch.org/whl/cu121"])
|
||||
if result.returncode != 0:
|
||||
ASCIIColors.warning("Couldn't find Cuda build tools on your PC. Reverting to CPU.")
|
||||
result = subprocess.run(["pip", "install", "--upgrade", "torch", "torchvision", "torchaudio", "--no-cache-dir"])
|
||||
if result.returncode != 0:
|
||||
ASCIIColors.error("Couldn't install pytorch !!")
|
||||
else:
|
||||
ASCIIColors.error("Pytorch installed successfully!!")
|
||||
|
||||
@staticmethod
|
||||
def reinstall_pytorch_with_rocm():
|
||||
result = subprocess.run(["pip", "install", "--upgrade", "torch", "torchvision", "torchaudio", "--no-cache-dir", "--index-url", "https://download.pytorch.org/whl/rocm5.6"])
|
||||
if result.returncode != 0:
|
||||
ASCIIColors.warning("Couldn't find Cuda build tools on your PC. Reverting to CPU.")
|
||||
result = subprocess.run(["pip", "install", "--upgrade", "torch", "torchvision", "torchaudio", "--no-cache-dir"])
|
||||
if result.returncode != 0:
|
||||
ASCIIColors.error("Couldn't install pytorch !!")
|
||||
else:
|
||||
ASCIIColors.error("Pytorch installed successfully!!")
|
||||
|
||||
|
||||
@staticmethod
|
||||
def reinstall_pytorch_with_cpu():
|
||||
result = subprocess.run(["pip", "install", "--upgrade", "torch", "torchvision", "torchaudio", "--no-cache-dir"])
|
||||
if result.returncode != 0:
|
||||
ASCIIColors.warning("Couldn't find Cuda build tools on your PC. Reverting to CPU.")
|
||||
result = subprocess.run(["pip", "install", "--upgrade", "torch", "torchvision", "torchaudio", "--no-cache-dir"])
|
||||
if result.returncode != 0:
|
||||
ASCIIColors.error("Couldn't install pytorch !!")
|
||||
else:
|
||||
ASCIIColors.error("Pytorch installed successfully!!")
|
||||
|
||||
|
||||
@staticmethod
|
||||
def vram_usage():
|
||||
|
Loading…
Reference in New Issue
Block a user