Richard Neuschulz commited on
Commit
a8976c8
·
1 Parent(s): 06cae05
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -4,7 +4,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
4
  # Load the model and tokenizer from Hugging Face
5
  model_id = "seedboxai/KafkaLM-8x7B-German-V0.1-DPO"
6
  tokenizer = AutoTokenizer.from_pretrained(model_id)
7
- model = AutoModelForCausalLM.from_pretrained(model_id, load_in_8bit=False, trust_remote_code=True)
8
 
9
  # Define the text generation function
10
  def generate_text(user_input, system_prompt):
@@ -24,7 +24,7 @@ def generate_text(user_input, system_prompt):
24
 
25
  # Setup the Gradio interface
26
  iface = gr.Interface(fn=generate_text,
27
- inputs=[gr.Textbox(lines=2, label="User Prompt"), gr.Textbox(lines=5, label="System Prompt")],
28
  outputs=gr.Textbox(label="Generated Text"),
29
  title="Text Generation with KafkaLM",
30
  description="Enter a user prompt and a system prompt to generate text using the KafkaLM model.")
 
4
  # Load the model and tokenizer from Hugging Face
5
  model_id = "seedboxai/KafkaLM-8x7B-German-V0.1-DPO"
6
  tokenizer = AutoTokenizer.from_pretrained(model_id)
7
+ model = AutoModelForCausalLM.from_pretrained(model_id, load_in_4bit=True, load_in_8bit=False, trust_remote_code=True)
8
 
9
  # Define the text generation function
10
  def generate_text(user_input, system_prompt):
 
24
 
25
  # Setup the Gradio interface
26
  iface = gr.Interface(fn=generate_text,
27
+ inputs=[gr.Textbox(lines=2, label="User Prompt"), gr.Textbox(lines=5, label="System Prompt",text="Du bist ein freundlicher und hilfsbereiter KI-Assistent. Du beantwortest Fragen faktenorientiert und präzise, ohne dabei relevante Fakten auszulassen.")],
28
  outputs=gr.Textbox(label="Generated Text"),
29
  title="Text Generation with KafkaLM",
30
  description="Enter a user prompt and a system prompt to generate text using the KafkaLM model.")