mindformers.models.mae.ViTMAEConfig¶
-
class
mindformers.models.mae.ViTMAEConfig(mask_ratio: float = 0.75, image_size: int = 224, patch_size: int = 16, num_channels: int = 3, initializer_range: float = 0.02, hidden_size: int = 768, num_hidden_layers: int = 12, num_attention_heads: int = 12, intermediate_size: int = 3072, qkv_bias: bool = True, hidden_act: str = 'gelu', post_layernorm_residual: bool = False, layer_norm_eps: float = 1e-06, attention_probs_dropout_prob: float = 0.0, hidden_dropout_prob: float = 0.0, drop_path_rate: float = 0.0, decoder_hidden_size: int = 512, decoder_num_hidden_layers: int = 8, decoder_num_attention_heads: int = 16, decoder_intermediate_size: int = 2048, norm_pix_loss: bool = True, checkpoint_name_or_path: str = '', layernorm_compute_type: <module 'mindspore.common.dtype' from '/home/docs/checkouts/readthedocs.org/user_builds/mindformerstest/envs/stable/lib/python3.7/site-packages/mindspore/common/dtype.py'> = mindspore.float32, softmax_compute_type: <module 'mindspore.common.dtype' from '/home/docs/checkouts/readthedocs.org/user_builds/mindformerstest/envs/stable/lib/python3.7/site-packages/mindspore/common/dtype.py'> = mindspore.float32, param_init_type: <module 'mindspore.common.dtype' from '/home/docs/checkouts/readthedocs.org/user_builds/mindformerstest/envs/stable/lib/python3.7/site-packages/mindspore/common/dtype.py'> = mindspore.float32, parallel_config: mindformers.modules.transformer.transformer.TransformerOpParallelConfig = <mindformers.modules.transformer.transformer.TransformerOpParallelConfig object>, moe_config: mindformers.modules.transformer.moe.MoEConfig = <mindformers.modules.transformer.moe.MoEConfig object>, **kwargs)[源代码]¶ Config for Mae model
实际案例
>>> # init a config with a model name >>> config_a = ViTMAEConfig.from_pretrained('mae_vit_base_p16') >>> # init a config with a config path >>> import os >>> from mindformers.mindformer_book import MindFormerBook >>> config_path = os.path.join(MindFormerBook.get_project_path(), >>> 'configs', 'mae', 'run_mae_vit_base_p16_224_800ep.yaml') >>> config_b = ViTMAEConfig.from_pretrained(config_path) >>> # init a config with args >>> config_c = ViTMAEConfig( >>> patch_size=16, >>> in_chans=3, >>> ... >>> )