Spaces:
Runtime error
Runtime error
usag1e
commited on
Commit
·
2c0f83d
1
Parent(s):
18deb2f
Add trust_remote_code=True for DeepSeek model
Browse files
app.py
CHANGED
|
@@ -6,8 +6,12 @@ import torch
|
|
| 6 |
# Load the model and tokenizer
|
| 7 |
MODEL_NAME = "deepseek-ai/DeepSeek-V3-Base" # Change to the model you want
|
| 8 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 9 |
-
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
|
| 10 |
-
model = AutoModelForCausalLM.from_pretrained(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
app = FastAPI()
|
| 13 |
|
|
|
|
| 6 |
# Load the model and tokenizer
|
| 7 |
MODEL_NAME = "deepseek-ai/DeepSeek-V3-Base" # Change to the model you want
|
| 8 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 9 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME, trust_remote_code=True)
|
| 10 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 11 |
+
MODEL_NAME,
|
| 12 |
+
device_map="auto",
|
| 13 |
+
trust_remote_code=True # Allow execution of custom code
|
| 14 |
+
).to(device)
|
| 15 |
|
| 16 |
app = FastAPI()
|
| 17 |
|