diff --git a/docs/source/models/convnext.rst b/docs/source/models/convnext.rst new file mode 100644 index 00000000000..e400bebb466 --- /dev/null +++ b/docs/source/models/convnext.rst @@ -0,0 +1,26 @@ +ConvNeXt +====== + +.. currentmodule:: torchvision.models + +The ConvNeXt model is based on the `A ConvNet for the 2020s +`_ paper. + + +Model builders +-------------- + +The following model builders can be used to instantiate a ConvNeXt model, with or +without pre-trained weights. All the model builders internally rely on the +``torchvision.models.convnext.ConvNeXt`` base class. Please refer to the `source code +`_ for +more details about this class. + +.. autosummary:: + :toctree: generated/ + :template: function.rst + + convnext_tiny + convnext_small + convnext_base + convnext_large diff --git a/docs/source/models_new.rst b/docs/source/models_new.rst index a46d05a6914..027ab67bfc0 100644 --- a/docs/source/models_new.rst +++ b/docs/source/models_new.rst @@ -36,6 +36,7 @@ weights: .. toctree:: :maxdepth: 1 + models/convnext models/efficientnet models/efficientnetv2 models/regnet diff --git a/torchvision/models/convnext.py b/torchvision/models/convnext.py index b341a6d6691..64f832a2a58 100644 --- a/torchvision/models/convnext.py +++ b/torchvision/models/convnext.py @@ -276,11 +276,21 @@ class ConvNeXt_Large_Weights(WeightsEnum): @handle_legacy_interface(weights=("pretrained", ConvNeXt_Tiny_Weights.IMAGENET1K_V1)) def convnext_tiny(*, weights: Optional[ConvNeXt_Tiny_Weights] = None, progress: bool = True, **kwargs: Any) -> ConvNeXt: - r"""ConvNeXt Tiny model architecture from the - `"A ConvNet for the 2020s" `_ paper. + """ConvNeXt Tiny model architecture from the + `A ConvNet for the 2020s `_ paper. + Args: - weights (ConvNeXt_Tiny_Weights, optional): The pretrained weights for the model - progress (bool): If True, displays a progress bar of the download to stderr + weights (:class:`~torchvision.models.convnext.ConvNeXt_Tiny_Weights`, optional): The pretrained + weights to use. See :class:`~torchvision.models.convnext.ConvNeXt_Tiny_Weights` + below for more details and possible values. By default, no pre-trained weights are used. + progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True. + **kwargs: parameters passed to the ``torchvision.models.convnext.ConvNext`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.convnext.ConvNeXt_Tiny_Weights + :members: """ weights = ConvNeXt_Tiny_Weights.verify(weights) @@ -298,11 +308,21 @@ def convnext_tiny(*, weights: Optional[ConvNeXt_Tiny_Weights] = None, progress: def convnext_small( *, weights: Optional[ConvNeXt_Small_Weights] = None, progress: bool = True, **kwargs: Any ) -> ConvNeXt: - r"""ConvNeXt Small model architecture from the - `"A ConvNet for the 2020s" `_ paper. + """ConvNeXt Small model architecture from the + `A ConvNet for the 2020s `_ paper. + Args: - weights (ConvNeXt_Small_Weights, optional): The pretrained weights for the model - progress (bool): If True, displays a progress bar of the download to stderr + weights (:class:`~torchvision.models.convnext.ConvNeXt_Small_Weights`, optional): The pretrained + weights to use. See :class:`~torchvision.models.convnext.ConvNeXt_Small_Weights` + below for more details and possible values. By default, no pre-trained weights are used. + progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True. + **kwargs: parameters passed to the ``torchvision.models.convnext.ConvNext`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.convnext.ConvNeXt_Small_Weights + :members: """ weights = ConvNeXt_Small_Weights.verify(weights) @@ -318,11 +338,21 @@ def convnext_small( @handle_legacy_interface(weights=("pretrained", ConvNeXt_Base_Weights.IMAGENET1K_V1)) def convnext_base(*, weights: Optional[ConvNeXt_Base_Weights] = None, progress: bool = True, **kwargs: Any) -> ConvNeXt: - r"""ConvNeXt Base model architecture from the - `"A ConvNet for the 2020s" `_ paper. + """ConvNeXt Base model architecture from the + `A ConvNet for the 2020s `_ paper. + Args: - weights (ConvNeXt_Base_Weights, optional): The pretrained weights for the model - progress (bool): If True, displays a progress bar of the download to stderr + weights (:class:`~torchvision.models.convnext.ConvNeXt_Base_Weights`, optional): The pretrained + weights to use. See :class:`~torchvision.models.convnext.ConvNeXt_Base_Weights` + below for more details and possible values. By default, no pre-trained weights are used. + progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True. + **kwargs: parameters passed to the ``torchvision.models.convnext.ConvNext`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.convnext.ConvNeXt_Base_Weights + :members: """ weights = ConvNeXt_Base_Weights.verify(weights) @@ -340,11 +370,21 @@ def convnext_base(*, weights: Optional[ConvNeXt_Base_Weights] = None, progress: def convnext_large( *, weights: Optional[ConvNeXt_Large_Weights] = None, progress: bool = True, **kwargs: Any ) -> ConvNeXt: - r"""ConvNeXt Large model architecture from the - `"A ConvNet for the 2020s" `_ paper. + """ConvNeXt Large model architecture from the + `A ConvNet for the 2020s `_ paper. + Args: - weights (ConvNeXt_Large_Weights, optional): The pretrained weights for the model - progress (bool): If True, displays a progress bar of the download to stderr + weights (:class:`~torchvision.models.convnext.ConvNeXt_Large_Weights`, optional): The pretrained + weights to use. See :class:`~torchvision.models.convnext.ConvNeXt_Large_Weights` + below for more details and possible values. By default, no pre-trained weights are used. + progress (bool, optional): If True, displays a progress bar of the download to stderr. Default is True. + **kwargs: parameters passed to the ``torchvision.models.convnext.ConvNext`` + base class. Please refer to the `source code + `_ + for more details about this class. + + .. autoclass:: torchvision.models.convnext.ConvNeXt_Large_Weights + :members: """ weights = ConvNeXt_Large_Weights.verify(weights)