Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,12 +39,14 @@ def get_vector_store(chunks):
|
|
| 39 |
class DeepSeekChat:
|
| 40 |
def __init__(self):
|
| 41 |
try:
|
| 42 |
-
|
|
|
|
| 43 |
self.model = AutoModelForCausalLM.from_pretrained(
|
| 44 |
LLM_MODEL_NAME,
|
| 45 |
torch_dtype=torch.float16 if DEVICE == "cuda" else torch.float32,
|
| 46 |
low_cpu_mem_usage=True,
|
| 47 |
-
cache_dir="./cache"
|
|
|
|
| 48 |
).to(DEVICE)
|
| 49 |
except Exception as e:
|
| 50 |
raise RuntimeError(f"Error loading DeepSeek model: {e}")
|
|
|
|
| 39 |
class DeepSeekChat:
|
| 40 |
def __init__(self):
|
| 41 |
try:
|
| 42 |
+
# Load tokenizer and model from Hugging Face with custom code execution allowed
|
| 43 |
+
self.tokenizer = AutoTokenizer.from_pretrained(LLM_MODEL_NAME, cache_dir="./cache", trust_remote_code=True)
|
| 44 |
self.model = AutoModelForCausalLM.from_pretrained(
|
| 45 |
LLM_MODEL_NAME,
|
| 46 |
torch_dtype=torch.float16 if DEVICE == "cuda" else torch.float32,
|
| 47 |
low_cpu_mem_usage=True,
|
| 48 |
+
cache_dir="./cache",
|
| 49 |
+
trust_remote_code=True
|
| 50 |
).to(DEVICE)
|
| 51 |
except Exception as e:
|
| 52 |
raise RuntimeError(f"Error loading DeepSeek model: {e}")
|