brendon-ai commited on
Commit
11bfb6b
·
verified ·
1 Parent(s): 6b52a00

Update src/RAGSample.py

Browse files
Files changed (1) hide show
  1. src/RAGSample.py +6 -3
src/RAGSample.py CHANGED
@@ -366,12 +366,15 @@ Answer:
366
  # Initialize a local Hugging Face model
367
  hf_pipeline = pipeline(
368
  "text-generation",
369
- model="deepseek-ai/DeepSeek-R1-0528-Qwen3-8B", # Good for Q&A tasks
370
  tokenizer="deepseek-ai/DeepSeek-R1-0528-Qwen3-8B",
371
- max_length=512,
372
  temperature=0.1,
373
  device=0 if torch.cuda.is_available() else -1,
374
- return_full_text=False
 
 
 
375
  )
376
 
377
  # Wrap it in LangChain
 
366
  # Initialize a local Hugging Face model
367
  hf_pipeline = pipeline(
368
  "text-generation",
369
+ model="deepseek-ai/DeepSeek-R1-0528-Qwen3-8B", # Excellent for Q&A tasks
370
  tokenizer="deepseek-ai/DeepSeek-R1-0528-Qwen3-8B",
371
+ max_new_tokens=150, # Generate only 150 new tokens instead of max_length
372
  temperature=0.1,
373
  device=0 if torch.cuda.is_available() else -1,
374
+ return_full_text=False,
375
+ truncation=True, # Truncate input if too long
376
+ do_sample=True, # Enable sampling for better responses
377
+ pad_token_id=50256 # Add padding token to avoid warnings
378
  )
379
 
380
  # Wrap it in LangChain