juanelot commited on
Commit
5ed4d80
·
verified ·
1 Parent(s): da20661

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -3,7 +3,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
3
  import torch
4
 
5
  # Cargar el modelo y el tokenizador
6
- model_name = "mistralai/Mixtral-8x7B-Instruct-v0.1"
7
  tokenizer = AutoTokenizer.from_pretrained(model_name)
8
  model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", load_in_8bit=True)
9
 
@@ -26,7 +26,7 @@ def generate_response(prompt, max_length=200):
26
  def chatbot(message, history):
27
  history = history or []
28
 
29
- # Construir el prompt en el formato que Mixtral espera
30
  prompt = "Eres un asistente AI amigable y útil. Responde de manera concisa y coherente.\n\n"
31
  for human, ai in history:
32
  prompt += f"Human: {human}\nAssistant: {ai}\n"
@@ -41,8 +41,8 @@ iface = gr.Interface(
41
  fn=chatbot,
42
  inputs=["text", "state"],
43
  outputs=["chatbot", "state"],
44
- title="Tu Compañero AI con Mixtral",
45
- description="Un chatbot de IA avanzado utilizando el modelo Mixtral-8x7B-Instruct-v0.1 para conversaciones coherentes y naturales.",
46
  )
47
 
48
  iface.launch()
 
3
  import torch
4
 
5
  # Cargar el modelo y el tokenizador
6
+ model_name = "meta-llama/Llama-2-7b-chat-hf"
7
  tokenizer = AutoTokenizer.from_pretrained(model_name)
8
  model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto", load_in_8bit=True)
9
 
 
26
  def chatbot(message, history):
27
  history = history or []
28
 
29
+ # Construir el prompt en el formato que Llama-2 espera
30
  prompt = "Eres un asistente AI amigable y útil. Responde de manera concisa y coherente.\n\n"
31
  for human, ai in history:
32
  prompt += f"Human: {human}\nAssistant: {ai}\n"
 
41
  fn=chatbot,
42
  inputs=["text", "state"],
43
  outputs=["chatbot", "state"],
44
+ title="Tu Compañero AI con Llama-2",
45
+ description="Un chatbot de IA avanzado utilizando el modelo Llama-2-7b-chat para conversaciones coherentes y naturales.",
46
  )
47
 
48
  iface.launch()