This commit is contained in:
Qing
2023-12-15 12:40:29 +08:00
parent 142aa64cc6
commit cbe6577890
9 changed files with 35 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import os
import hashlib
import traceback
os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
@@ -453,7 +454,8 @@ def switch_model():
try:
model.switch(new_name)
except Exception as e:
error_message = str(e)
traceback.print_exc()
error_message = f"{type(e).__name__} - {str(e)}"
logger.error(error_message)
return f"Switch model failed: {error_message}", 500
return f"ok, switch to {new_name}", 200