Spaces:
Sleeping
Sleeping
Commit ·
1425e02
1
Parent(s): ca748a4
updated aggent
Browse files
agent.py
CHANGED
|
@@ -9,9 +9,10 @@ from sentence_transformers import SentenceTransformer
|
|
| 9 |
class CodingAgent:
|
| 10 |
def __init__(self):
|
| 11 |
# Load TinyLlama (CPU-friendly)
|
| 12 |
-
model_id = "
|
| 13 |
self.tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 14 |
-
self.model = AutoModelForCausalLM.from_pretrained(model_id)
|
|
|
|
| 15 |
self.llm = pipeline("text-generation", model=self.model, tokenizer=self.tokenizer, max_new_tokens=512, device=-1)
|
| 16 |
|
| 17 |
# Embedding model + FAISS index
|
|
|
|
| 9 |
class CodingAgent:
|
| 10 |
def __init__(self):
|
| 11 |
# Load TinyLlama (CPU-friendly)
|
| 12 |
+
model_id = "mistralai/Mistral-7B-Instruct-v0.2"
|
| 13 |
self.tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 14 |
+
self.model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
|
| 15 |
+
|
| 16 |
self.llm = pipeline("text-generation", model=self.model, tokenizer=self.tokenizer, max_new_tokens=512, device=-1)
|
| 17 |
|
| 18 |
# Embedding model + FAISS index
|