Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/pytorch/audio-classification/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
datasets>=1.14.0
datasets[audio]>=1.14.0
evaluate
librosa
torchaudio
torch>=1.6
torch>=1.6
11 changes: 11 additions & 0 deletions examples/pytorch/audio-classification/run_audio_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "datasets[audio]>=1.14.0",
# "evaluate",
# "librosa",
# "torchaudio",
# "torch>=1.6",
# ]
# ///

import logging
import os
import sys
Expand Down
10 changes: 10 additions & 0 deletions examples/pytorch/contrastive-image-text/run_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "torch>=1.5.0",
# "torchvision>=0.6.0",
# "datasets>=1.8.0",
# ]
# ///

"""
Training a CLIP like dual encoder models using text and vision encoders in the library.

Expand Down
12 changes: 12 additions & 0 deletions examples/pytorch/image-classification/run_image_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate>=0.12.0",
# "torch>=1.5.0",
# "torchvision>=0.6.0",
# "datasets>=2.14.0",
# "evaluate",
# "scikit-learn",
# ]
# ///

import logging
import os
import sys
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate>=0.12.0",
# "torch>=1.5.0",
# "torchvision>=0.6.0",
# "datasets>=2.14.0",
# "evaluate",
# "scikit-learn",
# ]
# ///

"""Finetuning any 🤗 Transformers model for image classification leveraging 🤗 Accelerate."""

import argparse
Expand Down
9 changes: 9 additions & 0 deletions examples/pytorch/image-pretraining/run_mae.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "torch>=1.5.0",
# "torchvision>=0.6.0",
# "datasets>=1.8.0",
# ]
# ///

import logging
import os
import sys
Expand Down
9 changes: 9 additions & 0 deletions examples/pytorch/image-pretraining/run_mim.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "torch>=1.5.0",
# "torchvision>=0.6.0",
# "datasets>=1.8.0",
# ]
# ///

import logging
import os
import sys
Expand Down
9 changes: 9 additions & 0 deletions examples/pytorch/image-pretraining/run_mim_no_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "torch>=1.5.0",
# "torchvision>=0.6.0",
# "datasets>=1.8.0",
# ]
# ///

import argparse
import logging
import math
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "timm",
# "datasets",
# "torchmetrics",
# "pycocotools",
# ]
# ///

"""Finetuning 🤗 Transformers model for instance segmentation leveraging the Trainer API."""

import logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "timm",
# "datasets",
# "torchmetrics",
# "pycocotools",
# ]
# ///

"""Finetuning 🤗 Transformers model for instance segmentation with Accelerate 🚀."""

import argparse
Expand Down
15 changes: 15 additions & 0 deletions examples/pytorch/language-modeling/run_clm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///

"""
Fine-tuning the library models for causal language modeling (GPT, GPT-2, CTRL, ...) on a text file or a dataset.

Expand Down
15 changes: 15 additions & 0 deletions examples/pytorch/language-modeling/run_clm_no_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///

"""
Fine-tuning the library models for causal language modeling (GPT, GPT-2, CTRL, ...)
on a text file or a dataset without using HuggingFace Trainer.
Expand Down
15 changes: 15 additions & 0 deletions examples/pytorch/language-modeling/run_fim.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///

"""
Fine-tuning the library models for causal language modeling using
Fill-in-the middle (FIM) objective on a text file or a dataset.
Expand Down
15 changes: 15 additions & 0 deletions examples/pytorch/language-modeling/run_fim_no_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///

"""
Fine-tuning the library models for causal language modeling using
Fill-in-the middle (FIM) objective on a text file or a dataset without using HuggingFace Trainer.
Expand Down
15 changes: 15 additions & 0 deletions examples/pytorch/language-modeling/run_mlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///

"""
Fine-tuning the library models for masked language modeling (BERT, ALBERT, RoBERTa...) on a text file or a dataset.

Expand Down
15 changes: 15 additions & 0 deletions examples/pytorch/language-modeling/run_mlm_no_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///

"""
Fine-tuning the library models for masked language modeling (BERT, ALBERT, RoBERTa...)
on a text file or a dataset without using HuggingFace Trainer.
Expand Down
15 changes: 15 additions & 0 deletions examples/pytorch/language-modeling/run_plm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "accelerate >= 0.12.0",
# "torch >= 1.3",
# "datasets >= 2.14.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "evaluate",
# "scikit-learn",
# ]
# ///

"""
Fine-tuning the library models for permutation language modeling.
"""
Expand Down
12 changes: 12 additions & 0 deletions examples/pytorch/multiple-choice/run_swag.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "torch >= 1.3",
# "evaluate",
# ]
# ///

"""
Fine-tuning the library models for multiple choice.
"""
Expand Down
12 changes: 12 additions & 0 deletions examples/pytorch/multiple-choice/run_swag_no_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "accelerate >= 0.12.0",
# "sentencepiece != 0.1.92",
# "protobuf",
# "torch >= 1.3",
# "evaluate",
# ]
# ///

"""
Fine-tuning a 🤗 Transformers model on multiple choice relying on the accelerate library without using a Trainer.
"""
Expand Down
11 changes: 11 additions & 0 deletions examples/pytorch/object-detection/run_object_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "timm",
# "datasets>=4.0",
# "torchmetrics",
# "pycocotools",
# ]
# ///

"""Finetuning any 🤗 Transformers model supported by AutoModelForObjectDetection for object detection leveraging the Trainer API."""

import logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# /// script
# dependencies = [
# "transformers @ git+https://github.com/huggingface/transformers.git",
# "albumentations >= 1.4.16",
# "timm",
# "datasets>=4.0",
# "torchmetrics",
# "pycocotools",
# ]
# ///

"""Finetuning 🤗 Transformers model for object detection with Accelerate."""

import argparse
Expand Down
Loading