akhaliq HF Staff commited on
Commit
b6406f2
Β·
verified Β·
1 Parent(s): ddb0623

Update app.py from anycoder

Browse files
Files changed (1) hide show
  1. app.py +11 -3
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
- model = Mistral3ForConditionalGeneration.from_pretrained(model_id, device_map="auto")
12
- model = model.to(torch.bfloat16)
 
 
 
 
 
 
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.