From 78f346c2b5164695ff4aecc27e2438545f14f9fa Mon Sep 17 00:00:00 2001 From: NielsRogge <48327001+NielsRogge@users.noreply.github.com> Date: Fri, 15 Apr 2022 14:10:16 +0200 Subject: [PATCH] Update README.md (#16797) --- .../pytorch/image-classification/README.md | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/examples/pytorch/image-classification/README.md b/examples/pytorch/image-classification/README.md index c3e6905a4c..a9dc6602de 100644 --- a/examples/pytorch/image-classification/README.md +++ b/examples/pytorch/image-classification/README.md @@ -16,14 +16,14 @@ limitations under the License. # Image classification example -This directory contains a script, `run_image_classification.py`, that showcases how to fine-tune any model supported by the [`AutoModelForImageClassification` API](https://huggingface.co/docs/transformers/main/en/model_doc/auto#transformers.AutoModelForImageClassification) (such as [ViT](https://huggingface.co/docs/transformers/main/en/model_doc/vit), [ConvNeXT]((https://huggingface.co/docs/transformers/main/en/model_doc/convnext)), [ResNet]((https://huggingface.co/docs/transformers/main/en/model_doc/resnet)), [Swin Transformer]((https://huggingface.co/docs/transformers/main/en/model_doc/swin))...) using PyTorch. It can be used to fine-tune models on both well-known datasets (like [CIFAR-10](https://huggingface.co/datasets/cifar10), [Fashion MNIST](https://huggingface.co/datasets/fashion_mnist), ...) as well as on your own custom data. +This directory contains a script, `run_image_classification.py`, that showcases how to fine-tune any model supported by the [`AutoModelForImageClassification` API](https://huggingface.co/docs/transformers/main/en/model_doc/auto#transformers.AutoModelForImageClassification) (such as [ViT](https://huggingface.co/docs/transformers/main/en/model_doc/vit), [ConvNeXT](https://huggingface.co/docs/transformers/main/en/model_doc/convnext), [ResNet](https://huggingface.co/docs/transformers/main/en/model_doc/resnet), [Swin Transformer](https://huggingface.co/docs/transformers/main/en/model_doc/swin)...) using PyTorch. It can be used to fine-tune models on both well-known datasets (like [CIFAR-10](https://huggingface.co/datasets/cifar10), [Fashion MNIST](https://huggingface.co/datasets/fashion_mnist), ...) as well as on your own custom data. This page includes 2 sections: -- [Using datasets from the hub](#using-datasets-from-🤗-hub) +- [Using datasets from the 🤗 hub](#using-datasets-from-hub) - [Using your own data](#using-your-own-data). -## Using datasets from 🤗 `Hub` +## Using datasets from Hub Here we show how to fine-tune a Vision Transformer (`ViT`) on the [beans](https://huggingface.co/datasets/beans) dataset, to classify the disease type of bean leaves. @@ -53,8 +53,6 @@ python run_image_classification.py \ To fine-tune another model, simply provide the `--model_name_or_path` argument. To train on another dataset, simply set the `--dataset_name` argument. -👀 See the results here: [nateraw/vit-base-cats-vs-dogs](https://huggingface.co/nateraw/vit-base-cats-vs-dogs). - ## Using your own data To use your own dataset, there are 2 ways: @@ -125,7 +123,7 @@ dataset.push_to_hub("name_of_your_dataset") dataset.push_to_hub("name_of_your_dataset", private=True) ``` -and that's it! You can now simply train your model simply by setting the `--dataset_name` argument to the name of your dataset on the hub (as explained in [Using datasets from the hub](#using-datasets-from-🤗-hub)). +and that's it! You can now simply train your model simply by setting the `--dataset_name` argument to the name of your dataset on the hub (as explained in [Using datasets from the 🤗 hub](#using-datasets-from-hub)). More on this can also be found in [this blog post](https://huggingface.co/blog/image-search-datasets). @@ -148,14 +146,6 @@ $ huggingface-cli login # ...follow the prompts ``` -or, in case you're running in a notebook: - -```python -from huggingface_hub import notebook_login - -notebook_login() -``` - 3. When running the script, pass the following arguments: ```bash @@ -163,4 +153,4 @@ python run_image_classification.py \ --push_to_hub \ --push_to_hub_model_id \ ... -``` \ No newline at end of file +```