Make pytorch examples UV-compatible (#39635)
* update release.py * add uv headers in some pytorch examples * rest of pytorch examples * style
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
datasets>=1.14.0
|
||||
datasets[audio]>=1.14.0
|
||||
evaluate
|
||||
librosa
|
||||
torchaudio
|
||||
torch>=1.6
|
||||
torch>=1.6
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
# "datasets >= 2.0.0",
|
||||
# "torch >= 1.3",
|
||||
# "accelerate",
|
||||
# "evaluate""
|
||||
# "Pillow",
|
||||
# "albumentations >= 1.4.16",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
|
||||
@@ -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",
|
||||
# "datasets >= 2.0.0",
|
||||
# "torch >= 1.3",
|
||||
# "accelerate",
|
||||
# "evaluate""
|
||||
# "Pillow",
|
||||
# "albumentations >= 1.4.16",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""Finetuning any 🤗 Transformers model supported by AutoModelForSemanticSegmentation for semantic segmentation."""
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
datasets >= 1.12.0
|
||||
datasets[audio] >= 1.12.0
|
||||
torch >= 1.5
|
||||
torchaudio
|
||||
accelerate >= 0.12.0
|
||||
|
||||
@@ -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",
|
||||
# "datasets[audio] >= 1.12.0",
|
||||
# "torch >= 1.5",
|
||||
# "torchaudio",
|
||||
# "accelerate >= 0.12.0",
|
||||
# "librosa",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""Pre-Training a 🤗 Wav2Vec2 model on unlabeled audio data"""
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
datasets >= 1.18.0
|
||||
datasets[audio] >= 1.18.0
|
||||
torch >= 1.5
|
||||
torchaudio
|
||||
librosa
|
||||
|
||||
@@ -13,6 +13,18 @@
|
||||
# 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.18.0",
|
||||
# "torch >= 1.5",
|
||||
# "torchaudio",
|
||||
# "librosa",
|
||||
# "jiwer",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""Fine-tuning a 🤗 Transformers CTC model for automatic speech recognition"""
|
||||
|
||||
import functools
|
||||
|
||||
@@ -13,6 +13,18 @@
|
||||
# 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.18.0",
|
||||
# "torch >= 1.5",
|
||||
# "torchaudio",
|
||||
# "librosa",
|
||||
# "jiwer",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""Fine-tuning a 🤗 Transformers CTC adapter model for automatic speech recognition"""
|
||||
|
||||
import functools
|
||||
|
||||
@@ -12,6 +12,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",
|
||||
# "datasets[audio] >= 1.18.0",
|
||||
# "torch >= 1.5",
|
||||
# "torchaudio",
|
||||
# "librosa",
|
||||
# "jiwer",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""
|
||||
Fine-tuning the library models for sequence to sequence speech recognition.
|
||||
"""
|
||||
|
||||
@@ -12,6 +12,22 @@
|
||||
# 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",
|
||||
# "datasets >= 1.8.0",
|
||||
# "sentencepiece != 0.1.92",
|
||||
# "protobuf",
|
||||
# "rouge-score",
|
||||
# "nltk",
|
||||
# "py7zr",
|
||||
# "torch >= 1.3",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""
|
||||
Fine-tuning the library models for sequence to sequence.
|
||||
"""
|
||||
|
||||
@@ -12,6 +12,22 @@
|
||||
# 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",
|
||||
# "datasets >= 1.8.0",
|
||||
# "sentencepiece != 0.1.92",
|
||||
# "protobuf",
|
||||
# "rouge-score",
|
||||
# "nltk",
|
||||
# "py7zr",
|
||||
# "torch >= 1.3",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""
|
||||
Fine-tuning a 🤗 Transformers model on summarization.
|
||||
"""
|
||||
|
||||
@@ -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",
|
||||
# "accelerate >= 0.12.0",
|
||||
# "datasets >= 1.8.0",
|
||||
# "sentencepiece != 0.1.92",
|
||||
# "scipy",
|
||||
# "scikit-learn",
|
||||
# "protobuf",
|
||||
# "torch >= 1.3",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""Finetuning the library models for text classification."""
|
||||
# You can also adapt this script on your own text classification task. Pointers for this are left as comments.
|
||||
|
||||
|
||||
@@ -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",
|
||||
# "accelerate >= 0.12.0",
|
||||
# "datasets >= 1.8.0",
|
||||
# "sentencepiece != 0.1.92",
|
||||
# "scipy",
|
||||
# "scikit-learn",
|
||||
# "protobuf",
|
||||
# "torch >= 1.3",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""Finetuning the library models for sequence classification on GLUE."""
|
||||
# You can also adapt this script on your own text classification task. Pointers for this are left as comments.
|
||||
|
||||
|
||||
@@ -11,6 +11,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",
|
||||
# "accelerate >= 0.12.0",
|
||||
# "datasets >= 1.8.0",
|
||||
# "sentencepiece != 0.1.92",
|
||||
# "scipy",
|
||||
# "scikit-learn",
|
||||
# "protobuf",
|
||||
# "torch >= 1.3",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""Finetuning a 🤗 Transformers model for sequence classification on GLUE."""
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -13,6 +13,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",
|
||||
# "accelerate >= 0.12.0",
|
||||
# "datasets >= 1.8.0",
|
||||
# "sentencepiece != 0.1.92",
|
||||
# "scipy",
|
||||
# "scikit-learn",
|
||||
# "protobuf",
|
||||
# "torch >= 1.3",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""Finetuning multi-lingual models on XNLI (e.g. Bert, DistilBERT, XLM).
|
||||
Adapted from `examples/text-classification/run_glue.py`"""
|
||||
|
||||
|
||||
@@ -13,6 +13,17 @@
|
||||
# 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.21.0",
|
||||
# "sentencepiece != 0.1.92",
|
||||
# "protobuf",
|
||||
# "torch >= 1.3",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""Conditional text generation with the auto-regressive models of the library (GPT/GPT-2/CTRL/Transformer-XL/XLNet)"""
|
||||
|
||||
import argparse
|
||||
|
||||
@@ -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
|
||||
# limitations under the License.
|
||||
|
||||
# /// script
|
||||
# dependencies = [
|
||||
# "transformers @ git+https://github.com/huggingface/transformers.git",
|
||||
# "accelerate >= 0.21.0",
|
||||
# "sentencepiece != 0.1.92",
|
||||
# "protobuf",
|
||||
# "torch >= 1.3",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""The examples of running contrastive search on the auto-APIs;
|
||||
|
||||
Running this example:
|
||||
|
||||
@@ -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",
|
||||
# "seqeval",
|
||||
# "datasets >= 1.8.0",
|
||||
# "torch >= 1.3",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""
|
||||
Fine-tuning the library models for token classification.
|
||||
"""
|
||||
|
||||
@@ -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",
|
||||
# "seqeval",
|
||||
# "datasets >= 1.8.0",
|
||||
# "torch >= 1.3",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""
|
||||
Fine-tuning a 🤗 Transformers model on token classification tasks (NER, POS, CHUNKS) relying on the accelerate library
|
||||
without using a Trainer.
|
||||
|
||||
@@ -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",
|
||||
# "accelerate >= 0.12.0",
|
||||
# "datasets >= 1.8.0",
|
||||
# "sentencepiece != 0.1.92",
|
||||
# "protobuf",
|
||||
# "sacrebleu >= 1.4.12",
|
||||
# "py7zr",
|
||||
# "torch >= 1.3",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""
|
||||
Fine-tuning the library models for sequence to sequence.
|
||||
"""
|
||||
|
||||
@@ -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",
|
||||
# "accelerate >= 0.12.0",
|
||||
# "datasets >= 1.8.0",
|
||||
# "sentencepiece != 0.1.92",
|
||||
# "protobuf",
|
||||
# "sacrebleu >= 1.4.12",
|
||||
# "py7zr",
|
||||
# "torch >= 1.3",
|
||||
# "evaluate",
|
||||
# ]
|
||||
# ///
|
||||
|
||||
"""
|
||||
Fine-tuning a 🤗 Transformers model on text translation.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user