add max_length to showcase the use of truncation (#8975)
This commit is contained in:
@@ -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."],
|
... ["We are very happy to show you the 🤗 Transformers library.", "We hope you don't hate it."],
|
||||||
... padding=True,
|
... padding=True,
|
||||||
... truncation=True,
|
... truncation=True,
|
||||||
|
... max_length=512,
|
||||||
... return_tensors="pt"
|
... return_tensors="pt"
|
||||||
... )
|
... )
|
||||||
>>> ## TENSORFLOW CODE
|
>>> ## 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."],
|
... ["We are very happy to show you the 🤗 Transformers library.", "We hope you don't hate it."],
|
||||||
... padding=True,
|
... padding=True,
|
||||||
... truncation=True,
|
... truncation=True,
|
||||||
|
... max_length=512,
|
||||||
... return_tensors="tf"
|
... return_tensors="tf"
|
||||||
... )
|
... )
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user