





import inspect
import unittest

import torch
import torch.nn as nn

from accelerate.hooks import (
    AlignDevicesHook,
    ModelHook,
    SequentialHook,
    add_hook_to_module,
    attach_align_device_hook,
    remove_hook_from_module,
    remove_hook_from_submodules,
)
from accelerate.test_utils import require_multi_gpu

class      lowerCAmelCase							(      nn.Module    ):
 def __init__(   self						:   Optional[Any]			)    ->			int:
     super().__init__()
     lowerCamelCase__					:   Optional[int]      				=	nn.Linear(3    ,  4			)
     lowerCamelCase__					:   Optional[int]      				=	nn.BatchNormad(4			)
     lowerCamelCase__					:   int      				=	nn.Linear(4    ,  5			)







 def   A_			(   self						:   str    ,  UpperCAmelCase						:   Tuple			)    ->			Tuple:
     return self.lineara(self.batchnorm(self.lineara(UpperCAmelCase			)			)			)


class      lowerCAmelCase							(      __UpperCamelCase    ):
 def   A_			(   self						:   str    ,  UpperCAmelCase						:   int    ,  *UpperCAmelCase						:   int    ,  **UpperCAmelCase						:   Dict			)    ->			Any:
     return (args[0] + 1,) + args[1:], kwargs


class      lowerCAmelCase							(      __UpperCamelCase    ):
 def   A_			(   self						:   Union[str, Any]    ,  UpperCAmelCase						:   str    ,  UpperCAmelCase						:   Optional[int]			)    ->			List[str]:
     return output + 1


