def __init__(self, args):
    super(MiraiFull, self).__init__()
    self.args = args
    if (args.img_encoder_snapshot is not None):
        self.image_encoder = load_model(args.img_encoder_snapshot, args, do_wrap_model=False)
    else:
        self.image_encoder = get_model_by_name('custom_resnet', False, args)
    if (hasattr(self.args, 'freeze_image_encoder') and self.args.freeze_image_encoder):
        for param in self.image_encoder.parameters():
            param.requires_grad = False
    self.image_repr_dim = self.image_encoder._model.args.img_only_dim
    if (args.transformer_snapshot is not None):
        self.transformer = load_model(args.transformer_snapshot, args, do_wrap_model=False)
    else:
        args.precomputed_hidden_dim = self.image_repr_dim
        self.transformer = get_model_by_name('transformer', False, args)
    args.img_only_dim = self.transformer.args.transfomer_hidden_dim
def __init__(self, args):
    super(MiraiFull, self).__init__()
    self.args = args
    if (args.img_encoder_snapshot is not None):
        self.image_encoder = load_model(args.img_encoder_snapshot, args, do_wrap_model=False)
    else:
        self.image_encoder = get_model_by_name('custom_resnet', False, args)
    if (hasattr(self.args, 'freeze_image_encoder') and self.args.freeze_image_encoder):
        for param in self.image_encoder.parameters():
            param.requires_grad = False
    self.image_repr_dim = self.image_encoder._model.args.img_only_dim
    if (args.transformer_snapshot is not None):
        self.transformer = load_model(args.transformer_snapshot, args, do_wrap_model=False)
    else:
        args.precomputed_hidden_dim = self.image_repr_dim
        self.transformer = get_model_by_name('transformer', False, args)
    args.img_only_dim = self.transformer.args.transfomer_hidden_dim