# Technical Documentation: huggingface/notebooks

> ℹ️ **Provenance:** In-Tree Documentation (19 Chapters) · [CodeWiki Reference](https://codewiki.google/github.com/huggingface/notebooks) · Recency: Active (< 180 days)

## File: README.md

# notebooks
Notebooks using the Hugging Face libraries 🤗

---

## File: diffusers/README.md

# Diffusers Notebooks
Notebooks for the HuggingFace Diffusers library


    
    
    


## 📓 Examples

| Notebook                                                                                                               | Colab                                                                                                                                                                                   | Description                                                                                                            |
|------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| [Getting started with Diffusers](https://github.com/huggingface/notebooks/blob/main/diffusers/diffusers_intro.ipynb)   | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/diffusers_intro.ipynb)  | First look at the library with a detailed model inference example.                                                     |
| [Training a DDPM model](https://github.com/huggingface/notebooks/blob/main/diffusers/training_example.ipynb)           | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/training_example.ipynb) | An example of training a [DDPM model](https://arxiv.org/abs/2006.11239) from scratch on a dataset of butterfly images. |
| [Stable Diffusion with Diffusers](https://github.com/huggingface/notebooks/blob/main/diffusers/stable_diffusion.ipynb) | [](https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers/stable_diffusion.ipynb) | How to use Stable Diffusion model for text-to-image generation using diffusers library.                                |

---

## File: examples/idefics/README.md

# IDEFICS Demos/examples

## Inference
- [Normal inference](inference.py) (needs ~20GB GPU memory)
- [4bit quantized inference](inference_4bit.py) (needs ~7GB GPU memory)

## Finetuning

The following demos use the Image captioning task:

- [PEFT (LORA) finetuning (notebook)](finetune_image_captioning_peft.ipynb) (fits on Google colab)
- [Normal finetuning](finetune_image_captioning.py) (needs ~40GB GPU memory)

---

## File: examples/idefics/idefics_zero3_finetuning/requirements.txt

torch
deepspeed
transformers>4.33.3
pillow
sentencepiece
protobuf
datasets
accelerate
mpi4py

---

## File: sagemaker/README.md

# Hugging Face Transformers Amazon SageMaker Examples

Example Jupyter notebooks that demonstrate how to build, train, and deploy [Hugging Face Transformers](https://github.com/huggingface/transformers) using [Amazon SageMaker](https://docs.aws.amazon.com/sagemaker/latest/dg/whatis.html) and the [Amazon SageMaker Python SDK](https://sagemaker.readthedocs.io/en/stable/).


## 🛠️ Setup


The quickest setup to run example notebooks includes:
- An [AWS account](http://docs.aws.amazon.com/sagemaker/latest/dg/gs-account.html)
- Proper [IAM User and Role](http://docs.aws.amazon.com/sagemaker/latest/dg/authentication-and-access-control.html) setup
- An [Amazon SageMaker Notebook Instance](http://docs.aws.amazon.com/sagemaker/latest/dg/gs-setup-working-env.html)
- An [S3 bucket](http://docs.aws.amazon.com/sagemaker/latest/dg/gs-config-permissions.html)

## 📓 Examples

| Notebook                                                                                                                                                                               | Type      | Description                                                                                                                                                                                                                |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [01 Getting started with PyTorch](https://github.com/huggingface/notebooks/blob/main/sagemaker/01_getting_started_pytorch/sagemaker-notebook.ipynb)                                    | Training  | Getting started end-to-end example on how to fine-tune a pre-trained Hugging Face Transformer for Text-Classification using PyTorch                                                                                        |
| [02 getting started with TensorFlow](https://github.com/huggingface/notebooks/blob/main/sagemaker/02_getting_started_tensorflow/sagemaker-notebook.ipynb)                              | Training  | Getting started end-to-end example on how to fine-tune a pre-trained Hugging Face Transformer for Text-Classification using TensorFlow                                                                                     |
| [03 Distributed Training: Data Parallelism](https://github.com/huggingface/notebooks/blob/main/sagemaker/03_distributed_training_data_parallelism/sagemaker-notebook.ipynb)            | Training  | End-to-end example on how to use distributed training with data-parallelism strategy for fine-tuning a pre-trained Hugging Face Transformer for Question-Answering using Amazon SageMaker Data Parallelism                 |
| [04 Distributed Training: Model Parallelism](https://github.com/huggingface/notebooks/blob/main/sagemaker/04_distributed_training_model_parallelism/sagemaker-notebook.ipynb)          | Training  | End-to-end example on how to use distributed training with model-parallelism strategy to pre-trained Hugging Face Transformer using Amazon SageMaker Model Parallelism                                                     |
| [05 How to use Spot Instances & Checkpointing](https://github.com/huggingface/notebooks/blob/main/sagemaker/05_spot_instances/sagemaker-notebook.ipynb)                                | Training  | End-to-end example on how to use Spot Instances and Checkpointing to reduce training cost                                                                                                                                  |
| [06 Experiment Tracking with SageMaker Metrics](https://github.com/huggingface/notebooks/blob/main/sagemaker/06_sagemaker_metrics/sagemaker-notebook.ipynb)                            | Training  | End-to-end example on how to use SageMaker metrics to track your experiments and training jobs                                                                                                                             |
| [07 Distributed Training: Data Parallelism](https://github.com/huggingface/notebooks/blob/main/sagemaker/07_tensorflow_distributed_training_data_parallelism/sagemaker-notebook.ipynb) | Training  | End-to-end example on how to use Amazon SageMaker Data Parallelism with TensorFlow                                                                                                                                         |
| [08 Distributed Training: Summarization with T5/BART](https://github.com/huggingface/notebooks/blob/main/sagemaker/08_distributed_summarization_bart_t5/sagemaker-notebook.ipynb)      | Training  | End-to-end example on how to fine-tune BART/T5 for Summarization using Amazon SageMaker Data Parallelism                                                                                                                   |
| [09 Vision: Fine-tune ViT](https://github.com/huggingface/notebooks/blob/main/sagemaker/09_image_classification_vision_transformer/sagemaker-notebook.ipynb)                           | Training  | End-to-end example on how to fine-tune Vision Transformer for Image-Classification                                                                                                                                         |
| [10 Deploy HF Transformer from Amazon S3](https://github.com/huggingface/notebooks/blob/main/sagemaker/10_deploy_model_from_s3/deploy_transformer_model_from_s3.ipynb)                 | Inference | End-to-end example on how to deploy a model from Amazon S3                                                                                                                                                                 |
| [11 Deploy HF Transformer from Hugging Face Hub](https://github.com/huggingface/notebooks/blob/main/sagemaker/11_deploy_model_from_hf_hub/deploy_transformer_model_from_hf_hub.ipynb)  | Inference | End-to-end example on how to deploy a model from the Hugging Face Hub                                                                                                                                                      |
| [12 Batch Processing with Amazon SageMaker Batch Transform](https://github.com/huggingface/notebooks/blob/main/sagemaker/12_batch_transform_inference/sagemaker-notebook.ipynb)        | Inference | End-to-end example on how to do batch processing with Amazon SageMaker Batch Transform                                                                                                                                     |
| [13 Autoscaling SageMaker Endpoints](https://github.com/huggingface/notebooks/blob/main/sagemaker/13_deploy_and_autoscaling_transformers/sagemaker-notebook.ipynb)                     | Inference | End-to-end example on how to use autoscaling for a HF Endpoint                                                                                                                                                             |
| [14 Fine-tune and push to Hub](https://github.com/huggingface/notebooks/blob/main/sagemaker/14_train_and_push_to_hub/sagemaker-notebook.ipynb)                                         | Training  | End-to-end example on how to use the Hugging Face Hub as MLOps backend for saving checkpoints during training                                                                                                              |
| [15 Training Compiler](https://github.com/huggingface/notebooks/blob/main/sagemaker/15_training_compiler/sagemaker-notebook.ipynb)                                                     | Training  | End-to-end example on how to use Amazon SageMaker Training Compiler to speed up training time                                                                                                                              |
| [16 Asynchronous Inference](https://github.com/huggingface/notebooks/blob/main/sagemaker/16_async_inference_hf_hub/sagemaker-notebook.ipynb)                                           | Inference | End-to-end example on how to use Amazon SageMaker Asynchronous Inference endpoints with Hugging Face Transformers                                                                                                          |
| [17 Custom inference.py script](https://github.com/huggingface/notebooks/blob/main/sagemaker/17_custom_inference_script/sagemaker-notebook.ipynb)                                      | Inference | End-to-end example on how to create a custom inference.py for Sentence Transformers and sentence embeddings                                                                                                                |
| [18 AWS Inferentia](https://github.com/huggingface/notebooks/blob/main/sagemaker/18_inferentia_inference/sagemaker-notebook.ipynb)                                                     | Inference | End-to-end example on how to AWS Inferentia to speed up inference time                                                                                                                                                     |
| [19 Serverless Inference](https://github.com/huggingface/notebooks/blob/main/sagemaker/19_serverless_inference/sagemaker-notebook.ipynb)                                               | Inference | Serverless Inference example to save cost                                                                                                                                                                                  |
| [20 Automatic Speech Recognition](https://github.com/huggingface/notebooks/blob/main/sagemaker/20_automatic_speech_recognition_inference/sagemaker-notebook.ipynb)                     | Inference | Example how to do speech recognition with wav2vec2                                                                                                                                                                         |
| [21 Image Segmentation](https://github.com/huggingface/notebooks/blob/main/sagemaker/21_image_segmantation/sagemaker-notebook.ipynb)                                                   | Inference | Example how to do image segmentation with segformer                                                                                                                                                                        |
| [22 Accelerate AWS SageMaker Integration examples](https://github.com/huggingface/notebooks/blob/main/sagemaker/22_accelerate_sagemaker_examples/README.md)                            | Training  | End-to-end examples on how to use AWS SageMaker integration of Accelerate                                                                                                                                                  |
| [23 Stable Diffusion](https://github.com/huggingface/notebooks/blob/main/sagemaker/23_stable_diffusion_inference/sagemaker-notebook.ipynb)                                             | Inference | Example how to generate images with stable diffusion                                                                                                                                                                       |
| [24 Train BLOOM with PEFT](https://github.com/huggingface/notebooks/blob/main/sagemaker/24_train_bloom_peft_lora/sagemaker-notebook.ipynb)                                             | Training  | Example how to train BLOOM on a single GPU using PEFT & LoRA                                                                                                                                                               |
| [25 PyTorch FSDP model parallelism](https://github.com/huggingface/notebooks/blob/main/sagemaker/25_pytorch_fsdp_model_parallelism/sagemaker-notebook.ipynb)                           | Training  | Example how to train LLMs on multi-node multi GPU with PyTorch FSDP                                                                                                                                                        |
| [26 Document AI Donut](https://github.com/huggingface/notebooks/blob/main/sagemaker/26_document_ai_donut/sagemaker-notebook.ipynb)                                                     | Training  | In this tutorial, you will learn how to fine-tune and deploy [Donut-base](https://huggingface.co/naver-clova-ix/donut-base) for document-understand/document-parsing using Hugging Face Transformers and Amazon SageMaker. |
| [27 Deploy Large Language Models](https://github.com/huggingface/notebooks/blob/main/sagemaker/27_deploy_large_language_models/sagemaker-notebook.ipynb)                               | Inference | Learn how to deploy LLMs with the Hugging Face LLM DLC                                                                                                                                                                     |
| [28 Train LLMs with QLora](https://github.com/huggingface/notebooks/blob/main/notebooks/sagemaker/28_train_llms_with_qlora/sagemaker-notebook.ipynb)                                   | Training  | Example on how to fine-tune LLMs using Q-Lora                                                                                                                                                                              |
| [29 Deploy LLMs with Inferentia2](https://github.com/huggingface/notebooks/blob/main/notebooks/sagemaker/29_deploy_llms_on_inferentia2/sagemaker-notebook.ipynb)                       | Inference | Learn how to deploy LLMs using AWS Inferentia2                                                                                                                                                                             |
| [30 Evaluate LLMs with ligtheval](https://github.com/huggingface/notebooks/blob/main/notebooks/sagemaker/30_evaluate_llms_with_lighteval/sagemaker-notebook.ipynb)                     | Inference | Learn how to evaluate LLMs using Hugging Face LightEval                                                                                                                                                                    |
| [31 Deploy Embedding Models with TEI](https://github.com/huggingface/notebooks/blob/main/notebooks/sagemaker/31_deploy_embedding_models/sagemaker-notebook.ipynb)                      | Inference | Learn how to deploy Embedding models for RAG applications with Hugging Face TEI                                                                                                                                            |
| [32 Train and deploy Embedding Models](https://github.com/huggingface/notebooks/blob/main/notebooks/sagemaker/32_train_deploy_embedding_models/sagemaker-notebook.ipynb)                      | Train & Inference | Learn how to train and deploy embedding models with Sentence Transformers and TEI                                                                                                                                            |

---

## File: sagemaker/14_train_and_push_to_hub/README.md

# SageMaker push to hf.co/models example

---

## File: sagemaker/22_accelerate_sagemaker_examples/README.md

# accelerate-aws-sagemaker
Examples showcasing AWS SageMaker integration of 🤗 Accelerate. Just give the `accelerate config` and do `accelerate launch` 🚀. It's as simple as that!

1. Set up the accelerate config by running `accelerate config --config_file accelerate_config.yaml` and answer the SageMaker questions.

2. Below is a sample config which is using aws `profile` to launch training job using 🤗 SageMaker estimator. It also has the `iam_role_name` which has the needed SageMaker permissions specified. In this config it is replaced `xxxxx` as user needs to specify it based on their corresponding AWS setup.

```yaml
base_job_name: accelerate-sagemaker-1
compute_environment: AMAZON_SAGEMAKER
distributed_type: DATA_PARALLEL
ec2_instance_type: ml.p3.16xlarge
iam_role_name: xxxxx
image_uri: null
mixed_precision: fp16
num_machines: 1
profile: xxxxx
py_version: py38
pytorch_version: 1.10.2
region: us-east-1
transformers_version: 4.17.0
use_cpu: false
```
3. One can specify a custom docker image instead of Official 🤗 DLCs through the accelerate config questionnaire. When this isn't provided, the latest Official 🤗 DLC will be used.

4. Support for input channels pointing to S3 data locations via TSV file, e.g., below are the contents of sagemaker_inputs.tsv whose location is given as part of accelerate config setup.
```tsv
channel_name	data_location
train	s3://sagemaker-sample/samples/datasets/imdb/train
test	s3://sagemaker-sample/samples/datasets/imdb/test
```

5. Support for SageMaker metrics logging via TSV file, e.g., below are the contents of the sagemaker_metrics_definition.tsv whose location is given as part of accelerate config setup.
```tsv
metric_name	metric_regex
accuracy	'accuracy': ([0-9.]+)
f1	'f1': ([0-9.]+)
```

6. Example of accelerate config with above features setup [XXXXX values are AWS account specific]:
```yaml
base_job_name: accelerate-sagemaker-1
compute_environment: AMAZON_SAGEMAKER
distributed_type: DATA_PARALLEL
ec2_instance_type: ml.p3.16xlarge
iam_role_name: XXXXX
image_uri: 763104351884.dkr.ecr.us-east-1.amazonaws.com/huggingface-pytorch-training:1.8.1-transformers4.10.2-gpu-py36-cu111-ubuntu18.04
mixed_precision: fp16
num_machines: 1
profile: XXXXX
py_version: py38
pytorch_version: 1.10.2
region: us-east-1
sagemaker_inputs_file: sagemaker_inputs.tsv
sagemaker_metrics_file: sagemaker_metrics_definition.tsv
transformers_version: 4.17.0
use_cpu: false
```
7. Put `requirements.txt` with all the needed libraries for running the training script.

8. Running `text-classification` example using s3 datasets (from the root directory):
```bash
cd src/text-classification
bash launch.sh
```
The contents of launch.sh
```bash
accelerate launch  --config_file accelerate_config.yaml train_using_s3_data.py \
    --mixed_precision "fp16"
```
Output logs:
```bash
...

[1,mpirank:0,algo-1]<stdout>:algo-1:79:1300 [0] NCCL INFO Launch mode Parallel
[1,mpirank:0,algo-1]<stderr>:INFO:root:Reducer buckets have been rebuilt in this iteration.
[1,mpirank:3,algo-1]<stderr>:INFO:root:Reducer buckets have been rebuilt in this iteration.
[1,mpirank:1,algo-1]<stderr>:INFO:root:Reducer buckets have been rebuilt in this iteration.
[1,mpirank:2,algo-1]<stderr>:INFO:root:Reducer buckets have been rebuilt in this iteration.
[1,mpirank:6,algo-1]<stderr>:INFO:root:Reducer buckets have been rebuilt in this iteration.
[1,mpirank:5,algo-1]<stderr>:INFO:root:Reducer buckets have been rebuilt in this iteration.
[1,mpirank:7,algo-1]<stderr>:INFO:root:Reducer buckets have been rebuilt in this iteration.
[1,mpirank:4,algo-1]<stderr>:INFO:root:Reducer buckets have been rebuilt in this iteration.
[1,mpirank:0,algo-1]<stdout>:epoch 0: {'accuracy': 0.6838235294117647, 'f1': 0.8122270742358079}
[1,mpirank:0,algo-1]<stdout>:epoch 1: {'accuracy': 0.7205882352941176, 'f1': 0.8256880733944955}
[1,mpirank:0,algo-1]<stdout>:epoch 2: {'accuracy': 0.75, 'f1': 0.838095238095238}
2022-09-21 13:21:05,187 sagemaker-training-toolkit INFO     Waiting for the process to finish and give a return code.
2022-09-21 13:21:05,188 sagemaker-training-toolkit INFO     Done waiting for a return code. Received 0 from exiting process.
2022-09-21 13:21:05,188 sagemaker-training-toolkit INFO     Reporting training SUCCESS
```


9. Running `seq2seq` example:
```bash
cd src/seq2seq
bash launch.sh
```
The contents of launch.sh
```bash
accelerate launch --config_file accelerate_config.yaml run_seq2seq_no_trainer.py \
    --dataset_name "smangrul/MuDoConv" \
    --max_source_length 128 \
    --source_prefix "chatbot: " \
    --max_target_length 64 \
    --val_max_target_length 64 \
    --val_min_target_length 20 \
    --n_val_batch_generations 5 \
    --n_train 10000 \
    --n_val 1000 \
    --pad_to_max_length True\
    --num_beams 10 \
    --model_name_or_path "facebook/blenderbot-400M-distill" \
    --per_device_train_batch_size 16 \
    --per_device_eval_batch_size 16 \
    --learning_rate 1e-6 \
    --weight_decay 0.0 \
    --num_train_epochs 1 \
    --gradient_accumulation_steps 1 \
    --num_warmup_steps 100 \
    --output_dir "/opt/ml/model" \
    --seed 25 \
    --logging_steps 100 \
    --report_name "blenderbot_400M_finetuning"
```
Output logs:
```
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:37:39 - INFO - __main__ - Distributed environment: MULTI_GPU  Backend: smddp
[1,mpirank:0,algo-1]<stderr>:Num processes: 8
[1,mpirank:0,algo-1]<stderr>:Process index: 0
[1,mpirank:0,algo-1]<stderr>:Local process index: 0
[1,mpirank:0,algo-1]<stderr>:Device: cuda:0
[1,mpirank:0,algo-1]<stderr>:

...

[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:38:31 - INFO - __main__ - ***** Running training *****
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:38:31 - INFO - __main__ -   Num examples = 10000
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:38:31 - INFO - __main__ -   Num Epochs = 1
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:38:31 - INFO - __main__ -   Instantaneous batch size per device = 16
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:38:31 - INFO - __main__ -   Total train batch size (w. parallel, distributed & accumulation) = 128
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:38:31 - INFO - __main__ -   Gradient Accumulation steps = 1
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:38:31 - INFO - __main__ -   Total optimization steps = 79

...

[1,mpirank:0,algo-1]<stderr>:#015100%|██████████| 79/79 [00:19<00:00,  4.79it/s]
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:38:50 - INFO - __main__ - Epoch 0 training took 19.50162172317505 seconds
[1,mpirank:0,algo-1]<stdout>:starting evaluation
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:38:55 - INFO - __main__ - printing few sample generations and corresponding labels from eval set
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:38:55 - INFO - __main__ - prompt | generated | label
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:38:55 - INFO - __main__ - chatbot:your persona: i work as an electrician. i always sleep 8 hours a day. </s>  <s> Which level are you at?</s> |  I'm at the top of the ladder. I work for an electrical company. |  I received on-the-job training when i first started
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:38:55 - INFO - __main__ - chatbot:your persona: i work as an electrician. i always sleep 8 hours a day. </s>  <s> Which level are you at? </s> <s> I received on-the-job training when i first started </s> <s> Thats great! How long have you been doing this work? </s> |  I've been working as an Electrician for about 5 years now. It's a great job. |  For a good number of years now.

... 

[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:39:02 - INFO - __main__ - chatbot:your persona: i'm a painter and love to create art. i'm a talented singer and have won several competitions. </s>  <s> I love the Doors! They have such a unique sound. Do you have a favorite Doors song?</s> |  My favorite song of theirs is "When I Was Your Man". What's yours? |  It's a tie between People are strange and Love me two times. What's your favorite?
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:39:02 - INFO - __main__ - chatbot:your persona: i'm a painter and love to create art. i'm a talented singer and have won several competitions. </s>  <s> I think my favorite is Love Street. It has such a haunting melody. Have you heard that one?</s> |  No, I haven't. I'll have to check it out. What genre is it? |  Yeah, it's a pretty great song, Jim Morrison was just an amazing songwriter, I aspire to make songs as good as his one day.

...

[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:39:17 - INFO - __main__ - {'bleu': 1.7067114414104911}
[1,mpirank:0,algo-1]<stdout>:evaluation completed
[1,mpirank:0,algo-1]<stderr>:09/21/2022 13:39:17 - INFO - __main__ - Epoch 0 evaluation took 24.294514417648315 seconds
[1,mpirank:0,algo-1]<stderr>:Configuration saved in /opt/ml/model/config.json
[1,mpirank:0,algo-1]<stderr>:Model weights saved in /opt/ml/model/pytorch_model.bin
[1,mpirank:0,algo-1]<stderr>:tokenizer config file saved in /opt/ml/model/tokenizer_config.json
[1,mpirank:0,algo-1]<stderr>:Special tokens file saved in /opt/ml/model/special_tokens_map.json
[1,mpirank:0,algo-1]<stderr>:#015100%|██████████| 79/79 [00:47<00:00,  1.65it/s]
2022-09-21 13:39:27,753 sagemaker-training-toolkit INFO     Waiting for the process to finish and give a return code.
2022-09-21 13:39:27,753 sagemaker-training-toolkit INFO     Done waiting for a return code. Received 0 from exiting process.
2022-09-21 13:39:27,754 sagemaker-training-toolkit INFO     Reporting training SUCCESS
```

---

## File: sagemaker/22_accelerate_sagemaker_examples/src/seq2seq/accelerate_config.yaml

base_job_name: accelerate-sagemaker-1
compute_environment: AMAZON_SAGEMAKER
distributed_type: DATA_PARALLEL
ec2_instance_type: ml.p3.16xlarge
iam_role_name: xxxxx
image_uri: null
mixed_precision: fp16
num_machines: 1
profile: xxxxx
py_version: py38
pytorch_version: 1.10.2
region: us-east-1
transformers_version: 4.17.0
use_cpu: false

---

## File: sagemaker/22_accelerate_sagemaker_examples/src/seq2seq/requirements.txt

accelerate # used to be installed in Amazon SageMaker environment
evaluate
datasets==2.3.2
nltk
deepspeed
sentencepiece != 0.1.92
protobuf
sacrebleu >= 1.4.12
nltk
py7zr
torch >= 1.3
transformers==4.22.1

---

## File: sagemaker/22_accelerate_sagemaker_examples/src/text-classification/accelerate_config.yaml

base_job_name: accelerate-sagemaker-1
compute_environment: AMAZON_SAGEMAKER
distributed_type: DATA_PARALLEL
ec2_instance_type: ml.p3.16xlarge
iam_role_name: xxxxx
image_uri: null
mixed_precision: fp16
num_machines: 1
profile: xxxxx
py_version: py38
pytorch_version: 1.10.2
region: us-east-1
sagemaker_inputs_file: sagemaker_inputs.tsv
sagemaker_metrics_file: sagemaker_metrics_definition.tsv
transformers_version: 4.17.0
use_cpu: false

---

## File: sagemaker/22_accelerate_sagemaker_examples/src/text-classification/requirements.txt

accelerate # used to be installed in Amazon SageMaker environment
evaluate
datasets==2.3.2
transformers

---

## File: sagemaker/23_stable_diffusion_inference/code/requirements.txt

diffusers==0.6.0
transformers==4.23.1

---

## File: sagemaker/24_train_bloom_peft_lora/scripts/requirements.txt

peft==0.3.0
transformers==4.27.1
accelerate==0.17.1
bitsandbytes==0.37.1

---

## File: sagemaker/25_pytorch_fsdp_model_parallelism/scripts/requirements.txt

transformers==4.28.1

---

## File: sagemaker/28_train_llms_with_qlora/scripts/requirements.txt

git+https://github.com/huggingface/transformers.git@2ab75add4b30c2fc44a8bf575156d448d9ed87a7
# transformers==4.31.0
peft==0.4.0
accelerate==0.21.0
bitsandbytes==0.40.2
safetensors>=0.3.1
tokenizers>=0.13.3

---

## File: sagemaker/32_train_deploy_embedding_models/scripts/requirements.txt

transformers==4.41.2 
accelerate==0.31.0
sentence-transformers==3.0.0
datasets==2.18.0
torch==2.1.2

---

## File: transformers_doc/README.md

# 🤗 Transformers doc notebooks

These notebooks are automatically generated from the [🤗 Transformers documentation](https://huggingface.co/transformers/)
so you should not make any direct modification here. If there is a typo to fix or a sentence to add, open a pull
request in the [🤗 Transformers repo](https://github.com/huggingface/transformers) and fix the corresponding file in
the `docs/source/` folder.

If there is something that seems weirdly converted from the original doc file, open an issue in this repo and we will
try to fix the conversion script.

**Note:** If you are looking for a particular notebook and can't find it, it may have moved inside the `en` subfolder.

---

## File: transformers_doc/en/tensorflow/README.md

> [!WARNING]
> TensorFlow is [deprecated](https://github.com/huggingface/transformers/pull/38758) for Transformers and no longer actively maintained. It will be removed in v5. We recommend pinning or installing a version of Transformers that supports TensorFlow to continue using these notebooks.

---

## File: .github/pull_request_template.md

# What does this PR do?






Fixes # (issue)

## Who can review?

Feel free to tag members/contributors who may be interested in your PR.

--- METRICS ---
- Files Extracted: 19
- Estimated Token Budget: ~7137 tokens
- Recency Window: Active (< 180 days)
- Canonical Reference: https://codewiki.google/github.com/huggingface/notebooks
