'''simple docstring'''




import unittest

from transformers import is_flax_available
from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow


if is_flax_available():
  import optax
  from flax.training.common_utils import onehot

  from transformers import AutoTokenizer, FlaxMTaForConditionalGeneration
  from transformers.models.ta.modeling_flax_ta import shift_tokens_right

@require_torch
@require_sentencepiece
@require_tokenizers
@require_flax
class 	lowerCamelCase_	(unittest.TestCase    ):
      '''simple docstring'''

      @slow
      def      _A	(       self						:				Any       ):
             _UpperCAmelCase     :  List[str]							      =    FlaxMTaForConditionalGeneration.from_pretrained("google/mt5-small"       )
             _UpperCAmelCase     :  Any							      =    AutoTokenizer.from_pretrained("google/mt5-small"       )

             _UpperCAmelCase     :  Any							      =    tokenizer("Hello there"						,					return_tensors="np"       ).input_ids
             _UpperCAmelCase     :  Union[str, Any]							      =    tokenizer("Hi I am"						,					return_tensors="np"       ).input_ids

             _UpperCAmelCase     :  List[str]							      =    shift_tokens_right(A						,					model.config.pad_token_id						,					model.config.decoder_start_token_id       )

             _UpperCAmelCase     :  Tuple							      =    model(A						,					decoder_input_ids=A       ).logits
             _UpperCAmelCase     :  Optional[int]							      =    optax.softmax_cross_entropy(A						,					onehot(A						,					logits.shape[-1]       )       ).mean()

             _UpperCAmelCase     :  str							      =    -(labels.shape[-1] * loss.item())

             _UpperCAmelCase     :  str							      =    -84.9_127
             self.assertTrue(abs(mtf_score - EXPECTED_SCORE       ) < 1E-4       )



"""simple docstring"""





def 	__a     (		__lowerCamelCase,		__lowerCamelCase,		__lowerCamelCase  ):
   return round(float(moles / volume  ) * nfactor  )







def 	__a     (		__lowerCamelCase,		__lowerCamelCase,		__lowerCamelCase  ):
   return round(float((moles * 0.0821 * temperature) / (volume)  )  )







def 	__a     (		__lowerCamelCase,		__lowerCamelCase,		__lowerCamelCase  ):
   return round(float((moles * 0.0821 * temperature) / (pressure)  )  )







def 	__a     (		__lowerCamelCase,		__lowerCamelCase,		__lowerCamelCase  ):
   return round(float((pressure * volume) / (0.0821 * moles)  )  )


if __name__ == "__main__":
    import doctest

    doctest.testmod()


