Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -38,11 +38,11 @@ h1 {
|
|
38 |
"""
|
39 |
|
40 |
# Load the tokenizer and model
|
41 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
42 |
-
model = AutoModelForCausalLM.from_pretrained("
|
43 |
terminators = [
|
44 |
tokenizer.eos_token_id,
|
45 |
-
tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
46 |
]
|
47 |
|
48 |
#@spaces.GPU(duration=120)
|
@@ -75,7 +75,7 @@ def chat_llama3_8b(message: str,
|
|
75 |
streamer=streamer,
|
76 |
max_new_tokens=max_new_tokens,
|
77 |
do_sample=True,
|
78 |
-
|
79 |
eos_token_id=terminators,
|
80 |
)
|
81 |
# This will enforce greedy generation (do_sample=False) when the temperature is passed 0, avoiding the crash.
|
@@ -93,7 +93,7 @@ def chat_llama3_8b(message: str,
|
|
93 |
|
94 |
|
95 |
# Gradio block
|
96 |
-
chatbot=gr.Chatbot(height=450, placeholder=PLACEHOLDER, label='
|
97 |
|
98 |
with gr.Blocks(fill_height=True, css=css) as demo:
|
99 |
|
@@ -105,12 +105,12 @@ with gr.Blocks(fill_height=True, css=css) as demo:
|
|
105 |
fill_height=True,
|
106 |
additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False, render=False),
|
107 |
additional_inputs=[
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
gr.Slider(minimum=128,
|
115 |
maximum=4096,
|
116 |
step=1,
|
|
|
38 |
"""
|
39 |
|
40 |
# Load the tokenizer and model
|
41 |
+
tokenizer = AutoTokenizer.from_pretrained("umair894/llama3")
|
42 |
+
model = AutoModelForCausalLM.from_pretrained("umair894/llama3", device_map="cuda:0") # to("auto")
|
43 |
terminators = [
|
44 |
tokenizer.eos_token_id,
|
45 |
+
tokenizer.convert_tokens_to_ids("<|eot_id|>") #eos_token
|
46 |
]
|
47 |
|
48 |
#@spaces.GPU(duration=120)
|
|
|
75 |
streamer=streamer,
|
76 |
max_new_tokens=max_new_tokens,
|
77 |
do_sample=True,
|
78 |
+
temperature=temperature,
|
79 |
eos_token_id=terminators,
|
80 |
)
|
81 |
# This will enforce greedy generation (do_sample=False) when the temperature is passed 0, avoiding the crash.
|
|
|
93 |
|
94 |
|
95 |
# Gradio block
|
96 |
+
chatbot=gr.Chatbot(height=450, placeholder=PLACEHOLDER, label='ChatInterface')
|
97 |
|
98 |
with gr.Blocks(fill_height=True, css=css) as demo:
|
99 |
|
|
|
105 |
fill_height=True,
|
106 |
additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False, render=False),
|
107 |
additional_inputs=[
|
108 |
+
gr.Slider(minimum=0,
|
109 |
+
maximum=1,
|
110 |
+
step=0.1,
|
111 |
+
value=0.95,
|
112 |
+
label="Temperature",
|
113 |
+
render=False),
|
114 |
gr.Slider(minimum=128,
|
115 |
maximum=4096,
|
116 |
step=1,
|