Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import os
|
|
| 3 |
import gradio as gr
|
| 4 |
import torch
|
| 5 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 6 |
-
import spaces # Mandatory library for Hugging Face ZeroGPU
|
| 7 |
|
| 8 |
MODEL_ID = "DevStudio-AI/Devstudio-Coder-1.5B"
|
| 9 |
# Fetch your secure token from the Space Secrets environment
|
|
@@ -17,10 +17,10 @@ tokenizer = AutoTokenizer.from_pretrained(
|
|
| 17 |
"Qwen/Qwen2.5-Coder-1.5B-Instruct"
|
| 18 |
)
|
| 19 |
|
| 20 |
-
# 2.
|
| 21 |
-
# ZeroGPU will automatically move the model to the GPU when the decorated function runs [1]
|
| 22 |
model = AutoModelForCausalLM.from_pretrained(
|
| 23 |
MODEL_ID,
|
|
|
|
| 24 |
torch_dtype=torch.float16,
|
| 25 |
device_map="cpu",
|
| 26 |
token=HF_TOKEN
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
import torch
|
| 5 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 6 |
+
import spaces # Mandatory library for Hugging Face ZeroGPU [1]
|
| 7 |
|
| 8 |
MODEL_ID = "DevStudio-AI/Devstudio-Coder-1.5B"
|
| 9 |
# Fetch your secure token from the Space Secrets environment
|
|
|
|
| 17 |
"Qwen/Qwen2.5-Coder-1.5B-Instruct"
|
| 18 |
)
|
| 19 |
|
| 20 |
+
# 2. Load the model, pointing directly to the nested directory inside your repo
|
|
|
|
| 21 |
model = AutoModelForCausalLM.from_pretrained(
|
| 22 |
MODEL_ID,
|
| 23 |
+
subfolder="models/final_merged", # Tells the loader to look inside this folder [1]
|
| 24 |
torch_dtype=torch.float16,
|
| 25 |
device_map="cpu",
|
| 26 |
token=HF_TOKEN
|