mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-01 02:31:11 +06:00
add max_length to showcase the use of truncation (#8975)
This commit is contained in:
parent
62d30e0583
commit
c108d0b5a4
@ -182,6 +182,7 @@ and get tensors back. You can specify all of that to the tokenizer:
|
||||
... ["We are very happy to show you the 🤗 Transformers library.", "We hope you don't hate it."],
|
||||
... padding=True,
|
||||
... truncation=True,
|
||||
... max_length=512,
|
||||
... return_tensors="pt"
|
||||
... )
|
||||
>>> ## TENSORFLOW CODE
|
||||
@ -189,6 +190,7 @@ and get tensors back. You can specify all of that to the tokenizer:
|
||||
... ["We are very happy to show you the 🤗 Transformers library.", "We hope you don't hate it."],
|
||||
... padding=True,
|
||||
... truncation=True,
|
||||
... max_length=512,
|
||||
... return_tensors="tf"
|
||||
... )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user