Spaces:
Sleeping
Sleeping
Update chatbot_rag.py
Browse files- chatbot_rag.py +7 -5
chatbot_rag.py
CHANGED
|
@@ -29,17 +29,19 @@ def build_qa():
|
|
| 29 |
|
| 30 |
# 3. Load LLM (Phi-3 mini)
|
| 31 |
print("🔹 Loading LLM...")
|
| 32 |
-
model_id = "
|
| 33 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 34 |
-
model =
|
| 35 |
|
| 36 |
pipe = pipeline(
|
| 37 |
-
"
|
| 38 |
model=model,
|
| 39 |
tokenizer=tokenizer,
|
| 40 |
-
max_new_tokens=
|
| 41 |
-
|
|
|
|
| 42 |
)
|
|
|
|
| 43 |
llm = HuggingFacePipeline(pipeline=pipe)
|
| 44 |
|
| 45 |
# 4. Retriever
|
|
|
|
| 29 |
|
| 30 |
# 3. Load LLM (Phi-3 mini)
|
| 31 |
print("🔹 Loading LLM...")
|
| 32 |
+
model_id = "meta-llama/Llama-3.2-1B-Instruct" # or "meta-llama/Llama-3.1-1B-Instruct"
|
| 33 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 34 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 35 |
|
| 36 |
pipe = pipeline(
|
| 37 |
+
"text-generation",
|
| 38 |
model=model,
|
| 39 |
tokenizer=tokenizer,
|
| 40 |
+
max_new_tokens=256,
|
| 41 |
+
temperature=0.7,
|
| 42 |
+
do_sample=True
|
| 43 |
)
|
| 44 |
+
|
| 45 |
llm = HuggingFacePipeline(pipeline=pipe)
|
| 46 |
|
| 47 |
# 4. Retriever
|