Spaces:
Sleeping
Sleeping
André Osyguß commited on
Commit ·
fc9fee2
1
Parent(s): 796c02f
add accelerate and fix bugs
Browse files- app.py +3 -2
- requirements.txt +3 -0
- test.py +3 -2
app.py
CHANGED
|
@@ -10,7 +10,7 @@ try:
|
|
| 10 |
pipe = pipeline(
|
| 11 |
"text-generation",
|
| 12 |
model="openai/gpt-oss-20b",
|
| 13 |
-
|
| 14 |
device=0 if torch.cuda.is_available() else -1
|
| 15 |
)
|
| 16 |
except Exception as e:
|
|
@@ -74,7 +74,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 74 |
chat_interface = gr.ChatInterface(
|
| 75 |
fn=chat_with_llm,
|
| 76 |
chatbot=gr.Chatbot(height=500),
|
| 77 |
-
additional_inputs=[system_prompt_input]
|
|
|
|
| 78 |
)
|
| 79 |
|
| 80 |
if __name__ == "__main__":
|
|
|
|
| 10 |
pipe = pipeline(
|
| 11 |
"text-generation",
|
| 12 |
model="openai/gpt-oss-20b",
|
| 13 |
+
dtype=torch.bfloat16,
|
| 14 |
device=0 if torch.cuda.is_available() else -1
|
| 15 |
)
|
| 16 |
except Exception as e:
|
|
|
|
| 74 |
chat_interface = gr.ChatInterface(
|
| 75 |
fn=chat_with_llm,
|
| 76 |
chatbot=gr.Chatbot(height=500),
|
| 77 |
+
additional_inputs=[system_prompt_input],
|
| 78 |
+
type='messages'
|
| 79 |
)
|
| 80 |
|
| 81 |
if __name__ == "__main__":
|
requirements.txt
CHANGED
|
@@ -1,2 +1,5 @@
|
|
| 1 |
transformers
|
| 2 |
torch
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
transformers
|
| 2 |
torch
|
| 3 |
+
gradio
|
| 4 |
+
spaces
|
| 5 |
+
accelerate
|
test.py
CHANGED
|
@@ -10,7 +10,7 @@ try:
|
|
| 10 |
pipe = pipeline(
|
| 11 |
"text-generation",
|
| 12 |
model="openai/gpt-oss-20b",
|
| 13 |
-
|
| 14 |
device=0 if torch.cuda.is_available() else -1
|
| 15 |
)
|
| 16 |
except Exception as e:
|
|
@@ -74,7 +74,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 74 |
chat_interface = gr.ChatInterface(
|
| 75 |
fn=chat_with_llm,
|
| 76 |
chatbot=gr.Chatbot(height=500),
|
| 77 |
-
additional_inputs=[system_prompt_input]
|
|
|
|
| 78 |
)
|
| 79 |
|
| 80 |
if __name__ == "__main__":
|
|
|
|
| 10 |
pipe = pipeline(
|
| 11 |
"text-generation",
|
| 12 |
model="openai/gpt-oss-20b",
|
| 13 |
+
dtype=torch.bfloat16,
|
| 14 |
device=0 if torch.cuda.is_available() else -1
|
| 15 |
)
|
| 16 |
except Exception as e:
|
|
|
|
| 74 |
chat_interface = gr.ChatInterface(
|
| 75 |
fn=chat_with_llm,
|
| 76 |
chatbot=gr.Chatbot(height=500),
|
| 77 |
+
additional_inputs=[system_prompt_input],
|
| 78 |
+
type='messages'
|
| 79 |
)
|
| 80 |
|
| 81 |
if __name__ == "__main__":
|