Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,20 +6,18 @@ 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 |
-
|
| 10 |
# Fetch your secure token from the Space Secrets environment
|
| 11 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 12 |
|
| 13 |
print("Loading tokenizer and base model...")
|
| 14 |
|
| 15 |
-
#
|
|
|
|
| 16 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 17 |
-
|
| 18 |
-
token=HF_TOKEN,
|
| 19 |
-
use_fast=False
|
| 20 |
)
|
| 21 |
|
| 22 |
-
# We load
|
| 23 |
# ZeroGPU will automatically move the model to the GPU when the decorated function runs [1]
|
| 24 |
model = AutoModelForCausalLM.from_pretrained(
|
| 25 |
MODEL_ID,
|
|
|
|
| 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
|
| 10 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
| 11 |
|
| 12 |
print("Loading tokenizer and base model...")
|
| 13 |
|
| 14 |
+
# 1. Load the tokenizer from the official, guaranteed-clean Qwen repository
|
| 15 |
+
# This bypasses any local repository file corruption or cache issues
|
| 16 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 17 |
+
"Qwen/Qwen2.5-Coder-1.5B-Instruct"
|
|
|
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
+
# 2. We load your custom model in 16-bit on CPU first
|
| 21 |
# ZeroGPU will automatically move the model to the GPU when the decorated function runs [1]
|
| 22 |
model = AutoModelForCausalLM.from_pretrained(
|
| 23 |
MODEL_ID,
|