mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2024-12-18 20:17:50 +00:00
Inhanced model installation, Working hugging face binding
This commit is contained in:
parent
1c80ba41b4
commit
a6deac5f9c
3
.gitignore
vendored
3
.gitignore
vendored
@ -203,3 +203,6 @@ src/taming-transformers
|
||||
|
||||
# Temporary arguments to restart file
|
||||
temp_args.txt
|
||||
|
||||
# Hugging face offloading folder
|
||||
offload
|
@ -223,6 +223,7 @@ class LoLLMsAPPI(LollmsApplication):
|
||||
binding_folder = self.config["binding_name"]
|
||||
model_url = model_path
|
||||
signature = f"{model_name}_{binding_folder}_{model_url}"
|
||||
try:
|
||||
self.download_infos[signature]={
|
||||
"start_time":datetime.now(),
|
||||
"total_size":self.binding.get_file_size(model_path),
|
||||
@ -233,10 +234,10 @@ class LoLLMsAPPI(LollmsApplication):
|
||||
}
|
||||
|
||||
if installation_path.exists():
|
||||
print("Error: Model already exists")
|
||||
print("Error: Model already exists. please remove it first")
|
||||
socketio.emit('install_progress',{
|
||||
'status': False,
|
||||
'error': 'model already exists',
|
||||
'error': f'model already exists. Please remove it first.\nThe model can be found here:{installation_path}',
|
||||
'model_name' : model_name,
|
||||
'binding_folder' : binding_folder,
|
||||
'model_url' : model_url,
|
||||
@ -293,6 +294,7 @@ class LoLLMsAPPI(LollmsApplication):
|
||||
self.binding.download_model(model_path, installation_path, callback)
|
||||
except Exception as ex:
|
||||
ASCIIColors.warning(str(ex))
|
||||
trace_exception(ex)
|
||||
socketio.emit('install_progress',{
|
||||
'status': False,
|
||||
'error': 'canceled',
|
||||
@ -318,6 +320,7 @@ class LoLLMsAPPI(LollmsApplication):
|
||||
self.download_file(model_path, installation_path, callback)
|
||||
except Exception as ex:
|
||||
ASCIIColors.warning(str(ex))
|
||||
trace_exception(ex)
|
||||
socketio.emit('install_progress',{
|
||||
'status': False,
|
||||
'error': 'canceled',
|
||||
@ -347,7 +350,21 @@ class LoLLMsAPPI(LollmsApplication):
|
||||
'speed': self.download_infos[signature]['speed'],
|
||||
}, room=room_id)
|
||||
del self.download_infos[signature]
|
||||
|
||||
except Exception as ex:
|
||||
trace_exception(ex)
|
||||
socketio.emit('install_progress',{
|
||||
'status': False,
|
||||
'error': str(ex),
|
||||
'model_name' : model_name,
|
||||
'binding_folder' : binding_folder,
|
||||
'model_url' : model_url,
|
||||
'start_time': '',
|
||||
'total_size': 0,
|
||||
'downloaded_size': 0,
|
||||
'progress': 0,
|
||||
'speed': 0,
|
||||
}, room=room_id
|
||||
)
|
||||
tpe = threading.Thread(target=install_model_, args=())
|
||||
tpe.start()
|
||||
|
||||
|
5
app.py
5
app.py
@ -1646,6 +1646,11 @@ class LoLLMsWebUI(LoLLMsAPPI):
|
||||
path = f'{server}{filename}'
|
||||
else:
|
||||
path = f'{server}/{filename}'
|
||||
blocs = filename.split("/")
|
||||
|
||||
# Special case, if hugging face model format
|
||||
if len(blocs)==2:
|
||||
filename = blocs[1]
|
||||
local_path = lollms_paths.personal_models_path/f'{self.config["binding_name"]}/{filename}'
|
||||
is_installed = local_path.exists() or model_type.lower()=="api"
|
||||
models.append({
|
||||
|
Loading…
Reference in New Issue
Block a user