MuntasirHossain commited on
Commit
6c2d9a5
·
verified ·
1 Parent(s): 34b3043

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -6,12 +6,14 @@ from llama_cpp import Llama
6
  llm_name = "MuntasirHossain/Meta-Llama-3-8B-OpenOrca-GGUF"
7
  llm_path = os.path.basename(llm_name)
8
 
 
 
9
  # download gguf model
10
  def download_llms(llm_name):
11
  """Download GGUF model"""
12
  download_url = ""
13
  print("Downloading " + llm_name)
14
- download_url = "https://huggingface.co/MuntasirHossain/Meta-Llama-3-8B-OpenOrca-GGUF/resolve/main/Q4_K_M.gguf" # Q6_K
15
 
16
  if not os.path.exists("model"):
17
  os.makedirs("model")
@@ -32,15 +34,13 @@ def download_llms(llm_name):
32
  print("Download completed")
33
  else:
34
  print(f"Model download completed {response.status_code}")
35
- return llm_temp_file_path
36
 
37
  # define model pipeline with llama-cpp
38
  def initialize_llm(llm_model):
39
  model_path = ""
40
  if llm_model == llm_name:
41
- # model_path = "model/Q4_K_M.gguf"
42
  download_llms(llm_model)
43
- model_path=llm_temp_file_path
44
  llm = Llama(
45
  model_path=model_path,
46
  n_ctx=1024, # input text context length, 0 = from model
 
6
  llm_name = "MuntasirHossain/Meta-Llama-3-8B-OpenOrca-GGUF"
7
  llm_path = os.path.basename(llm_name)
8
 
9
+ gguf_model = "Q4_K_M" # "Q6_K.gguf"
10
+
11
  # download gguf model
12
  def download_llms(llm_name):
13
  """Download GGUF model"""
14
  download_url = ""
15
  print("Downloading " + llm_name)
16
+ download_url = f"https://huggingface.co/MuntasirHossain/Meta-Llama-3-8B-OpenOrca-GGUF/resolve/main/{gguf_model}"
17
 
18
  if not os.path.exists("model"):
19
  os.makedirs("model")
 
34
  print("Download completed")
35
  else:
36
  print(f"Model download completed {response.status_code}")
 
37
 
38
  # define model pipeline with llama-cpp
39
  def initialize_llm(llm_model):
40
  model_path = ""
41
  if llm_model == llm_name:
42
+ model_path = f"model/{gguf_model}"
43
  download_llms(llm_model)
 
44
  llm = Llama(
45
  model_path=model_path,
46
  n_ctx=1024, # input text context length, 0 = from model