diff --git a/lollms/binding.py b/lollms/binding.py index 096d3f7..3cf0333 100644 --- a/lollms/binding.py +++ b/lollms/binding.py @@ -12,6 +12,10 @@ from typing import Callable from lollms.paths import LollmsPaths from lollms.helpers import ASCIIColors +import tempfile +import requests +import shutil +import os import yaml from tqdm import tqdm import importlib @@ -59,6 +63,34 @@ class LLMBinding: self.models_folder = config.lollms_paths.personal_models_path / self.binding_folder_name self.models_folder.mkdir(parents=True, exist_ok=True) + + def download_and_install_wheel(self, url): + # Create a temporary directory + temp_dir = tempfile.mkdtemp() + + try: + # Download the wheel file + response = requests.get(url) + if response.status_code == 200: + # Save the downloaded file to the temporary directory + wheel_path = os.path.join(temp_dir, 'package.whl') + with open(wheel_path, 'wb') as file: + file.write(response.content) + + # Install the wheel file using pip + subprocess.check_call(['pip', 'install', wheel_path]) + + # Clean up the temporary directory + shutil.rmtree(temp_dir) + print('Installation completed successfully.') + else: + print('Failed to download the file.') + + except Exception as e: + print('An error occurred during installation:', str(e)) + shutil.rmtree(temp_dir) + + def build_model(self): """ Build the model. diff --git a/lollms/configs/config.yaml b/lollms/configs/config.yaml index f41777c..4c32343 100644 --- a/lollms/configs/config.yaml +++ b/lollms/configs/config.yaml @@ -1,6 +1,6 @@ # =================== Lord Of Large Language Models Configuration file =========================== version: 6 -binding_name: c_transformers +binding_name: null model_name: null # Host information