Skip to content

Update CvT documentation with improved usage examples and additional …#38731

Merged
stevhliu merged 6 commits intohuggingface:mainfrom
sezan92:cvt-model-card-update
Jun 17, 2025
Merged

Update CvT documentation with improved usage examples and additional …#38731
stevhliu merged 6 commits intohuggingface:mainfrom
sezan92:cvt-model-card-update

Conversation

@sezan92
Copy link
Copy Markdown
Contributor

@sezan92 sezan92 commented Jun 10, 2025

…notes

What does this PR do?

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@Rocketknight1
Copy link
Copy Markdown
Member

cc @stevhliu

Copy link
Copy Markdown
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for your update!

Comment thread docs/source/en/model_doc/cvt.md Outdated
Comment on lines +26 to +28
# TODO: add information about CvT in simple language like Vit
Convolutional Vision Transformer (CvT) is a model that combines the strengths of convolutional neural networks (CNNs) and transformers for computer vision tasks. It introduces convolutional layers into the transformer architecture, allowing it to capture local patterns in images while maintaining the global context provided by self-attention mechanisms.
You can find all the CvT checkpoints under the [Microsoft](https://huggingface.co/microsoft?search_models=cvt) organization.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# TODO: add information about CvT in simple language like Vit
Convolutional Vision Transformer (CvT) is a model that combines the strengths of convolutional neural networks (CNNs) and transformers for computer vision tasks. It introduces convolutional layers into the transformer architecture, allowing it to capture local patterns in images while maintaining the global context provided by self-attention mechanisms.
You can find all the CvT checkpoints under the [Microsoft](https://huggingface.co/microsoft?search_models=cvt) organization.
[Convolutional Vision Transformer (CvT)](https://huggingface.co/papers/2103.15808) is a model that combines the strengths of convolutional neural networks (CNNs) and transformers for computer vision tasks. It introduces convolutional layers into the transformer architecture, allowing it to capture local patterns in images while maintaining the global context provided by self-attention mechanisms.
You can find all the original CvT checkpoints under the [Microsoft](https://huggingface.co/microsoft?search_models=cvt) organization.

Comment thread docs/source/en/model_doc/cvt.md Outdated
Comment thread docs/source/en/model_doc/cvt.md Outdated
- The original ViT demo notebooks, such as those found [here](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/VisionTransformer), can often be adapted for CvT. You would typically replace ViT-specific classes like `ViTFeatureExtractor` with `AutoImageProcessor` and `ViTForImageClassification` with `CvtForImageClassification` or `AutoModelForImageClassification` using a CvT checkpoint.
- CvT checkpoints available on the Hugging Face Hub are often pre-trained on large-scale datasets like ImageNet-22k and may also be fine-tuned on datasets like ImageNet-1k.

## Resources
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the below and replace with:

Refer to this set of ViT [notebooks](https://github.com/NielsRogge/Transformers-Tutorials/tree/master/VisionTransformer) for examples of inference and fine-tuning on custom datasets. Replace [`ViTFeatureExtractor`] and [`ViTForImageClassification`] in these notebooks with [`AutoImageProcessor`] and [`CvtForImageClassification`].

sezan92 and others added 3 commits June 17, 2025 20:58
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@stevhliu stevhliu marked this pull request as ready for review June 17, 2025 17:25
Copy link
Copy Markdown
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! 🤗

@stevhliu stevhliu merged commit 3ae52cc into huggingface:main Jun 17, 2025
11 checks passed
@sezan92 sezan92 deleted the cvt-model-card-update branch June 18, 2025 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants