Spaces:
Paused
Paused
0x7o
commited on
Commit
•
8986eea
1
Parent(s):
ea48ef6
Update app.py
Browse files
app.py
CHANGED
@@ -7,8 +7,8 @@ from threading import Thread
|
|
7 |
|
8 |
# Loading the tokenizer and model from Hugging Face's model hub.
|
9 |
if torch.cuda.is_available():
|
10 |
-
tokenizer = AutoTokenizer.from_pretrained("0x7194633/fialka-13B-
|
11 |
-
model = AutoModelForCausalLM.from_pretrained("0x7194633/fialka-13B-
|
12 |
|
13 |
|
14 |
# Defining a custom stopping criteria class for the model's text generation.
|
@@ -28,7 +28,8 @@ def predict(message, history):
|
|
28 |
stop = StopOnTokens()
|
29 |
|
30 |
# Formatting the input for the model.
|
31 |
-
messages = "
|
|
|
32 |
for item in history_transformer_format])
|
33 |
model_inputs = tokenizer([messages], return_tensors="pt").to("cuda")
|
34 |
streamer = TextIteratorStreamer(tokenizer, timeout=10., skip_prompt=True, skip_special_tokens=True)
|
|
|
7 |
|
8 |
# Loading the tokenizer and model from Hugging Face's model hub.
|
9 |
if torch.cuda.is_available():
|
10 |
+
tokenizer = AutoTokenizer.from_pretrained("0x7194633/fialka-13B-v4")
|
11 |
+
model = AutoModelForCausalLM.from_pretrained("0x7194633/fialka-13B-v4", load_in_8bit=True, device_map="auto")
|
12 |
|
13 |
|
14 |
# Defining a custom stopping criteria class for the model's text generation.
|
|
|
28 |
stop = StopOnTokens()
|
29 |
|
30 |
# Formatting the input for the model.
|
31 |
+
messages = "<|system|>\nТы Фиалка - самый умный нейронный помощник, созданный 0x7o.</s>\n"
|
32 |
+
messages += "</s>".join(["</s>".join(["\n<|user|>" + item[0], "\n<|assistant|>" + item[1]])
|
33 |
for item in history_transformer_format])
|
34 |
model_inputs = tokenizer([messages], return_tensors="pt").to("cuda")
|
35 |
streamer = TextIteratorStreamer(tokenizer, timeout=10., skip_prompt=True, skip_special_tokens=True)
|