class      lowerCAmelCase							(      unittest.TestCase    ):
 def   A_			(   self						:   Optional[Any]			)    ->			Dict:
     lowerCamelCase__					:   Union[str, Any]      				=	ModelForTest()
     lowerCamelCase__					:   str      				=	ModelHook()

     add_hook_to_module(UpperCAmelCase    ,  UpperCAmelCase			)
     self.assertEqual(test_model._hf_hook    ,  UpperCAmelCase			)
     self.assertTrue(hasattr(UpperCAmelCase    ,  '_old_forward'			)			)

     # Check adding the hook did not change the name or the signature
     self.assertEqual(test_model.forward.__name__    ,  'forward'			)
     self.assertListEqual(list(inspect.signature(test_model.forward			).parameters			)    ,  ['x']			)

     remove_hook_from_module(UpperCAmelCase			)
     self.assertFalse(hasattr(UpperCAmelCase    ,  '_hf_hook'			)			)
     self.assertFalse(hasattr(UpperCAmelCase    ,  '_old_forward'			)			)
 def   A_			(   self						:   Dict			)    ->			List[str]:
     lowerCamelCase__					:   Optional[Any]      				=	ModelForTest()
     lowerCamelCase__					:   Any      				=	ModelHook()

     add_hook_to_module(UpperCAmelCase    ,  UpperCAmelCase			)
     add_hook_to_module(UpperCAmelCase    ,  UpperCAmelCase    ,  append=UpperCAmelCase			)

     self.assertEqual(isinstance(test_model._hf_hook    ,  UpperCAmelCase			)    ,  UpperCAmelCase			)
     self.assertEqual(len(test_model._hf_hook.hooks			)    ,  2			)
     self.assertTrue(hasattr(UpperCAmelCase    ,  '_old_forward'			)			)

     # Check adding the hook did not change the name or the signature
     self.assertEqual(test_model.forward.__name__    ,  'forward'			)
     self.assertListEqual(list(inspect.signature(test_model.forward			).parameters			)    ,  ['x']			)

     remove_hook_from_module(UpperCAmelCase			)
     self.assertFalse(hasattr(UpperCAmelCase    ,  '_hf_hook'			)			)
     self.assertFalse(hasattr(UpperCAmelCase    ,  '_old_forward'			)			)
 def   A_			(   self						:   int			)    ->			Dict:
     lowerCamelCase__					:   Optional[int]      				=	ModelForTest()
     lowerCamelCase__					:   Any      				=	torch.randn(2    ,  3			)
     lowerCamelCase__					:   List[Any]      				=	test_model(x + 1			)
     lowerCamelCase__					:   List[Any]      				=	test_model(x + 2			)

     lowerCamelCase__					:   Any      				=	PreForwardHook()
     add_hook_to_module(UpperCAmelCase    ,  UpperCAmelCase			)
     lowerCamelCase__					:   Union[str, Any]      				=	test_model(UpperCAmelCase			)
     self.assertTrue(torch.allclose(UpperCAmelCase    ,  UpperCAmelCase    ,  atol=1e-5			)			)

     # Attaching a hook to a model when it already has one replaces, does not chain
     lowerCamelCase__					:   Tuple      				=	PreForwardHook()
     add_hook_to_module(UpperCAmelCase    ,  UpperCAmelCase			)
     lowerCamelCase__					:   Dict      				=	test_model(UpperCAmelCase			)
     self.assertTrue(torch.allclose(UpperCAmelCase    ,  UpperCAmelCase    ,  atol=1e-5			)			)

     # You need to use the sequential hook to chain two or more hooks
     lowerCamelCase__					:   Union[str, Any]      				=	SequentialHook(PreForwardHook()    ,  PreForwardHook()			)
     add_hook_to_module(UpperCAmelCase    ,  UpperCAmelCase			)

     lowerCamelCase__					:   List[str]      				=	test_model(UpperCAmelCase			)
     assert torch.allclose(UpperCAmelCase    ,  UpperCAmelCase    ,  atol=1e-5			)
 def   A_			(   self						:   str			)    ->			Any:
     lowerCamelCase__					:   int      				=	ModelForTest()
     lowerCamelCase__					:   Optional[int]      				=	torch.randn(2    ,  3			)
     lowerCamelCase__					:   Any      				=	test_model(UpperCAmelCase			)

     lowerCamelCase__					:   Any      				=	PostForwardHook()
     add_hook_to_module(UpperCAmelCase    ,  UpperCAmelCase			)
     lowerCamelCase__					:   Optional[Any]      				=	test_model(UpperCAmelCase			)
     self.assertTrue(torch.allclose(UpperCAmelCase    ,  output + 1    ,  atol=1e-5			)			)

     # Attaching a hook to a model when it already has one replaces, does not chain
     lowerCamelCase__					:   Union[str, Any]      				=	PostForwardHook()
     add_hook_to_module(UpperCAmelCase    ,  UpperCAmelCase			)
     lowerCamelCase__					:   str      				=	test_model(UpperCAmelCase			)
     self.assertTrue(torch.allclose(UpperCAmelCase    ,  output + 1    ,  atol=1e-5			)			)

     # You need to use the sequential hook to chain two or more hooks
     lowerCamelCase__					:   Tuple      				=	SequentialHook(PostForwardHook()    ,  PostForwardHook()			)
     add_hook_to_module(UpperCAmelCase    ,  UpperCAmelCase			)

     lowerCamelCase__					:   List[Any]      				=	test_model(UpperCAmelCase			)
     assert torch.allclose(UpperCAmelCase    ,  output + 2    ,  atol=1e-5			)
 def   A_			(   self						:   Dict			)    ->			Any:
     lowerCamelCase__					:   List[str]      				=	ModelForTest()
     lowerCamelCase__					:   List[Any]      				=	torch.randn(2    ,  3			)
     lowerCamelCase__					:   List[Any]      				=	test_model(UpperCAmelCase			)

     lowerCamelCase__					:   Union[str, Any]      				=	PostForwardHook()
     add_hook_to_module(UpperCAmelCase    ,  UpperCAmelCase			)
     lowerCamelCase__					:   List[Any]      				=	test_model(UpperCAmelCase			)
     self.assertTrue(torch.allclose(UpperCAmelCase    ,  output + 1			)			)
     self.assertTrue(outputa.requires_grad			)

     lowerCamelCase__					:   List[Any]      				=	True
     lowerCamelCase__					:   Union[str, Any]      				=	test_model(UpperCAmelCase			)
     self.assertFalse(outputa.requires_grad			)
 @require_multi_gpu
 def   A_			(   self						:   Any			)    ->			str:
     lowerCamelCase__					:   Optional[Any]      				=	ModelForTest()
     # Everything is on CPU
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)

     # This will move each submodule on different devices
     add_hook_to_module(model.lineara    ,  AlignDevicesHook(execution_device=0			)			)
     add_hook_to_module(model.batchnorm    ,  AlignDevicesHook(execution_device=0			)			)
     add_hook_to_module(model.lineara    ,  AlignDevicesHook(execution_device=1			)			)

     self.assertEqual(model.lineara.weight.device    ,  torch.device(0			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device(0			)			)
     self.assertEqual(model.batchnorm.running_mean.device    ,  torch.device(0			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device(1			)			)

     # We can still make a forward pass. The input does not need to be on any particular device
     lowerCamelCase__					:   int      				=	torch.randn(2    ,  3			)
     lowerCamelCase__					:   Optional[int]      				=	model(UpperCAmelCase			)
     self.assertEqual(output.device    ,  torch.device(1			)			)

     # We can add a general hook to put back output on same device as input.
     add_hook_to_module(UpperCAmelCase    ,  AlignDevicesHook(io_same_device=UpperCAmelCase			)			)
     lowerCamelCase__					:   List[Any]      				=	torch.randn(2    ,  3			).to(0			)
     lowerCamelCase__					:   Tuple      				=	model(UpperCAmelCase			)
     self.assertEqual(output.device    ,  torch.device(0			)			)
 def   A_			(   self						:   Union[str, Any]			)    ->			Dict:
     lowerCamelCase__					:   Optional[int]      				=	ModelForTest()

     # Everything is on CPU
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)

     # This will move each submodule on different devices
     lowerCamelCase__					:   str      				=	{'execution_device': 0 if torch.cuda.is_available() else 'cpu', 'offload': True}

     add_hook_to_module(model.lineara    ,  AlignDevicesHook(**UpperCAmelCase			)			)
     add_hook_to_module(model.batchnorm    ,  AlignDevicesHook(**UpperCAmelCase			)			)
     add_hook_to_module(model.lineara    ,  AlignDevicesHook(**UpperCAmelCase			)			)

     # Parameters have been offloaded, so on the meta device
     self.assertEqual(model.lineara.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('meta'			)			)
     # Buffers are not included in the offload by default, so are on the execution device
     lowerCamelCase__					:   List[str]      				=	torch.device(hook_kwargs['execution_device']			)
     self.assertEqual(model.batchnorm.running_mean.device    ,  UpperCAmelCase			)

     lowerCamelCase__					:   int      				=	torch.randn(2    ,  3			)
     lowerCamelCase__					:   Tuple      				=	model(UpperCAmelCase			)
     self.assertEqual(output.device    ,  UpperCAmelCase			)

     # Removing hooks loads back the weights in the model.
     remove_hook_from_module(model.lineara			)
     remove_hook_from_module(model.batchnorm			)
     remove_hook_from_module(model.lineara			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)

     # Now test with buffers included in the offload
     lowerCamelCase__					:   Tuple      				=	{
         'execution_device': 0 if torch.cuda.is_available() else 'cpu',
         'offload': True,
         'offload_buffers': True,
     }

     add_hook_to_module(model.lineara    ,  AlignDevicesHook(**UpperCAmelCase			)			)
     add_hook_to_module(model.batchnorm    ,  AlignDevicesHook(**UpperCAmelCase			)			)
     add_hook_to_module(model.lineara    ,  AlignDevicesHook(**UpperCAmelCase			)			)

     # Parameters have been offloaded, so on the meta device, buffers included
     self.assertEqual(model.lineara.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.batchnorm.running_mean.device    ,  torch.device('meta'			)			)

     lowerCamelCase__					:   Optional[int]      				=	torch.randn(2    ,  3			)
     lowerCamelCase__					:   Tuple      				=	model(UpperCAmelCase			)
     self.assertEqual(output.device    ,  UpperCAmelCase			)

     # Removing hooks loads back the weights in the model.
     remove_hook_from_module(model.lineara			)
     remove_hook_from_module(model.batchnorm			)
     remove_hook_from_module(model.lineara			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)
 def   A_			(   self						:   List[str]			)    ->			Union[str, Any]:
     lowerCamelCase__					:   Tuple      				=	ModelForTest()

     # Everything is on CPU
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)

     # This will move each submodule on different devices
     lowerCamelCase__					:   List[str]      				=	0 if torch.cuda.is_available() else 'cpu'
     attach_align_device_hook(UpperCAmelCase    ,  execution_device=UpperCAmelCase    ,  offload=UpperCAmelCase			)

     # Parameters have been offloaded, so on the meta device
     self.assertEqual(model.lineara.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('meta'			)			)
     # Buffers are not included in the offload by default, so are on the execution device
     lowerCamelCase__					:   List[Any]      				=	torch.device(UpperCAmelCase			)
     self.assertEqual(model.batchnorm.running_mean.device    ,  UpperCAmelCase			)

     lowerCamelCase__					:   Optional[Any]      				=	torch.randn(2    ,  3			)
     lowerCamelCase__					:   List[str]      				=	model(UpperCAmelCase			)
     self.assertEqual(output.device    ,  UpperCAmelCase			)

     # Removing hooks loads back the weights in the model.
     remove_hook_from_submodules(UpperCAmelCase			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)

     # Now test with buffers included in the offload
     attach_align_device_hook(UpperCAmelCase    ,  execution_device=UpperCAmelCase    ,  offload=UpperCAmelCase    ,  offload_buffers=UpperCAmelCase			)

     # Parameters have been offloaded, so on the meta device, buffers included
     self.assertEqual(model.lineara.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.batchnorm.running_mean.device    ,  torch.device('meta'			)			)

     lowerCamelCase__					:   List[Any]      				=	torch.randn(2    ,  3			)
     lowerCamelCase__					:   str      				=	model(UpperCAmelCase			)
     self.assertEqual(output.device    ,  UpperCAmelCase			)

     # Removing hooks loads back the weights in the model.
     remove_hook_from_submodules(UpperCAmelCase			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)







 def   A_			(   self						:   Dict			)    ->			Optional[Any]:
     lowerCamelCase__					:   List[Any]      				=	ModelForTest()

     # Everything is on CPU
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)

     # This will move each submodule on different devices
     lowerCamelCase__					:   Dict      				=	0 if torch.cuda.is_available() else 'cpu'
     attach_align_device_hook(
         UpperCAmelCase    ,  execution_device=UpperCAmelCase    ,  offload=UpperCAmelCase    ,  weights_map=model.state_dict()			)

     # Parameters have been offloaded, so on the meta device
     self.assertEqual(model.lineara.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('meta'			)			)
     # Buffers are not included in the offload by default, so are on the execution device
     lowerCamelCase__					:   Optional[Any]      				=	torch.device(UpperCAmelCase			)
     self.assertEqual(model.batchnorm.running_mean.device    ,  UpperCAmelCase			)

     lowerCamelCase__					:   List[str]      				=	torch.randn(2    ,  3			)
     lowerCamelCase__					:   Optional[int]      				=	model(UpperCAmelCase			)
     self.assertEqual(output.device    ,  UpperCAmelCase			)

     # Removing hooks loads back the weights in the model.
     remove_hook_from_submodules(UpperCAmelCase			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)

     # Now test with buffers included in the offload
     attach_align_device_hook(
         UpperCAmelCase    ,  execution_device=UpperCAmelCase    ,  offload=UpperCAmelCase    ,  weights_map=model.state_dict()    ,  offload_buffers=UpperCAmelCase    ,  )

     # Parameters have been offloaded, so on the meta device, buffers included
     self.assertEqual(model.lineara.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('meta'			)			)
     self.assertEqual(model.batchnorm.running_mean.device    ,  torch.device('meta'			)			)

     lowerCamelCase__					:   Optional[Any]      				=	torch.randn(2    ,  3			)
     lowerCamelCase__					:   Dict      				=	model(UpperCAmelCase			)
     self.assertEqual(output.device    ,  UpperCAmelCase			)

     # Removing hooks loads back the weights in the model.
     remove_hook_from_submodules(UpperCAmelCase			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.batchnorm.weight.device    ,  torch.device('cpu'			)			)
     self.assertEqual(model.lineara.weight.device    ,  torch.device('cpu'			)			)












