"This notebook is based on [an official 🤗 notebook - \"How to fine-tune a model on text classification\"](https://github.com/huggingface/notebooks/blob/6ca682955173cc9d36ffa431ddda505a048cbe80/examples/text_classification.ipynb). The main aim of this notebook is to show the process of conversion from vanilla 🤗 to [Ray AIR](https://docs.ray.io/en/latest/ray-air/getting-started.html) 🤗 without changing the training logic unless necessary.\n",
"\n",
"In this notebook, we will:\n",
"1. [Set up Ray](#setup)\n",
"2. [Load the dataset](#load)\n",
"3. [Preprocess the dataset](#preprocess)\n",
"4. [Run the training with Ray AIR](#train)\n",
"5. [Predict on test data with Ray AIR](#predict)\n",
"6. [Optionally, share the model with the community](#share)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "sQbdfyWQhYbO"
},
"source": [
"Uncomment and run the following line in order to install all the necessary dependencies:"
"We will use `ray.init()` to initialize a local cluster. By default, this cluster will be compromised of only the machine you are running this notebook on. You can also run this notebook on an Anyscale cluster.\n",
"\n",
"This notebook *will not* run in [Ray Client](https://docs.ray.io/en/latest/cluster/ray-client.html) mode."
"We can check the resources our cluster is composed of. If you are running this notebook on your local machine or Google Colab, you should see the number of CPU cores and GPUs available on the said machine."
"In this notebook, we will see how to fine-tune one of the [🤗 Transformers](https://github.com/huggingface/transformers) model to a text classification task of the [GLUE Benchmark](https://gluebenchmark.com/). We will be running the training using [Ray AIR](https://docs.ray.io/en/latest/ray-air/getting-started.html).\n",
"\n",
"You can change those two variables to control whether the training (which we will get to later) uses CPUs or GPUs, and how many workers should be spawned. Each worker will claim one CPU or GPU. Make sure not to request more resources than the resources present!\n",
"\n",
"By default, we will run the training with one GPU worker."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"id": "gAbhv9OqhYbT"
},
"outputs": [],
"source": [
"use_gpu = True # set this to False to run on CPUs\n",
"num_workers = 1 # set this to number of GPUs/CPUs you want to use"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "rEJBSTyZIrIb"
},
"source": [
"## Fine-tuning a model on a text classification task"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "kTCFado4IrIc"
},
"source": [
"The GLUE Benchmark is a group of nine classification tasks on sentences or pairs of sentences. If you would like to learn more, refer to the [original notebook](https://github.com/huggingface/notebooks/blob/6ca682955173cc9d36ffa431ddda505a048cbe80/examples/text_classification.ipynb).\n",
"\n",
"Each task is named by its acronym, with `mnli-mm` standing for the mismatched version of MNLI (so same training set as `mnli` but different validation and test sets):"
"This notebook is built to run on any of the tasks in the list above, with any model checkpoint from the [Model Hub](https://huggingface.co/models) as long as that model has a version with a classification head. Depending on you model and the GPU you are using, you might need to adjust the batch size to avoid out-of-memory errors. Set those three parameters, then the rest of the notebook should run smoothly:"
"We will use the [🤗 Datasets](https://github.com/huggingface/datasets) library to download the data and get the metric we need to use for evaluation (to compare our model to the benchmark). This can be easily done with the functions `load_dataset` and `load_metric`.\n",
"\n",
"Apart from `mnli-mm` being a special code, we can directly pass our task name to those functions.\n",
"\n",
"As Ray AIR doesn't provide integrations for 🤗 Datasets yet, we will simply run the normal 🤗 Datasets code to load the dataset from the Hub."
"Generating test split: 0%| | 0/1063 [00:00<?, ? examples/s]"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dataset glue downloaded and prepared to /root/.cache/huggingface/datasets/glue/cola/1.0.0/dacbe3125aa31d7f70367a07a8a9e72a5a0bfeb5fc42e75c9db75b96da6053ad. Subsequent calls will reuse this data.\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b1fa3ae216f64c0ab17b50ddc8e536b1",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" 0%| | 0/3 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from datasets import load_dataset\n",
"\n",
"actual_task = \"mnli\" if task == \"mnli-mm\" else task\n",
"datasets = load_dataset(\"glue\", actual_task)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "RzfPtOMoIrIu"
},
"source": [
"The `dataset` object itself is [`DatasetDict`](https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasetdict), which contains one key for the training, validation and test set (with more keys for the mismatched validation and test set in the special case of `mnli`)."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "_TOee7nohYbW"
},
"source": [
"We will also need the metric. In order to avoid serialization errors, we will load the metric inside the training workers later. Therefore, now we will just define the function we will use."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"id": "FNE583uBhYbW"
},
"outputs": [],
"source": [
"from datasets import load_metric\n",
"\n",
"def load_metric_fn():\n",
" return load_metric('glue', actual_task)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "lnjDIuQ3IrI-"
},
"source": [
"The metric is an instance of [`datasets.Metric`](https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasets.Metric)."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "n9qywopnIrJH"
},
"source": [
"### Preprocessing the data <a name=\"preprocess\"></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "YVx71GdAIrJH"
},
"source": [
"Before we can feed those texts to our model, we need to preprocess them. This is done by a 🤗 Transformers `Tokenizer` which will (as the name indicates) tokenize the inputs (including converting the tokens to their corresponding IDs in the pretrained vocabulary) and put it in a format the model expects, as well as generate the other inputs that model requires.\n",
"\n",
"To do all of this, we instantiate our tokenizer with the `AutoTokenizer.from_pretrained` method, which will ensure:\n",
"\n",
"- we get a tokenizer that corresponds to the model architecture we want to use,\n",
"- we download the vocabulary used when pretraining this specific checkpoint."
"We pass along `use_fast=True` to the call above to use one of the fast tokenizers (backed by Rust) from the 🤗 Tokenizers library. Those fast tokenizers are available for almost all models, but if you got an error with the previous call, remove that argument."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "qo_0B1M2IrJM"
},
"source": [
"To preprocess our dataset, we will thus need the names of the columns containing the sentence(s). The following dictionary keeps track of the correspondence task to column names:"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"id": "fyGdtK9oIrJM"
},
"outputs": [],
"source": [
"task_to_keys = {\n",
" \"cola\": (\"sentence\", None),\n",
" \"mnli\": (\"premise\", \"hypothesis\"),\n",
" \"mnli-mm\": (\"premise\", \"hypothesis\"),\n",
" \"mrpc\": (\"sentence1\", \"sentence2\"),\n",
" \"qnli\": (\"question\", \"sentence\"),\n",
" \"qqp\": (\"question1\", \"question2\"),\n",
" \"rte\": (\"sentence1\", \"sentence2\"),\n",
" \"sst2\": (\"sentence\", None),\n",
" \"stsb\": (\"sentence1\", \"sentence2\"),\n",
" \"wnli\": (\"sentence1\", \"sentence2\"),\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "2C0hcmp9IrJQ"
},
"source": [
"We can them write the function that will preprocess our samples. We just feed them to the `tokenizer` with the argument `truncation=True`. This will ensure that an input longer that what the model selected can handle will be truncated to the maximum length accepted by the model."
"To apply this function on all the sentences (or pairs of sentences) in our dataset, we just use the `map` method of our `dataset` object we created earlier. This will apply the function on all the elements of all the splits in `dataset`, so our training, validation and testing data will be preprocessed in one single command."
"For Ray AIR, instead of using 🤗 Dataset objects directly, we will convert them to [Ray Datasets](https://docs.ray.io/en/latest/data/dataset.html). Both are backed by Arrow tables, so the conversion is straightforward. We will use the built-in `ray.data.from_huggingface` function."
"### Fine-tuning the model with Ray AIR <a name=\"train\"></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "FBiW8UpKIrJW"
},
"source": [
"Now that our data is ready, we can download the pretrained model and fine-tune it.\n",
"\n",
"Since all our tasks are about sentence classification, we use the `AutoModelForSequenceClassification` class.\n",
"\n",
"We will not go into details about each specific component of the training (see the [original notebook](https://github.com/huggingface/notebooks/blob/6ca682955173cc9d36ffa431ddda505a048cbe80/examples/text_classification.ipynb) for that). The tokenizer is the same as we have used to encoded the dataset before.\n",
"\n",
"The main difference when using the Ray AIR is that we need to create our 🤗 Transformers `Trainer` inside a function (`trainer_init_per_worker`) and return it. That function will be passed to the `HuggingFaceTrainer` and ran on every Ray worker. The training will then proceed by the means of PyTorch DDP.\n",
"\n",
"Make sure that you initialize the model, metric and tokenizer inside that function. Otherwise, you may run into serialization errors.\n",
"\n",
"Furthermore, `push_to_hub=True` is not yet supported. Ray will however checkpoint the model at every epoch, allowing you to push it to hub manually. We will do that after the training.\n",
"\n",
"If you wish to use thrid party logging libraries, such as MLFlow or Weights&Biases, do not set them in `TrainingArguments` (they will be automatically disabled) - instead, you should be passing Ray AIR callbacks to `HuggingFaceTrainer`'s `run_config`. In this example, we will use MLFlow."
"With our `trainer_init_per_worker` complete, we can now instantiate the `HuggingFaceTrainer`. Aside from the function, we set the `scaling_config`, controlling the amount of workers and resources used, and the `datasets` we will use for training and evaluation.\n",
"\n",
"We specify the `MlflowLoggerCallback` inside the `run_config`."
"Finally, we call the `fit` method to being training with Ray AIR. We will save the `Result` object to a variable so we can access metrics and checkpoints."
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m 2022-05-12 18:31:33,158\tINFO torch.py:347 -- Setting up process group for: env:// [rank=0, world_size=1]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Is CUDA available: True\n"
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Some weights of the model checkpoint at distilbert-base-uncased were not used when initializing DistilBertForSequenceClassification: ['vocab_transform.weight', 'vocab_projector.bias', 'vocab_projector.weight', 'vocab_transform.bias', 'vocab_layer_norm.weight', 'vocab_layer_norm.bias']\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m - This IS expected if you are initializing DistilBertForSequenceClassification from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPreTraining model).\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m - This IS NOT expected if you are initializing DistilBertForSequenceClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Some weights of DistilBertForSequenceClassification were not initialized from the model checkpoint at distilbert-base-uncased and are newly initialized: ['classifier.bias', 'pre_classifier.bias', 'pre_classifier.weight', 'classifier.weight']\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m You should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m /usr/local/lib/python3.7/dist-packages/transformers/optimization.py:309: FutureWarning: This implementation of AdamW is deprecated and will be removed in a future version. Use the PyTorch implementation torch.optim.AdamW instead, or set `no_deprecation_warning=True` to disable this warning\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Total optimization steps = 2675\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m The following columns in the training set don't have a corresponding argument in `DistilBertForSequenceClassification.forward` and have been ignored: idx, sentence. If idx, sentence are not expected by `DistilBertForSequenceClassification.forward`, you can safely ignore this message.\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m [W reducer.cpp:1289] Warning: find_unused_parameters=True was specified in DDP constructor, but did not find any unused parameters in the forward pass. This flag results in an extra traversal of the autograd graph every iteration, which can adversely affect performance. If your model indeed never has any unused parameters in the forward pass, consider turning this flag off. Note that this warning may be a false positive if your model has flow control causing later iterations to have unused parameters. (function operator())\n"
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m The following columns in the evaluation set don't have a corresponding argument in `DistilBertForSequenceClassification.forward` and have been ignored: idx, sentence. If idx, sentence are not expected by `DistilBertForSequenceClassification.forward`, you can safely ignore this message.\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Saving model checkpoint to distilbert-base-uncased-finetuned-cola/checkpoint-535\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Configuration saved in distilbert-base-uncased-finetuned-cola/checkpoint-535/config.json\n"
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Model weights saved in distilbert-base-uncased-finetuned-cola/checkpoint-535/pytorch_model.bin\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m tokenizer config file saved in distilbert-base-uncased-finetuned-cola/checkpoint-535/tokenizer_config.json\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Special tokens file saved in distilbert-base-uncased-finetuned-cola/checkpoint-535/special_tokens_map.json\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Trial HuggingFaceTrainer_bb9dd_00000 reported loss=0.5441,learning_rate=1.6261682242990654e-05,epoch=1.0,step=535,eval_loss=0.4999416470527649,eval_matthews_correlation=0.3991733676966143,eval_runtime=1.0378,eval_samples_per_second=1004.976,eval_steps_per_second=63.594,_timestamp=1652380362,_time_this_iter_s=66.77899646759033,_training_iteration=1,should_checkpoint=True with parameters={}.\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m The following columns in the evaluation set don't have a corresponding argument in `DistilBertForSequenceClassification.forward` and have been ignored: idx, sentence. If idx, sentence are not expected by `DistilBertForSequenceClassification.forward`, you can safely ignore this message.\n"
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Saving model checkpoint to distilbert-base-uncased-finetuned-cola/checkpoint-1070\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Configuration saved in distilbert-base-uncased-finetuned-cola/checkpoint-1070/config.json\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Model weights saved in distilbert-base-uncased-finetuned-cola/checkpoint-1070/pytorch_model.bin\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m tokenizer config file saved in distilbert-base-uncased-finetuned-cola/checkpoint-1070/tokenizer_config.json\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Special tokens file saved in distilbert-base-uncased-finetuned-cola/checkpoint-1070/special_tokens_map.json\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Trial HuggingFaceTrainer_bb9dd_00000 reported loss=0.3886,learning_rate=1.2523364485981309e-05,epoch=2.0,step=1070,eval_loss=0.5397436618804932,eval_matthews_correlation=0.5085739436587455,eval_runtime=1.0792,eval_samples_per_second=966.488,eval_steps_per_second=61.158,_timestamp=1652380400,_time_this_iter_s=37.84357762336731,_training_iteration=2,should_checkpoint=True with parameters={}.\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m The following columns in the evaluation set don't have a corresponding argument in `DistilBertForSequenceClassification.forward` and have been ignored: idx, sentence. If idx, sentence are not expected by `DistilBertForSequenceClassification.forward`, you can safely ignore this message.\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Saving model checkpoint to distilbert-base-uncased-finetuned-cola/checkpoint-1605\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Configuration saved in distilbert-base-uncased-finetuned-cola/checkpoint-1605/config.json\n"
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Model weights saved in distilbert-base-uncased-finetuned-cola/checkpoint-1605/pytorch_model.bin\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m tokenizer config file saved in distilbert-base-uncased-finetuned-cola/checkpoint-1605/tokenizer_config.json\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Special tokens file saved in distilbert-base-uncased-finetuned-cola/checkpoint-1605/special_tokens_map.json\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Trial HuggingFaceTrainer_bb9dd_00000 reported loss=0.2746,learning_rate=8.785046728971963e-06,epoch=3.0,step=1605,eval_loss=0.6648283004760742,eval_matthews_correlation=0.5141951979542654,eval_runtime=1.1148,eval_samples_per_second=935.563,eval_steps_per_second=59.202,_timestamp=1652380437,_time_this_iter_s=36.976723432540894,_training_iteration=3,should_checkpoint=True with parameters={}.\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m The following columns in the evaluation set don't have a corresponding argument in `DistilBertForSequenceClassification.forward` and have been ignored: idx, sentence. If idx, sentence are not expected by `DistilBertForSequenceClassification.forward`, you can safely ignore this message.\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Saving model checkpoint to distilbert-base-uncased-finetuned-cola/checkpoint-2140\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Configuration saved in distilbert-base-uncased-finetuned-cola/checkpoint-2140/config.json\n"
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Model weights saved in distilbert-base-uncased-finetuned-cola/checkpoint-2140/pytorch_model.bin\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m tokenizer config file saved in distilbert-base-uncased-finetuned-cola/checkpoint-2140/tokenizer_config.json\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Special tokens file saved in distilbert-base-uncased-finetuned-cola/checkpoint-2140/special_tokens_map.json\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Trial HuggingFaceTrainer_bb9dd_00000 reported loss=0.196,learning_rate=5.046728971962617e-06,epoch=4.0,step=2140,eval_loss=0.7566447854042053,eval_matthews_correlation=0.5518326707011334,eval_runtime=1.1113,eval_samples_per_second=938.535,eval_steps_per_second=59.39,_timestamp=1652380474,_time_this_iter_s=36.68935775756836,_training_iteration=4,should_checkpoint=True with parameters={}.\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Saving model checkpoint to distilbert-base-uncased-finetuned-cola/checkpoint-2675\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Configuration saved in distilbert-base-uncased-finetuned-cola/checkpoint-2675/config.json\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Model weights saved in distilbert-base-uncased-finetuned-cola/checkpoint-2675/pytorch_model.bin\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m tokenizer config file saved in distilbert-base-uncased-finetuned-cola/checkpoint-2675/tokenizer_config.json\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Special tokens file saved in distilbert-base-uncased-finetuned-cola/checkpoint-2675/special_tokens_map.json\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m The following columns in the evaluation set don't have a corresponding argument in `DistilBertForSequenceClassification.forward` and have been ignored: idx, sentence. If idx, sentence are not expected by `DistilBertForSequenceClassification.forward`, you can safely ignore this message.\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Saving model checkpoint to distilbert-base-uncased-finetuned-cola/checkpoint-2675\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Configuration saved in distilbert-base-uncased-finetuned-cola/checkpoint-2675/config.json\n"
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Model weights saved in distilbert-base-uncased-finetuned-cola/checkpoint-2675/pytorch_model.bin\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m tokenizer config file saved in distilbert-base-uncased-finetuned-cola/checkpoint-2675/tokenizer_config.json\n",
"\u001b[2m\u001b[36m(BaseWorkerMixin pid=455)\u001b[0m Special tokens file saved in distilbert-base-uncased-finetuned-cola/checkpoint-2675/special_tokens_map.json\n",
"### Predict on test data with Ray AIR <a name=\"predict\"></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Tfoyu1q7hYbb"
},
"source": [
"You can now use the checkpoint to run prediction with `HuggingFacePredictor`, which wraps around [🤗 Pipelines](https://huggingface.co/docs/transformers/main_classes/pipelines). In order to distribute prediction, we use `BatchPredictor`. While this is not necessary for the very small example we are using (you could use `HuggingFacePredictor` directly), it will scale well to a large dataset."
"To be able to share your model with the community, there are a few more steps to follow.\n",
"\n",
"We have conducted the training on the Ray cluster, but share the model from the local enviroment - this will allow us to easily authenticate.\n",
"\n",
"First you have to store your authentication token from the Hugging Face website (sign up [here](https://huggingface.co/join) if you haven't already!) then execute the following cell and input your username and password:"
"You can now share this model with all your friends, family, favorite pets: they can all load it with the identifier `\"your-username/the-name-you-picked\"` so for instance:\n",