Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ import os
|
|
9 |
# Install flash-attn
|
10 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
11 |
# Initialize the model pipeline
|
12 |
-
generator = pipeline('text-generation', model='
|
13 |
@spaces.GPU
|
14 |
def generate_text(prompt, temperature, top_p, top_k, repetition_penalty, max_length):
|
15 |
# Generate text using the model
|
@@ -35,7 +35,7 @@ def generate_text(prompt, temperature, top_p, top_k, repetition_penalty, max_len
|
|
35 |
iface = gr.Interface(
|
36 |
fn=generate_text,
|
37 |
inputs=[
|
38 |
-
gr.Textbox(label="Prompt", lines=2,
|
39 |
gr.Slider(minimum=0.1, maximum=2.0, step=0.01, value=0.8, label="Temperature"),
|
40 |
gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.95, label="Top p"),
|
41 |
gr.Slider(minimum=0, maximum=100, step=1, value=40, label="Top k"),
|
@@ -43,8 +43,8 @@ iface = gr.Interface(
|
|
43 |
gr.Slider(minimum=5, maximum=4096, step=5, value=1024, label="Max Length")
|
44 |
],
|
45 |
outputs=gr.Textbox(label="Generated Text"),
|
46 |
-
title="
|
47 |
-
description="Try out the
|
48 |
)
|
49 |
|
50 |
iface.launch()
|
|
|
9 |
# Install flash-attn
|
10 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
11 |
# Initialize the model pipeline
|
12 |
+
generator = pipeline('text-generation', model='M4-ai/tau-0.5B', torch_dtype=torch.bfloat16)
|
13 |
@spaces.GPU
|
14 |
def generate_text(prompt, temperature, top_p, top_k, repetition_penalty, max_length):
|
15 |
# Generate text using the model
|
|
|
35 |
iface = gr.Interface(
|
36 |
fn=generate_text,
|
37 |
inputs=[
|
38 |
+
gr.Textbox(label="Prompt", lines=2, value="Write me a Python program that calculates the factorial of a given number."),
|
39 |
gr.Slider(minimum=0.1, maximum=2.0, step=0.01, value=0.8, label="Temperature"),
|
40 |
gr.Slider(minimum=0.0, maximum=1.0, step=0.01, value=0.95, label="Top p"),
|
41 |
gr.Slider(minimum=0, maximum=100, step=1, value=40, label="Top k"),
|
|
|
43 |
gr.Slider(minimum=5, maximum=4096, step=5, value=1024, label="Max Length")
|
44 |
],
|
45 |
outputs=gr.Textbox(label="Generated Text"),
|
46 |
+
title="M4-ai/tau-0.5B",
|
47 |
+
description="Try out the M4-ai/tau-0.5B model for free!"
|
48 |
)
|
49 |
|
50 |
iface.launch()
|