






'''simple docstring'''





import torch.nn as nn

from .imports import is_fpa_available


if is_fpa_available():
							import transformer_engine.pytorch as te



def 			__UpperCAmelCase				(lowercase__	,lowercase__=True	,lowercase__=True	,lowercase__=True				)		->				Union[str, Any]:

						'''simple docstring'''


						if not is_fpa_available():
												raise ImportError("Using `convert_model` requires transformer_engine to be installed."				)
						for name, module in model.named_children():
												if isinstance(lowercase__	,nn.Linear				) and to_transformer_engine and _convert_linear:
																		# Return early if the linear layer weights are not multiples of 16
																		if any(p % 16 != 0 for p in module.weight.shape				):
																								return
																		a_				     =   module.bias is not None
																		a_				     =   te.Linear(
																		    module.in_features	,module.out_features	,bias=lowercase__	,params_dtype=module.weight.dtype				)
																		a_				     =   module.weight.data.clone()
																		if has_bias:
																								a_				     =   module.bias.data.clone()

																		setattr(lowercase__	,lowercase__	,lowercase__				)
												elif isinstance(lowercase__	,nn.LayerNorm				) and to_transformer_engine and _convert_ln:
																		a_				     =   te.LayerNorm(module.normalized_shape[0]	,eps=module.eps	,params_dtype=module.weight.dtype				)
																		a_				     =   module.weight.data.clone()
																		a_				     =   module.bias.data.clone()

																		setattr(lowercase__	,lowercase__	,lowercase__				)
												elif isinstance(lowercase__	,te.Linear				) and not to_transformer_engine and _convert_linear:
																		a_				     =   module.bias is not None
																		a_				     =   nn.Linear(
																		    module.in_features	,module.out_features	,bias=lowercase__	,params_dtype=module.weight.dtype				)
																		a_				     =   module.weight.data.clone()
																		if has_bias:
																								a_				     =   module.bias.data.clone()

																		setattr(lowercase__	,lowercase__	,lowercase__				)
												elif isinstance(lowercase__	,te.LayerNorm				) and not to_transformer_engine and _convert_ln:
																		a_				     =   nn.LayerNorm(module.normalized_shape[0]	,eps=module.eps	,params_dtype=module.weight.dtype				)
																		a_				     =   module.weight.data.clone()
																		a_				     =   module.bias.data.clone()

																		setattr(lowercase__	,lowercase__	,lowercase__				)
												else:
																		convert_model(
																		    lowercase__	,to_transformer_engine=lowercase__	,_convert_linear=_convert_linear	,_convert_ln=_convert_ln	,)



def 			__UpperCAmelCase				(lowercase__				)		->				int:

						'''simple docstring'''


						if not is_fpa_available():
												raise ImportError("Using `has_transformer_engine_layers` requires transformer_engine to be installed."				)
						for m in model.modules():
												if isinstance(lowercase__	,(te.LayerNorm, te.Linear)				):
																		return True
						return False











'''simple docstring'''





import requests
from bsa import BeautifulSoup



def 			__UpperCAmelCase				(lowercase__	,lowercase__				)		->				str:

						'''simple docstring'''


						a_				     =   (
						    "https://www.horoscope.com/us/horoscopes/general/"
						    F"""horoscope-general-daily-{day}.aspx?sign={zodiac_sign}"""
						)
						a_				     =   BeautifulSoup(requests.get(lowercase__				).content	,"html.parser"				)
						return soup.find("div"	,class_="main-horoscope"				).p.text


if __name__ == "__main__":
							print('Daily Horoscope. \n')
							print(
							    'enter your Zodiac sign number:\n',
							    '1. Aries\n',
							    '2. Taurus\n',
							    '3. Gemini\n',
							    '4. Cancer\n',
							    '5. Leo\n',
							    '6. Virgo\n',
							    '7. Libra\n',
							    '8. Scorpio\n',
							    '9. Sagittarius\n',
							    '10. Capricorn\n',
							    '11. Aquarius\n',
							    '12. Pisces\n',
							)
							a_      = int(input('number> ').strip())
							print('choose some day:\n', 'yesterday\n', 'today\n', 'tomorrow\n')
							a_      = input('enter the day> ')
							a_      = horoscope(zodiac_sign, day)
							print(horoscope_text)



