mirror of
https://github.com/saymrwulf/transformers.git
synced 2026-05-14 20:58:08 +00:00
add max_length to showcase the use of truncation (#8975)
This commit is contained in:
parent
62d30e0583
commit
c108d0b5a4
1 changed files with 2 additions and 0 deletions
|
|
@ -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 a new issue