Spaces:
Sleeping
Sleeping
fix: Change truncate to truncation in tokenizer.encode()
Browse filesTypeError: PreTrainedTokenizerFast._batch_encode_plus() got an unexpected keyword argument 'truncate'
🔧 Fix:
- Change 'truncate=True' to 'truncation=True'
- Correct parameter name for Transformers library
- Fixes tokenization error during inference
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
app.py
CHANGED
|
@@ -85,7 +85,7 @@ def generate_response(message, history):
|
|
| 85 |
inputs = current_tokenizer.encode(
|
| 86 |
conversation,
|
| 87 |
return_tensors="pt",
|
| 88 |
-
|
| 89 |
max_length=512,
|
| 90 |
).to('cuda')
|
| 91 |
|
|
|
|
| 85 |
inputs = current_tokenizer.encode(
|
| 86 |
conversation,
|
| 87 |
return_tensors="pt",
|
| 88 |
+
truncation=True,
|
| 89 |
max_length=512,
|
| 90 |
).to('cuda')
|
| 91 |
|