Update src/RAGSample.py
Browse files- src/RAGSample.py +15 -9
src/RAGSample.py
CHANGED
@@ -370,19 +370,25 @@ Answer:
|
|
370 |
|
371 |
# Initialize a local Hugging Face model
|
372 |
hf_pipeline = pipeline(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
"text-generation",
|
374 |
model="microsoft/BioGPT",
|
375 |
tokenizer="microsoft/BioGPT",
|
376 |
-
max_new_tokens=
|
377 |
-
max_length=1024, # BioGPT's context length
|
378 |
-
temperature=0.2, # Lower for more focused responses
|
379 |
device_map="auto",
|
380 |
-
torch_dtype=torch.float16
|
381 |
-
return_full_text=False,
|
382 |
-
truncation=True,
|
383 |
-
do_sample=True,
|
384 |
-
pad_token_id=1,
|
385 |
-
eos_token_id=2,
|
386 |
)
|
387 |
|
388 |
# Wrap it in LangChain
|
|
|
370 |
|
371 |
# Initialize a local Hugging Face model
|
372 |
hf_pipeline = pipeline(
|
373 |
+
# "text-generation",
|
374 |
+
# model="microsoft/BioGPT",
|
375 |
+
# tokenizer="microsoft/BioGPT",
|
376 |
+
# max_new_tokens=100, # Reduced for stability
|
377 |
+
# max_length=1024, # BioGPT's context length
|
378 |
+
# temperature=0.2, # Lower for more focused responses
|
379 |
+
# device_map="auto",
|
380 |
+
# torch_dtype=torch.float16,
|
381 |
+
# return_full_text=False,
|
382 |
+
# truncation=True,
|
383 |
+
# do_sample=True,
|
384 |
+
# pad_token_id=1,
|
385 |
+
# eos_token_id=2,
|
386 |
"text-generation",
|
387 |
model="microsoft/BioGPT",
|
388 |
tokenizer="microsoft/BioGPT",
|
389 |
+
max_new_tokens=50, # Very small for testing
|
|
|
|
|
390 |
device_map="auto",
|
391 |
+
torch_dtype=torch.float16
|
|
|
|
|
|
|
|
|
|
|
392 |
)
|
393 |
|
394 |
# Wrap it in LangChain
|