

'''simple docstring'''






from collections import OrderedDict
from typing import Any, Mapping, Optional

from ... import PreTrainedTokenizer
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast
from ...onnx.utils import compute_effective_axis_dimension
from ...utils import TensorType, is_torch_available, logging


snake_case_					  =	logging.get_logger(__name__)

snake_case_					  =	{
    '''facebook/m2m100_418M''': '''https://huggingface.co/facebook/m2m100_418M/resolve/main/config.json''',
    # See all M2M100 models at https://huggingface.co/models?filter=m2m_100
}
class      SCREAMING_SNAKE_CASE__      (    A__				):
    _A         =							"m2m_100"
    _A         =							["past_key_values"]
    _A         =							{"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}




    def __init__( self    ,					lowercase__=12_8112    ,					lowercase__=1024    ,					lowercase__=12    ,					lowercase__=4096    ,					lowercase__=16    ,					lowercase__=12    ,					lowercase__=4096    ,					lowercase__=16    ,					lowercase__=0.05    ,					lowercase__=0.05    ,					lowercase__=True    ,					lowercase__=True    ,					lowercase__="relu"    ,					lowercase__=1024    ,					lowercase__=0.1    ,					lowercase__=0.1    ,					lowercase__=0.0    ,					lowercase__=0.02    ,					lowercase__=2    ,					lowercase__=True    ,					lowercase__=1    ,					lowercase__=0    ,					lowercase__=2    ,					**lowercase__    ,					):






          """simple docstring"""






          SCREAMING_SNAKE_CASE_				:      Optional[int]					=	vocab_size
          SCREAMING_SNAKE_CASE_				:      Optional[int]					=	max_position_embeddings
          SCREAMING_SNAKE_CASE_				:      Dict					=	d_model
          SCREAMING_SNAKE_CASE_				:      Union[str, Any]					=	encoder_ffn_dim
          SCREAMING_SNAKE_CASE_				:      List[Any]					=	encoder_layers
          SCREAMING_SNAKE_CASE_				:      str					=	encoder_attention_heads
          SCREAMING_SNAKE_CASE_				:      str					=	decoder_ffn_dim
          SCREAMING_SNAKE_CASE_				:      Tuple					=	decoder_layers
          SCREAMING_SNAKE_CASE_				:      Optional[int]					=	decoder_attention_heads
          SCREAMING_SNAKE_CASE_				:      Any					=	dropout
          SCREAMING_SNAKE_CASE_				:      List[str]					=	attention_dropout
          SCREAMING_SNAKE_CASE_				:      Dict					=	activation_dropout
          SCREAMING_SNAKE_CASE_				:      List[str]					=	activation_function
          SCREAMING_SNAKE_CASE_				:      Tuple					=	init_std
          SCREAMING_SNAKE_CASE_				:      List[str]					=	encoder_layerdrop
          SCREAMING_SNAKE_CASE_				:      List[str]					=	decoder_layerdrop
          SCREAMING_SNAKE_CASE_				:      Any					=	use_cache
          SCREAMING_SNAKE_CASE_				:      Optional[Any]					=	encoder_layers
          SCREAMING_SNAKE_CASE_				:      Optional[Any]					=	scale_embedding  # scale factor will be sqrt(d_model) if True

          super().__init__(
              pad_token_id=_A    ,					bos_token_id=_A    ,					eos_token_id=_A    ,					is_encoder_decoder=_A    ,					decoder_start_token_id=_A    ,					**_A    ,					)






class      SCREAMING_SNAKE_CASE__      (    A__				):




    @property
    def   __lowerCamelCase				( self      ):






          """simple docstring"""






          SCREAMING_SNAKE_CASE_				:      List[str]					=	OrderedDict(
              [
                  ("input_ids", {0: "batch", 1: "encoder_sequence"}),
                  ("attention_mask", {0: "batch", 1: "encoder_sequence"}),
              ]      )

          if self.use_past:
                SCREAMING_SNAKE_CASE_				:      str					=	{0: "batch"}
                SCREAMING_SNAKE_CASE_				:      Optional[Any]					=	{0: "batch", 1: "past_decoder_sequence + sequence"}
          else:
                SCREAMING_SNAKE_CASE_				:      List[Any]					=	{0: "batch", 1: "decoder_sequence"}
                SCREAMING_SNAKE_CASE_				:      Optional[Any]					=	{0: "batch", 1: "decoder_sequence"}

          if self.use_past:
                self.fill_with_past_key_values_(_A    ,					direction="inputs"      )
          return common_inputs




    def   __lowerCamelCase				( self    ,					lowercase__    ,					lowercase__ = -1    ,					lowercase__ = -1    ,					lowercase__ = False    ,					lowercase__ = None    ,					):






          """simple docstring"""






          SCREAMING_SNAKE_CASE_				:      Any					=	compute_effective_axis_dimension(
              _A    ,					fixed_dimension=OnnxConfig.default_fixed_batch    ,					num_token_to_add=0      )

          # If dynamic axis (-1) we forward with a fixed dimension of 8 tokens to avoid optimizations made by ONNX
          SCREAMING_SNAKE_CASE_				:      Optional[Any]					=	tokenizer.num_special_tokens_to_add(_A      )
          SCREAMING_SNAKE_CASE_				:      List[str]					=	compute_effective_axis_dimension(
              _A    ,					fixed_dimension=OnnxConfig.default_fixed_sequence    ,					num_token_to_add=_A      )

          # Generate dummy inputs according to compute batch and sequence
          SCREAMING_SNAKE_CASE_				:      List[Any]					=	[" ".join([tokenizer.unk_token]      ) * seq_length] * batch_size
          SCREAMING_SNAKE_CASE_				:      Dict					=	dict(tokenizer(_A    ,					return_tensors=_A      )      )
          return common_inputs




    def   __lowerCamelCase				( self    ,					lowercase__    ,					lowercase__ = -1    ,					lowercase__ = -1    ,					lowercase__ = False    ,					lowercase__ = None    ,					):






          """simple docstring"""






          SCREAMING_SNAKE_CASE_				:      int					=	self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
              _A    ,					_A    ,					_A    ,					_A    ,					_A      )

          # Generate decoder inputs
          SCREAMING_SNAKE_CASE_				:      Optional[int]					=	seq_length if not self.use_past else 1
          SCREAMING_SNAKE_CASE_				:      int					=	self._generate_dummy_inputs_for_sequence_classification_and_question_answering(
              _A    ,					_A    ,					_A    ,					_A    ,					_A      )
          SCREAMING_SNAKE_CASE_				:      int					=	{F"decoder_{name}": tensor for name, tensor in decoder_inputs.items()}
          SCREAMING_SNAKE_CASE_				:      Dict					=	dict(**_A    ,					**_A      )

          if self.use_past:
                if not is_torch_available():
                      raise ValueError("Cannot generate dummy past_keys inputs without PyTorch installed."      )
                else:
                      import torch
                SCREAMING_SNAKE_CASE_				:      Any					=	common_inputs["input_ids"].shape
                SCREAMING_SNAKE_CASE_				:      Optional[int]					=	common_inputs["decoder_input_ids"].shape[1]
                SCREAMING_SNAKE_CASE_				:      List[str]					=	self.num_attention_heads
                SCREAMING_SNAKE_CASE_				:      List[str]					=	(
                    batch,
                    num_encoder_attention_heads,
                    encoder_seq_length,
                    self._config.hidden_size // num_encoder_attention_heads,
                )
                SCREAMING_SNAKE_CASE_				:      List[Any]					=	decoder_seq_length + 3
                SCREAMING_SNAKE_CASE_				:      Union[str, Any]					=	(
                    batch,
                    num_decoder_attention_heads,
                    decoder_past_length,
                    self._config.hidden_size // num_decoder_attention_heads,
                )

                SCREAMING_SNAKE_CASE_				:      Optional[int]					=	torch.cat(
                    [common_inputs["decoder_attention_mask"], torch.ones(_A    ,					_A      )]    ,					dim=1      )

                SCREAMING_SNAKE_CASE_				:      Tuple					=	[]
                # If the number of encoder and decoder layers are present in the model configuration, both are considered
                SCREAMING_SNAKE_CASE_				:      Union[str, Any]					=	self.num_layers
                SCREAMING_SNAKE_CASE_				:      Optional[int]					=	min(_A    ,					_A      )
                SCREAMING_SNAKE_CASE_				:      Optional[Any]					=	max(_A    ,					_A      ) - min_num_layers
                SCREAMING_SNAKE_CASE_				:      str					=	"encoder" if num_encoder_layers > num_decoder_layers else "decoder"

                for _ in range(_A      ):
                      common_inputs["past_key_values"].append(
                          (
                              torch.zeros(_A      ),
                              torch.zeros(_A      ),
                              torch.zeros(_A      ),
                              torch.zeros(_A      ),
                          )      )
                # TODO: test this.
                SCREAMING_SNAKE_CASE_				:      Union[str, Any]					=	encoder_shape if remaining_side_name == "encoder" else decoder_shape
                for _ in range(_A    ,					_A      ):
                      common_inputs["past_key_values"].append((torch.zeros(_A      ), torch.zeros(_A      ))      )
          return common_inputs







    _A         =							_generate_dummy_inputs_for_default_and_seqaseq_lm




'''simple docstring'''






import requests
from bsa import BeautifulSoup


def  __lowerCamelCase      (				SCREAMING_SNAKE_CASE_					:     int  ,  SCREAMING_SNAKE_CASE_					:     str   )							->       str:
      """simple docstring"""

      SCREAMING_SNAKE_CASE_				:      List[str]					=	(
          "https://www.horoscope.com/us/horoscopes/general/"
          F"horoscope-general-daily-{day}.aspx?sign={zodiac_sign}"
      )
      SCREAMING_SNAKE_CASE_				:      Dict					=	BeautifulSoup(requests.get(SCREAMING_SNAKE_CASE_   ).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',
      )
      snake_case_					  =	int(input('number> ').strip())
      print('choose some day:\n', 'yesterday\n', 'today\n', 'tomorrow\n')
      snake_case_					  =	input('enter the day> ')
      snake_case_					  =	horoscope(zodiac_sign, day)
      print(horoscope_text)

