kjdeka commited on
Commit
38eeaea
·
verified ·
1 Parent(s): 30a6046

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. your_rag_module.py +15 -2
your_rag_module.py CHANGED
@@ -1,8 +1,21 @@
 
1
  from llama_cpp import Llama
2
 
3
- # Load your model (adjust path and params as needed)
4
- llm = Llama(model_path="models/mistral-7b.Q4_K_M.gguf")
 
5
 
 
 
 
 
 
 
 
 
 
 
 
6
  def lcpp_llm(prompt, max_tokens=128, temperature=0.7, top_p=0.95, top_k=50):
7
  output = llm(
8
  prompt=prompt,
 
1
+ from huggingface_hub import hf_hub_download
2
  from llama_cpp import Llama
3
 
4
+ # Model configuration
5
+ model_name_or_path = "TheBloke/Mistral-7B-Instruct-v0.2-GGUF"
6
+ model_basename = "mistral-7b-instruct-v0.2.Q6_K.gguf"
7
 
8
+ # Download the model from Hugging Face Hub
9
+ model_path = hf_hub_download(
10
+ repo_id=model_name_or_path,
11
+ filename=model_basename,
12
+ cache_dir="./models" # Optional: controls where it's stored
13
+ )
14
+
15
+ # Load the model
16
+ llm = Llama(model_path=model_path)
17
+
18
+ # LLM wrapper for RAG pipeline
19
  def lcpp_llm(prompt, max_tokens=128, temperature=0.7, top_p=0.95, top_k=50):
20
  output = llm(
21
  prompt=prompt,