Update app.py
Browse files
app.py
CHANGED
|
@@ -29,8 +29,12 @@ def respond(message, history: list[tuple[str, str]], system_message, max_tokens,
|
|
| 29 |
return_tensors="pt", # Return tensors for PyTorch
|
| 30 |
)
|
| 31 |
|
|
|
|
|
|
|
|
|
|
| 32 |
# Extract input_ids correctly
|
| 33 |
-
input_ids = inputs["input_ids"]
|
|
|
|
| 34 |
|
| 35 |
# Generate response
|
| 36 |
output = model.generate(
|
|
@@ -41,6 +45,10 @@ def respond(message, history: list[tuple[str, str]], system_message, max_tokens,
|
|
| 41 |
min_p=min_p,
|
| 42 |
)
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
# Decode and format the response
|
| 45 |
# Use `decode` for the first sequence in the batch
|
| 46 |
response = tokenizer.decode(output[0], skip_special_tokens=True)
|
|
|
|
| 29 |
return_tensors="pt", # Return tensors for PyTorch
|
| 30 |
)
|
| 31 |
|
| 32 |
+
# Debug inputs
|
| 33 |
+
print("Inputs:", inputs)
|
| 34 |
+
|
| 35 |
# Extract input_ids correctly
|
| 36 |
+
input_ids = inputs["input_ids"] # Ensure the correct field is used
|
| 37 |
+
print("Input IDs shape:", input_ids.shape)
|
| 38 |
|
| 39 |
# Generate response
|
| 40 |
output = model.generate(
|
|
|
|
| 45 |
min_p=min_p,
|
| 46 |
)
|
| 47 |
|
| 48 |
+
# Debug output
|
| 49 |
+
print("Generated Output Shape:", output.shape)
|
| 50 |
+
print("Generated Output:", output)
|
| 51 |
+
|
| 52 |
# Decode and format the response
|
| 53 |
# Use `decode` for the first sequence in the batch
|
| 54 |
response = tokenizer.decode(output[0], skip_special_tokens=True)
|