lruizap commited on
Commit
eaf234f
·
1 Parent(s): 72ddb5c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -14,9 +14,9 @@ pipe = pipeline("text-generation", model="HuggingFaceH4/zephyr-7b-alpha",
14
  torch_dtype=torch.bfloat16, device_map="auto")
15
 
16
 
17
- def generatePrompt(inputs):
18
- prompt = inputs[0]
19
- promptdos = inputs[1]
20
  batch = tokenizer(prompt, return_tensors="pt")
21
  generated_ids = model.generate(batch["input_ids"])
22
  output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
@@ -27,8 +27,12 @@ def generatePrompt(inputs):
27
  "role": "system",
28
  "content": "you are a chatbot who always responds politely and in the shortest possible way",
29
  },
30
- {"role": "user", "content": str(new_prompt)},
31
- {"role": "user", "content": str(promptdos)},
 
 
 
 
32
  ]
33
  # https://huggingface.co/docs/transformers/main/en/chat_templating
34
  final_prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
 
14
  torch_dtype=torch.bfloat16, device_map="auto")
15
 
16
 
17
+ def generatePrompt(input, inputdos):
18
+ prompt = input
19
+ promptdos = inputdos
20
  batch = tokenizer(prompt, return_tensors="pt")
21
  generated_ids = model.generate(batch["input_ids"])
22
  output = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)
 
27
  "role": "system",
28
  "content": "you are a chatbot who always responds politely and in the shortest possible way",
29
  },
30
+ {
31
+ "role": "user", "content": str(new_prompt)
32
+ },
33
+ {
34
+ "role": "user", "content": str(promptdos)
35
+ },
36
  ]
37
  # https://huggingface.co/docs/transformers/main/en/chat_templating
38
  final_prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)