Mori-kamiyama commited on
Commit
8896598
·
1 Parent(s): f251f9b

Pytorchからllama.cppに変更

Browse files
Files changed (2) hide show
  1. app.py +7 -2
  2. requirements.txt +2 -1
app.py CHANGED
@@ -1,8 +1,13 @@
1
  import gradio as gr
2
  from llama_cpp import Llama
 
3
 
4
- # gguf形式のモデルファイルのパスを指定してロード
5
- llm = Llama(model_path="Mori-kamiyama/sarashina2-13b-r1/model.gguf")
 
 
 
 
6
 
7
  def generate_text(prompt):
8
  return llm(prompt)
 
1
  import gradio as gr
2
  from llama_cpp import Llama
3
+ from huggingface_hub import hf_hub_download
4
 
5
+ # Hugging Face上のリポジトリからモデルをダウンロードする
6
+ # repo_id はモデルが置かれているリポジトリのID、filename はモデルファイル名です
7
+ model_path = hf_hub_download(repo_id="Mori-kamiyama/sarashina2-13b-r1", filename="model.gguf")
8
+
9
+ # ダウンロードされたパスを使ってモデルをロード
10
+ llm = Llama(model_path=model_path)
11
 
12
  def generate_text(prompt):
13
  return llm(prompt)
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  gradio
2
- llama-cpp-python
 
 
1
  gradio
2
+ llama-cpp-python
3
+ huggingface_hub