Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,14 +33,19 @@ class ChatBot:
|
|
| 33 |
# Generate a response using the model
|
| 34 |
tokens = model.generate(
|
| 35 |
inputs.to(model.device),
|
| 36 |
-
max_new_tokens=
|
| 37 |
temperature=0.8,
|
| 38 |
-
do_sample=
|
| 39 |
)
|
| 40 |
|
| 41 |
# Decode and return the response
|
| 42 |
response_text = tokenizer.decode(tokens[0], skip_special_tokens=False)
|
| 43 |
return response_text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
bot = ChatBot()
|
| 46 |
|
|
|
|
| 33 |
# Generate a response using the model
|
| 34 |
tokens = model.generate(
|
| 35 |
inputs.to(model.device),
|
| 36 |
+
max_new_tokens=250,
|
| 37 |
temperature=0.8,
|
| 38 |
+
do_sample=False
|
| 39 |
)
|
| 40 |
|
| 41 |
# Decode and return the response
|
| 42 |
response_text = tokenizer.decode(tokens[0], skip_special_tokens=False)
|
| 43 |
return response_text
|
| 44 |
+
|
| 45 |
+
# Free up memory
|
| 46 |
+
del tokens
|
| 47 |
+
torch.cuda.empty_cache()
|
| 48 |
+
return response_text
|
| 49 |
|
| 50 |
bot = ChatBot()
|
| 51 |
|