Skip to content

Instantly share code, notes, and snippets.

@jamescalam
Created June 11, 2021 17:06
Show Gist options
  • Save jamescalam/c5feaf0ca9a8aef121340a5a57e07874 to your computer and use it in GitHub Desktop.
Save jamescalam/c5feaf0ca9a8aef121340a5a57e07874 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# truncate anything more than 512 characters in length\n",
"tokenizer.enable_truncation(max_length=512)\n",
"# and enable padding to 512 too\n",
"tokenizer.enable_padding(length=512, pad_token='[PAD]')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "ML",
"language": "python",
"name": "ml"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment