



"""simple docstring"""
import argparse
from argparse import Namespace

import torch
from torch import nn

from transformers import XGLMConfig, XGLMForCausalLM

def    _snake_case		(		UpperCamelCase		:	Any		):
 UpperCAmelCase			:      List[str]			=			[
     """decoder.version""",
     """decoder.output_projection.weight""",
     """_float_tensor""",
     """decoder.embed_positions._float_tensor""",
 ]
 for k in ignore_keys:
  state_dict.pop(UpperCamelCase    ,	UpperCamelCase		)

def    _snake_case		(		UpperCamelCase		:	List[Any]		):
 UpperCAmelCase			:      Tuple			=			emb.weight.shape
 UpperCAmelCase			:      int			=			nn.Linear(UpperCamelCase    ,	UpperCamelCase    ,	bias=UpperCamelCase		)
 UpperCAmelCase			:      str			=			emb.weight.data
 return lin_layer

def    _snake_case		(		UpperCamelCase		:	Union[str, Any]		):
 UpperCAmelCase			:      Any			=			torch.load(UpperCamelCase    ,	map_location="""cpu"""		)
 UpperCAmelCase			:      Tuple			=			Namespace(**checkpoint["""cfg"""]["""model"""]		)
 UpperCAmelCase			:      Optional[Any]			=			checkpoint["""model"""]
 remove_ignore_keys_(UpperCamelCase		)
 UpperCAmelCase			:      Dict			=			state_dict["""decoder.embed_tokens.weight"""].shape[0]

 UpperCAmelCase			:      Union[str, Any]			=			{key.replace("""decoder"""    ,	"""model"""		): val for key, val in state_dict.items()}

 UpperCAmelCase			:      int			=			XGLMConfig(
     vocab_size=UpperCamelCase    ,	max_position_embeddings=args.max_target_positions    ,	num_layers=args.decoder_layers    ,	attention_heads=args.decoder_attention_heads    ,	ffn_dim=args.decoder_ffn_embed_dim    ,	d_model=args.decoder_embed_dim    ,	layerdrop=args.decoder_layerdrop    ,	dropout=args.dropout    ,	attention_dropout=args.attention_dropout    ,	activation_dropout=args.activation_dropout    ,	activation_function="""gelu"""    ,	scale_embedding=not args.no_scale_embedding    ,	tie_word_embeddings=args.share_decoder_input_output_embed    ,	)

 UpperCAmelCase			:      List[str]			=			XGLMForCausalLM(UpperCamelCase		)
 UpperCAmelCase			:      Optional[int]			=			model.load_state_dict(UpperCamelCase    ,	strict=UpperCamelCase		)
 print(UpperCamelCase		)
 UpperCAmelCase			:      Optional[int]			=			make_linear_from_emb(model.model.embed_tokens		)

 return model


if __name__ == "__main__":
   A:     Optional[int]										=	argparse.ArgumentParser()
   # Required parameters
   parser.add_argument("fairseq_path", type=str, help="path to a model.pt on local filesystem.")
   parser.add_argument("pytorch_dump_folder_path", default=None, type=str, help="Path to the output PyTorch model.")
   A:     Union[str, Any]										=	parser.parse_args()
   A:     Tuple										=	convert_fairseq_xglm_checkpoint_from_disk(args.fairseq_path)
   model.save_pretrained(args.pytorch_dump_folder_path)





"""simple docstring"""
import requests
from bsa import BeautifulSoup

def    _snake_case		(		UpperCamelCase		:	str = "AAPL"		):
 UpperCAmelCase			:      Any			=			F"https://in.finance.yahoo.com/quote/{symbol}?s={symbol}"
 UpperCAmelCase			:      Optional[int]			=			BeautifulSoup(requests.get(UpperCamelCase		).text    ,	"""html.parser"""		)
 UpperCAmelCase			:      int			=			"""My(6px) Pos(r) smartphone_Mt(6px)"""
 return soup.find("""div"""    ,	class_=class_		).find("""span"""		).text


if __name__ == "__main__":
      for symbol in "AAPL AMZN IBM GOOG MSFT ORCL".split():
            print(f"""Current {symbol:<4} stock price is {stock_price(symbol):>8}""")
