Spaces:
Runtime error
Runtime error
Update app.py from anycoder
Browse files
app.py
CHANGED
|
@@ -5,11 +5,19 @@ from transformers import (
|
|
| 5 |
MistralCommonBackend,
|
| 6 |
)
|
| 7 |
|
| 8 |
-
# Initialize model and tokenizer
|
| 9 |
model_id = "mistralai/Devstral-Small-2-24B-Instruct-2512"
|
|
|
|
|
|
|
| 10 |
tokenizer = MistralCommonBackend.from_pretrained(model_id)
|
| 11 |
-
|
| 12 |
-
model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# System prompt
|
| 15 |
SP = """You are operating as and within Mistral Vibe, a CLI coding-agent built by Mistral AI and powered by default by the Devstral family of models. It wraps Mistral's Devstral models to enable natural language interaction with a local codebase. Use the available tools when helpful.
|
|
|
|
| 5 |
MistralCommonBackend,
|
| 6 |
)
|
| 7 |
|
| 8 |
+
# Initialize model and tokenizer with CPU configuration
|
| 9 |
model_id = "mistralai/Devstral-Small-2-24B-Instruct-2512"
|
| 10 |
+
|
| 11 |
+
# Load tokenizer
|
| 12 |
tokenizer = MistralCommonBackend.from_pretrained(model_id)
|
| 13 |
+
|
| 14 |
+
# Load model on CPU with appropriate configuration for zero-GPU
|
| 15 |
+
model = Mistral3ForConditionalGeneration.from_pretrained(
|
| 16 |
+
model_id,
|
| 17 |
+
device_map="cpu", # Force CPU usage
|
| 18 |
+
torch_dtype=torch.float32, # Use float32 for CPU compatibility
|
| 19 |
+
low_cpu_mem_usage=True # Reduce memory usage during loading
|
| 20 |
+
)
|
| 21 |
|
| 22 |
# System prompt
|
| 23 |
SP = """You are operating as and within Mistral Vibe, a CLI coding-agent built by Mistral AI and powered by default by the Devstral family of models. It wraps Mistral's Devstral models to enable natural language interaction with a local codebase. Use the available tools when helpful.
|