Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,11 +8,9 @@ import torch
|
|
8 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
9 |
|
10 |
DESCRIPTION = """\
|
11 |
-
#
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
(Gemma-2-JPN is a Gemma 2 2B model fine-tuned on Japanese text. It supports the Japanese language at the same level of performance as English-only queries on Gemma 2.)
|
16 |
"""
|
17 |
|
18 |
MAX_MAX_NEW_TOKENS = 2048
|
@@ -21,7 +19,7 @@ MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
|
21 |
|
22 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
23 |
|
24 |
-
model_id = "
|
25 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
26 |
model = AutoModelForCausalLM.from_pretrained(
|
27 |
model_id,
|
@@ -37,7 +35,7 @@ def generate(
|
|
37 |
message: str,
|
38 |
chat_history: list[dict],
|
39 |
max_new_tokens: int = 1024,
|
40 |
-
temperature: float = 0.
|
41 |
top_p: float = 0.9,
|
42 |
top_k: int = 50,
|
43 |
repetition_penalty: float = 1.2,
|
|
|
8 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
9 |
|
10 |
DESCRIPTION = """\
|
11 |
+
# magro-7b
|
12 |
|
13 |
+
日本語ai
|
|
|
|
|
14 |
"""
|
15 |
|
16 |
MAX_MAX_NEW_TOKENS = 2048
|
|
|
19 |
|
20 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
21 |
|
22 |
+
model_id = "Sakalti/Magro-7B"
|
23 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
24 |
model = AutoModelForCausalLM.from_pretrained(
|
25 |
model_id,
|
|
|
35 |
message: str,
|
36 |
chat_history: list[dict],
|
37 |
max_new_tokens: int = 1024,
|
38 |
+
temperature: float = 0.7,
|
39 |
top_p: float = 0.9,
|
40 |
top_k: int = 50,
|
41 |
repetition_penalty: float = 1.2,
|