Update app.py
Browse files
app.py
CHANGED
@@ -26,8 +26,9 @@ import accelerate
|
|
26 |
import bitsandbytes
|
27 |
|
28 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
29 |
-
|
30 |
-
|
|
|
31 |
temperature=0.4
|
32 |
max_new_tokens=240
|
33 |
top_p=0.92
|
@@ -38,7 +39,7 @@ model = transformers.AutoModelForCausalLM.from_pretrained(model_name,
|
|
38 |
device_map="auto",
|
39 |
torch_dtype="auto"
|
40 |
)
|
41 |
-
model.eval()
|
42 |
|
43 |
class StarlingBot:
|
44 |
def __init__(self, system_prompt="I am Starling-7B by Tonic-AI, I ready to do anything to help my user."):
|
@@ -53,9 +54,9 @@ class StarlingBot:
|
|
53 |
input_ids=input_ids,
|
54 |
use_cache=True,
|
55 |
early_stopping=False,
|
56 |
-
bos_token_id=
|
57 |
-
eos_token_id=
|
58 |
-
pad_token_id=
|
59 |
temperature=temperature,
|
60 |
do_sample=True,
|
61 |
max_new_tokens=max_new_tokens,
|
|
|
26 |
import bitsandbytes
|
27 |
|
28 |
# device = "cuda" if torch.cuda.is_available() else "cpu"
|
29 |
+
bos_token_id = 1,
|
30 |
+
eos_token_id = 32000
|
31 |
+
pad_token_id = 32001
|
32 |
temperature=0.4
|
33 |
max_new_tokens=240
|
34 |
top_p=0.92
|
|
|
39 |
device_map="auto",
|
40 |
torch_dtype="auto"
|
41 |
)
|
42 |
+
# model.eval()
|
43 |
|
44 |
class StarlingBot:
|
45 |
def __init__(self, system_prompt="I am Starling-7B by Tonic-AI, I ready to do anything to help my user."):
|
|
|
54 |
input_ids=input_ids,
|
55 |
use_cache=True,
|
56 |
early_stopping=False,
|
57 |
+
bos_token_id=bos_token_id,
|
58 |
+
eos_token_id=eos_token_id,
|
59 |
+
pad_token_id=pad_token_id,
|
60 |
temperature=temperature,
|
61 |
do_sample=True,
|
62 |
max_new_tokens=max_new_tokens,
|