Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from transformers import
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
model_name = "meta-llama/Llama-3.
|
|
|
|
|
|
|
| 6 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 7 |
model = AutoModelForCausalLM.from_pretrained(
|
| 8 |
model_name,
|
| 9 |
-
device_map=None, # Keine GPU
|
| 10 |
torch_dtype="float32" # Float32 für CPU
|
| 11 |
)
|
| 12 |
|
|
@@ -21,8 +23,8 @@ interface = gr.Interface(
|
|
| 21 |
fn=generate_response,
|
| 22 |
inputs="text",
|
| 23 |
outputs="text",
|
| 24 |
-
title="LLaMA 3.
|
| 25 |
-
description="Gib einen Text ein, und LLaMA 3.
|
| 26 |
)
|
| 27 |
|
| 28 |
# App starten
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 3 |
|
| 4 |
+
# Modellname
|
| 5 |
+
model_name = "meta-llama/Llama-3.1-8B-Instruct"
|
| 6 |
+
|
| 7 |
+
# Tokenizer und Modell laden
|
| 8 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 9 |
model = AutoModelForCausalLM.from_pretrained(
|
| 10 |
model_name,
|
| 11 |
+
device_map=None, # Keine GPU
|
| 12 |
torch_dtype="float32" # Float32 für CPU
|
| 13 |
)
|
| 14 |
|
|
|
|
| 23 |
fn=generate_response,
|
| 24 |
inputs="text",
|
| 25 |
outputs="text",
|
| 26 |
+
title="LLaMA 3.1 8B Instruct Text Generator (CPU)",
|
| 27 |
+
description="Gib einen Text ein, und LLaMA 3.1 8B Instruct generiert eine Antwort."
|
| 28 |
)
|
| 29 |
|
| 30 |
# App starten
|