"""simple docstring"""




import argparse

import torch

from transformers import (
    WavaVecaConfig,
    WavaVecaFeatureExtractor,
    WavaVecaForAudioFrameClassification,
    WavaVecaForSequenceClassification,
    WavaVecaForXVector,
    logging,
)


logging.set_verbosity_info()
__lowerCAmelCase     :				List[str]    				=    logging.get_logger(__name__)







def 				_UpperCAmelCase		(							lowerCamelCase__      ,	lowerCamelCase__      ,	lowerCamelCase__  ):





		"""simple docstring"""




		lowerCAmelCase__   = WavaVecaForSequenceClassification.from_pretrained(lowerCamelCase__      ,	config=lowerCamelCase__  )
		lowerCAmelCase__   = downstream_dict["""projector.weight"""]
		lowerCAmelCase__   = downstream_dict["""projector.bias"""]
		lowerCAmelCase__   = downstream_dict["""model.post_net.linear.weight"""]
		lowerCAmelCase__   = downstream_dict["""model.post_net.linear.bias"""]
		return model







def 				_UpperCAmelCase		(							lowerCamelCase__      ,	lowerCamelCase__      ,	lowerCamelCase__  ):





		"""simple docstring"""




		lowerCAmelCase__   = WavaVecaForAudioFrameClassification.from_pretrained(lowerCamelCase__      ,	config=lowerCamelCase__  )
		lowerCAmelCase__   = downstream_dict["""model.linear.weight"""]
		lowerCAmelCase__   = downstream_dict["""model.linear.bias"""]
		return model







def 				_UpperCAmelCase		(							lowerCamelCase__      ,	lowerCamelCase__      ,	lowerCamelCase__  ):





		"""simple docstring"""




		lowerCAmelCase__   = WavaVecaForXVector.from_pretrained(lowerCamelCase__      ,	config=lowerCamelCase__  )
		lowerCAmelCase__   = downstream_dict["""connector.weight"""]
		lowerCAmelCase__   = downstream_dict["""connector.bias"""]
		for i, kernel_size in enumerate(hf_config.tdnn_kernel  ):
				lowerCAmelCase__   = downstream_dict[
				    f"""model.framelevel_feature_extractor.module.{i}.kernel.weight"""
				]
				lowerCAmelCase__   = downstream_dict[f"""model.framelevel_feature_extractor.module.{i}.kernel.bias"""]

		lowerCAmelCase__   = downstream_dict["""model.utterancelevel_feature_extractor.linear1.weight"""]
		lowerCAmelCase__   = downstream_dict["""model.utterancelevel_feature_extractor.linear1.bias"""]
		lowerCAmelCase__   = downstream_dict["""model.utterancelevel_feature_extractor.linear2.weight"""]
		lowerCAmelCase__   = downstream_dict["""model.utterancelevel_feature_extractor.linear2.bias"""]
		lowerCAmelCase__   = downstream_dict["""objective.W"""]
		return model







@torch.no_grad()
def 				_UpperCAmelCase		(							lowerCamelCase__      ,	lowerCamelCase__      ,	lowerCamelCase__      ,	lowerCamelCase__  ):





		"""simple docstring"""




		lowerCAmelCase__   = torch.load(lowerCamelCase__      ,	map_location="""cpu"""  )

		lowerCAmelCase__   = checkpoint["""Downstream"""]

		lowerCAmelCase__   = WavaVecaConfig.from_pretrained(lowerCamelCase__  )
		lowerCAmelCase__   = WavaVecaFeatureExtractor.from_pretrained(
		    lowerCamelCase__      ,	return_attention_mask=lowerCamelCase__      ,	do_normalize=lowerCamelCase__  )

		lowerCAmelCase__   = hf_config.architectures[0]
		if arch.endswith("""ForSequenceClassification"""  ):
				lowerCAmelCase__   = convert_classification(lowerCamelCase__      ,	lowerCamelCase__      ,	lowerCamelCase__  )
		elif arch.endswith("""ForAudioFrameClassification"""  ):
				lowerCAmelCase__   = convert_diarization(lowerCamelCase__      ,	lowerCamelCase__      ,	lowerCamelCase__  )
		elif arch.endswith("""ForXVector"""  ):
				lowerCAmelCase__   = convert_xvector(lowerCamelCase__      ,	lowerCamelCase__      ,	lowerCamelCase__  )
		else:
				raise NotImplementedError(f"""S3PRL weights conversion is not supported for {arch}"""  )

		if hf_config.use_weighted_layer_sum:
				lowerCAmelCase__   = checkpoint["""Featurizer"""]["""weights"""]

		hf_feature_extractor.save_pretrained(lowerCamelCase__  )
		hf_model.save_pretrained(lowerCamelCase__  )


if __name__ == "__main__":
			__lowerCAmelCase     :				Optional[Any]    				=    argparse.ArgumentParser()
			parser.add_argument(
			    "--base_model_name", default=None, type=str, help="Name of the huggingface pretrained base model."
			)
			parser.add_argument("--config_path", default=None, type=str, help="Path to the huggingface classifier config.")
			parser.add_argument("--checkpoint_path", default=None, type=str, help="Path to the s3prl checkpoint.")
			parser.add_argument("--model_dump_path", default=None, type=str, help="Path to the final converted model.")
			__lowerCAmelCase     :				Optional[int]    				=    parser.parse_args()
			convert_saprl_checkpoint(args.base_model_name, args.config_path, args.checkpoint_path, args.model_dump_path)





"""simple docstring"""




import math
from datetime import datetime, timedelta







def 				_UpperCAmelCase		(							lowerCamelCase__  ):





		"""simple docstring"""




		lowerCAmelCase__   = year % 19
		lowerCAmelCase__   = year % 4
		lowerCAmelCase__   = year % 7
		lowerCAmelCase__   = math.floor(year / 100  )
		lowerCAmelCase__   = math.floor((13 + 8 * leap_day_inhibits) / 25  )
		lowerCAmelCase__   = leap_day_inhibits / 4
		lowerCAmelCase__   = (
		    15 - lunar_orbit_correction + leap_day_inhibits - leap_day_reinstall_number
		) % 30
		lowerCAmelCase__   = (4 + leap_day_inhibits - leap_day_reinstall_number) % 7

		# days to be added to March 21
		lowerCAmelCase__   = (19 * metonic_cycle + secular_moon_shift) % 30

		# PHM -> Paschal Full Moon
		lowerCAmelCase__   = (
		    2 * julian_leap_year
		    + 4 * non_leap_year
		    + 6 * days_to_add
		    + century_starting_point
		) % 7

		if days_to_add == 29 and days_from_phm_to_sunday == 6:
				return datetime(lowerCamelCase__      ,	4      ,	19  )
		elif days_to_add == 28 and days_from_phm_to_sunday == 6:
				return datetime(lowerCamelCase__      ,	4      ,	18  )
		else:
				return datetime(lowerCamelCase__      ,	3      ,	22  ) + timedelta(
				    days=int(days_to_add + days_from_phm_to_sunday  )  )


if __name__ == "__main__":
			for year in (19_94, 20_00, 20_10, 20_21, 20_23):
						__lowerCAmelCase     :				List[str]    				=    "will be" if year > datetime.now().year else "was"
						print(F"Easter in {year} {tense} {gauss_easter(year)}")




