Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,12 +7,13 @@ model_name = "petals-team/StableBeluga2" # This one is fine-tuned Llama 2 (70B)
|
|
7 |
# Connect to a distributed network hosting model layers
|
8 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
9 |
model = AutoDistributedModelForCausalLM.from_pretrained(model_name)
|
10 |
-
system_prompt = "### System:\nYou are Stable Beluga, an AI that is very precise. Be as accurate
|
11 |
-
|
12 |
message = st.chat_input('Message')
|
13 |
if message:
|
14 |
-
prompt = f"
|
|
|
15 |
# Run the model as if it were on your computer
|
16 |
-
inputs = tokenizer(
|
17 |
outputs = model.generate(inputs, max_new_tokens=256)
|
18 |
st.write(tokenizer.decode(outputs[0])[3:-4])
|
|
|
7 |
# Connect to a distributed network hosting model layers
|
8 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
9 |
model = AutoDistributedModelForCausalLM.from_pretrained(model_name)
|
10 |
+
system_prompt = "### System:\nYou are Stable Beluga, an AI that is very precise and creative. Be as creative and accurate you can.\n\n"
|
11 |
+
conv=system_prompt
|
12 |
message = st.chat_input('Message')
|
13 |
if message:
|
14 |
+
prompt = f"### User: {message}\n\n### Assistant:\n"
|
15 |
+
conv+=prompt
|
16 |
# Run the model as if it were on your computer
|
17 |
+
inputs = tokenizer(conv, return_tensors="pt")["input_ids"]
|
18 |
outputs = model.generate(inputs, max_new_tokens=256)
|
19 |
st.write(tokenizer.decode(outputs[0])[3:-4])
|