from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
    is_vision_available,
)


_UpperCAmelCase       : Optional[Any]			     =       {
    """configuration_clip""": [
        """CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """CLIPConfig""",
        """CLIPOnnxConfig""",
        """CLIPTextConfig""",
        """CLIPVisionConfig""",
    ],
    """processing_clip""": ["""CLIPProcessor"""],
    """tokenization_clip""": ["""CLIPTokenizer"""],
}

try:
    if not is_tokenizers_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCAmelCase       : int			     =       ["""CLIPTokenizerFast"""]

try:
    if not is_vision_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCAmelCase       : Optional[int]			     =       ["""CLIPFeatureExtractor"""]
    _UpperCAmelCase       : Union[str, Any]			     =       ["""CLIPImageProcessor"""]

try:
    if not is_torch_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCAmelCase       : int			     =       [
        """CLIP_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """CLIPModel""",
        """CLIPPreTrainedModel""",
        """CLIPTextModel""",
        """CLIPTextModelWithProjection""",
        """CLIPVisionModel""",
        """CLIPVisionModelWithProjection""",
    ]

try:
    if not is_tf_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCAmelCase       : Tuple			     =       [
        """TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST""",
        """TFCLIPModel""",
        """TFCLIPPreTrainedModel""",
        """TFCLIPTextModel""",
        """TFCLIPVisionModel""",
    ]

try:
    if not is_flax_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCAmelCase       : Optional[int]			     =       [
        """FlaxCLIPModel""",
        """FlaxCLIPPreTrainedModel""",
        """FlaxCLIPTextModel""",
        """FlaxCLIPTextPreTrainedModel""",
        """FlaxCLIPVisionModel""",
        """FlaxCLIPVisionPreTrainedModel""",
    ]


if TYPE_CHECKING:
    from .configuration_clip import (
        CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP,
        CLIPConfig,
        CLIPOnnxConfig,
        CLIPTextConfig,
        CLIPVisionConfig,
    )
    from .processing_clip import CLIPProcessor
    from .tokenization_clip import CLIPTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_clip_fast import CLIPTokenizerFast

    try:
        if not is_vision_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .feature_extraction_clip import CLIPFeatureExtractor
        from .image_processing_clip import CLIPImageProcessor

    try:
        if not is_torch_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_clip import (
            CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
            CLIPModel,
            CLIPPreTrainedModel,
            CLIPTextModel,
            CLIPTextModelWithProjection,
            CLIPVisionModel,
            CLIPVisionModelWithProjection,
        )

    try:
        if not is_tf_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_tf_clip import (
            TF_CLIP_PRETRAINED_MODEL_ARCHIVE_LIST,
            TFCLIPModel,
            TFCLIPPreTrainedModel,
            TFCLIPTextModel,
            TFCLIPVisionModel,
        )

    try:
        if not is_flax_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .modeling_flax_clip import (
            FlaxCLIPModel,
            FlaxCLIPPreTrainedModel,
            FlaxCLIPTextModel,
            FlaxCLIPTextPreTrainedModel,
            FlaxCLIPVisionModel,
            FlaxCLIPVisionPreTrainedModel,
        )


else:
    import sys

    _UpperCAmelCase       : Optional[Any]			     =       _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)





