Spaces:
Sleeping
Sleeping
Commit
·
1c2fbc9
1
Parent(s):
8896598
Pytorchからllama.cppに変更
Browse files- .gitignore +0 -0
- app.py +11 -5
.gitignore
ADDED
|
File without changes
|
app.py
CHANGED
|
@@ -1,12 +1,18 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
|
| 3 |
from huggingface_hub import hf_hub_download
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
# ダウンロードされたパスを使ってモデルをロード
|
| 10 |
llm = Llama(model_path=model_path)
|
| 11 |
|
| 12 |
def generate_text(prompt):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
import pathlib
|
| 3 |
from huggingface_hub import hf_hub_download
|
| 4 |
+
from llama_cpp import Llama
|
| 5 |
+
|
| 6 |
+
# 書き込み可能なディレクトリを指定(例:現在のディレクトリの "models" フォルダ)
|
| 7 |
+
models_dir = pathlib.Path(__file__).parent / "models"
|
| 8 |
+
models_dir.mkdir(exist_ok=True)
|
| 9 |
|
| 10 |
+
model_path = hf_hub_download(
|
| 11 |
+
repo_id="Mori-kamiyama/sarashina2-13b-r1",
|
| 12 |
+
filename="model.gguf",
|
| 13 |
+
local_dir=models_dir
|
| 14 |
+
)
|
| 15 |
|
|
|
|
| 16 |
llm = Llama(model_path=model_path)
|
| 17 |
|
| 18 |
def generate_text(prompt):
|