Spaces:
Sleeping
Sleeping
Commit
·
8896598
1
Parent(s):
f251f9b
Pytorchからllama.cppに変更
Browse files- app.py +7 -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 |
-
#
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|