junaid17 commited on
Commit
e31573a
·
verified ·
1 Parent(s): 8d250ad

Update scripts/load_model.py

Browse files
Files changed (1) hide show
  1. scripts/load_model.py +4 -4
scripts/load_model.py CHANGED
@@ -1,15 +1,15 @@
1
  # model_loader.py
2
  from langchain_community.chat_models import ChatLlamaCpp
3
- from huggingface_hub import hf_hub_download
4
 
5
  _llm_instance = None
6
 
7
  def get_model(callbacks=None):
8
  global _llm_instance
9
  if _llm_instance is None:
10
- print("Downloading model from Hugging Face...")
11
- model_path = hf_hub_download(repo_id="junaid17/qwen2.5-0.5b-coding-assistant-gguf", filename="qwen2.5-0.5b-coding-assistant-q4_k_m.gguf")
12
- print("Loading ChatLlamaCpp model for the first time...")
13
  _llm_instance = ChatLlamaCpp(
14
  model_path=model_path,
15
  temperature=0.7,
 
1
  # model_loader.py
2
  from langchain_community.chat_models import ChatLlamaCpp
3
+ import os
4
 
5
  _llm_instance = None
6
 
7
  def get_model(callbacks=None):
8
  global _llm_instance
9
  if _llm_instance is None:
10
+ model_path = os.path.join(os.path.dirname(__file__), os.pardir, "Model", "qwen2.5-0.5b-coding-assistant-q4_k_m.gguf")
11
+ model_path = os.path.abspath(model_path)
12
+ print(f"Loading ChatLlamaCpp model from local path: {model_path}")
13
  _llm_instance = ChatLlamaCpp(
14
  model_path=model_path,
15
  temperature=0.7,