




'''simple docstring'''




import collections
from typing import List, Optional, Union

from ...tokenization_utils_base import BatchEncoding
from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging
from ..bert.tokenization_bert import BertTokenizer


_a   :	Union[str, Any] 							=   logging.get_logger(__name__)

_a   :	Optional[int] 							=   {"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

_a   :	List[str] 							=   {
    "vocab_file": {
        "facebook/dpr-ctx_encoder-single-nq-base": (
            "https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resolve/main/vocab.txt"
        ),
        "facebook/dpr-ctx_encoder-multiset-base": (
            "https://huggingface.co/facebook/dpr-ctx_encoder-multiset-base/resolve/main/vocab.txt"
        ),
    },
    "tokenizer_file": {
        "facebook/dpr-ctx_encoder-single-nq-base": (
            "https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resolve/main/tokenizer.json"
        ),
        "facebook/dpr-ctx_encoder-multiset-base": (
            "https://huggingface.co/facebook/dpr-ctx_encoder-multiset-base/resolve/main/tokenizer.json"
        ),
    },
}
_a   :	List[Any] 							=   {
    "vocab_file": {
        "facebook/dpr-question_encoder-single-nq-base": (
            "https://huggingface.co/facebook/dpr-question_encoder-single-nq-base/resolve/main/vocab.txt"
        ),
        "facebook/dpr-question_encoder-multiset-base": (
            "https://huggingface.co/facebook/dpr-question_encoder-multiset-base/resolve/main/vocab.txt"
        ),
    },
    "tokenizer_file": {
        "facebook/dpr-question_encoder-single-nq-base": (
            "https://huggingface.co/facebook/dpr-question_encoder-single-nq-base/resolve/main/tokenizer.json"
        ),
        "facebook/dpr-question_encoder-multiset-base": (
            "https://huggingface.co/facebook/dpr-question_encoder-multiset-base/resolve/main/tokenizer.json"
        ),
    },
}
_a   :	List[Any] 							=   {
    "vocab_file": {
        "facebook/dpr-reader-single-nq-base": (
            "https://huggingface.co/facebook/dpr-reader-single-nq-base/resolve/main/vocab.txt"
        ),
        "facebook/dpr-reader-multiset-base": (
            "https://huggingface.co/facebook/dpr-reader-multiset-base/resolve/main/vocab.txt"
        ),
    },
    "tokenizer_file": {
        "facebook/dpr-reader-single-nq-base": (
            "https://huggingface.co/facebook/dpr-reader-single-nq-base/resolve/main/tokenizer.json"
        ),
        "facebook/dpr-reader-multiset-base": (
            "https://huggingface.co/facebook/dpr-reader-multiset-base/resolve/main/tokenizer.json"
        ),
    },
}

_a   :	List[str] 							=   {
    "facebook/dpr-ctx_encoder-single-nq-base": 512,
    "facebook/dpr-ctx_encoder-multiset-base": 512,
}
_a   :	List[Any] 							=   {
    "facebook/dpr-question_encoder-single-nq-base": 512,
    "facebook/dpr-question_encoder-multiset-base": 512,
}
_a   :	int 							=   {
    "facebook/dpr-reader-single-nq-base": 512,
    "facebook/dpr-reader-multiset-base": 512,
}


_a   :	Dict 							=   {
    "facebook/dpr-ctx_encoder-single-nq-base": {"do_lower_case": True},
    "facebook/dpr-ctx_encoder-multiset-base": {"do_lower_case": True},
}
_a   :	str 							=   {
    "facebook/dpr-question_encoder-single-nq-base": {"do_lower_case": True},
    "facebook/dpr-question_encoder-multiset-base": {"do_lower_case": True},
}
_a   :	int 							=   {
    "facebook/dpr-reader-single-nq-base": {"do_lower_case": True},
    "facebook/dpr-reader-multiset-base": {"do_lower_case": True},
}






class 		__A       (lowerCAmelCase__   ):
       snake_case       :Any				    =					VOCAB_FILES_NAMES
       snake_case       :Optional[Any]				    =					CONTEXT_ENCODER_PRETRAINED_VOCAB_FILES_MAP
       snake_case       :List[Any]				    =					CONTEXT_ENCODER_PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
       snake_case       :List[str]				    =					CONTEXT_ENCODER_PRETRAINED_INIT_CONFIGURATION






class 		__A       (lowerCAmelCase__   ):
       snake_case       :str				    =					VOCAB_FILES_NAMES
       snake_case       :List[str]				    =					QUESTION_ENCODER_PRETRAINED_VOCAB_FILES_MAP
       snake_case       :Any				    =					QUESTION_ENCODER_PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
       snake_case       :List[Any]				    =					QUESTION_ENCODER_PRETRAINED_INIT_CONFIGURATION





_a   :	Union[str, Any] 							=   collections.namedtuple(
    "DPRSpanPrediction", ["span_score", "relevance_score", "doc_id", "start_index", "end_index", "text"]
)

_a   :	Dict 							=   collections.namedtuple("DPRReaderOutput", ["start_logits", "end_logits", "relevance_logits"])


_a   :	Dict 							=   R"\n    Return a dictionary with the token ids of the input strings and other information to give to `.decode_best_spans`.\n    It converts the strings of a question and different passages (title and text) in a sequence of IDs (integers),\n    using the tokenizer and vocabulary. The resulting `input_ids` is a matrix of size `(n_passages, sequence_length)`\n    with the format:\n\n    ```\n    [CLS] <question token ids> [SEP] <titles ids> [SEP] <texts ids>\n    ```\n\n    Args:\n        questions (`str` or `List[str]`):\n            The questions to be encoded. You can specify one question for many passages. In this case, the question\n            will be duplicated like `[questions] * n_passages`. Otherwise you have to specify as many questions as in\n            `titles` or `texts`.\n        titles (`str` or `List[str]`):\n            The passages titles to be encoded. This can be a string or a list of strings if there are several passages.\n        texts (`str` or `List[str]`):\n            The passages texts to be encoded. This can be a string or a list of strings if there are several passages.\n        padding (`bool`, `str` or [`~utils.PaddingStrategy`], *optional*, defaults to `False`):\n            Activates and controls padding. Accepts the following values:\n\n            - `True` or `\'longest\'`: Pad to the longest sequence in the batch (or no padding if only a single sequence\n              if provided).\n            - `\'max_length\'`: Pad to a maximum length specified with the argument `max_length` or to the maximum\n              acceptable input length for the model if that argument is not provided.\n            - `False` or `\'do_not_pad\'` (default): No padding (i.e., can output a batch with sequences of different\n              lengths).\n        truncation (`bool`, `str` or [`~tokenization_utils_base.TruncationStrategy`], *optional*, defaults to `False`):\n            Activates and controls truncation. Accepts the following values:\n\n            - `True` or `\'longest_first\'`: Truncate to a maximum length specified with the argument `max_length` or to\n              the maximum acceptable input length for the model if that argument is not provided. This will truncate\n              token by token, removing a token from the longest sequence in the pair if a pair of sequences (or a batch\n              of pairs) is provided.\n            - `\'only_first\'`: Truncate to a maximum length specified with the argument `max_length` or to the maximum\n              acceptable input length for the model if that argument is not provided. This will only truncate the first\n              sequence of a pair if a pair of sequences (or a batch of pairs) is provided.\n            - `\'only_second\'`: Truncate to a maximum length specified with the argument `max_length` or to the maximum\n              acceptable input length for the model if that argument is not provided. This will only truncate the\n              second sequence of a pair if a pair of sequences (or a batch of pairs) is provided.\n            - `False` or `\'do_not_truncate\'` (default): No truncation (i.e., can output batch with sequence lengths\n              greater than the model maximum admissible input size).\n        max_length (`int`, *optional*):\n                Controls the maximum length to use by one of the truncation/padding parameters.\n\n                If left unset or set to `None`, this will use the predefined model maximum length if a maximum length\n                is required by one of the truncation/padding parameters. If the model has no specific maximum input\n                length (like XLNet) truncation/padding to a maximum length will be deactivated.\n        return_tensors (`str` or [`~utils.TensorType`], *optional*):\n                If set, will return tensors instead of list of python integers. Acceptable values are:\n\n                - `\'tf\'`: Return TensorFlow `tf.constant` objects.\n                - `\'pt\'`: Return PyTorch `torch.Tensor` objects.\n                - `\'np\'`: Return Numpy `np.ndarray` objects.\n        return_attention_mask (`bool`, *optional*):\n            Whether or not to return the attention mask. If not set, will return the attention mask according to the\n            specific tokenizer\'s default, defined by the `return_outputs` attribute.\n\n            [What are attention masks?](../glossary#attention-mask)\n\n    Returns:\n        `Dict[str, List[List[int]]]`: A dictionary with the following keys:\n\n        - `input_ids`: List of token ids to be fed to a model.\n        - `attention_mask`: List of indices specifying which tokens should be attended to by the model.\n    "






@add_start_docstrings(lowerCAmelCase__   )
class 		__A       :






       def __call__(      self				,     UpperCamelCase_				,     UpperCamelCase_ = None				,     UpperCamelCase_ = None				,     UpperCamelCase_ = False				,     UpperCamelCase_ = False				,     UpperCamelCase_ = None				,     UpperCamelCase_ = None				,     UpperCamelCase_ = None				,     **UpperCamelCase_				,     ):





              if titles is None and texts is None:
                     return super().__call__(
                         _lowerCamelCase				,     padding=_lowerCamelCase				,     truncation=_lowerCamelCase				,     max_length=_lowerCamelCase				,     return_tensors=_lowerCamelCase				,     return_attention_mask=_lowerCamelCase				,     **_lowerCamelCase				,     )
              elif titles is None or texts is None:
                     __UpperCAmelCase  :				str       				=		titles if texts is None else texts
                     return super().__call__(
                         _lowerCamelCase				,     _lowerCamelCase				,     padding=_lowerCamelCase				,     truncation=_lowerCamelCase				,     max_length=_lowerCamelCase				,     return_tensors=_lowerCamelCase				,     return_attention_mask=_lowerCamelCase				,     **_lowerCamelCase				,     )
              __UpperCAmelCase  :				Optional[Any]       				=		titles if not isinstance(_lowerCamelCase				,     _lowerCamelCase      ) else [titles]
              __UpperCAmelCase  :				Optional[Any]       				=		texts if not isinstance(_lowerCamelCase				,     _lowerCamelCase      ) else [texts]
              __UpperCAmelCase  :				Any       				=		len(_lowerCamelCase      )
              __UpperCAmelCase  :				List[Any]       				=		questions if not isinstance(_lowerCamelCase				,     _lowerCamelCase      ) else [questions] * n_passages
              if len(_lowerCamelCase      ) != len(_lowerCamelCase      ):
                     raise ValueError(
                         f"""There should be as many titles than texts but got {len(_lowerCamelCase      )} titles and {len(_lowerCamelCase      )} texts."""      )
              __UpperCAmelCase  :				Optional[int]       				=		super().__call__(_lowerCamelCase				,     _lowerCamelCase				,     padding=_lowerCamelCase				,     truncation=_lowerCamelCase      )["input_ids"]
              __UpperCAmelCase  :				int       				=		super().__call__(_lowerCamelCase				,     add_special_tokens=_lowerCamelCase				,     padding=_lowerCamelCase				,     truncation=_lowerCamelCase      )["input_ids"]
              __UpperCAmelCase  :				Any       				=		{
                  "input_ids": [
                      (encoded_question_and_title + encoded_text)[:max_length]
                      if max_length is not None and truncation
                      else encoded_question_and_title + encoded_text
                      for encoded_question_and_title, encoded_text in zip(_lowerCamelCase				,     _lowerCamelCase      )
                  ]
              }
              if return_attention_mask is not False:
                     __UpperCAmelCase  :				Dict       				=		[]
                     for input_ids in encoded_inputs["input_ids"]:
                            attention_mask.append([int(input_id != self.pad_token_id      ) for input_id in input_ids]      )
                     __UpperCAmelCase  :				Union[str, Any]       				=		attention_mask
              return self.pad(_lowerCamelCase				,     padding=_lowerCamelCase				,     max_length=_lowerCamelCase				,     return_tensors=_lowerCamelCase      )






       def 			_snake_case						(      self				,     UpperCamelCase_				,     UpperCamelCase_				,     UpperCamelCase_ = 16				,     UpperCamelCase_ = 64				,     UpperCamelCase_ = 4				,     ):
              __UpperCAmelCase  :				Any       				=		reader_input["input_ids"]
              __UpperCAmelCase				, __UpperCAmelCase				, __UpperCAmelCase  :				Dict       				=		reader_output[:3]
              __UpperCAmelCase  :				Optional[Any]       				=		len(_lowerCamelCase      )
              __UpperCAmelCase  :				str       				=		sorted(range(_lowerCamelCase      )				,     reverse=_lowerCamelCase				,     key=relevance_logits.__getitem__      )
              __UpperCAmelCase  :				int       				=		[]
              for doc_id in sorted_docs:
                     __UpperCAmelCase  :				Optional[int]       				=		list(input_ids[doc_id]      )
                     # assuming question & title information is at the beginning of the sequence
                     __UpperCAmelCase  :				List[Any]       				=		sequence_ids.index(self.sep_token_id				,     2      ) + 1  # second sep id
                     if sequence_ids[-1] == self.pad_token_id:
                            __UpperCAmelCase  :				Tuple       				=		sequence_ids.index(self.pad_token_id      )
                     else:
                            __UpperCAmelCase  :				str       				=		len(_lowerCamelCase      )

                     __UpperCAmelCase  :				List[str]       				=		self._get_best_spans(
                         start_logits=start_logits[doc_id][passage_offset:sequence_len]				,     end_logits=end_logits[doc_id][passage_offset:sequence_len]				,     max_answer_length=_lowerCamelCase				,     top_spans=_lowerCamelCase				,     )
                     for start_index, end_index in best_spans:
                            start_index += passage_offset
                            end_index += passage_offset
                            nbest_spans_predictions.append(
                                DPRSpanPrediction(
                                    span_score=start_logits[doc_id][start_index] + end_logits[doc_id][end_index]				,     relevance_score=relevance_logits[doc_id]				,     doc_id=_lowerCamelCase				,     start_index=_lowerCamelCase				,     end_index=_lowerCamelCase				,     text=self.decode(sequence_ids[start_index : end_index + 1]      )				,     )      )
                     if len(_lowerCamelCase      ) >= num_spans:
                            break
              return nbest_spans_predictions[:num_spans]







       def 			_snake_case						(      self				,     UpperCamelCase_				,     UpperCamelCase_				,     UpperCamelCase_				,     UpperCamelCase_				,     ):
              __UpperCAmelCase  :				Dict       				=		[]
              for start_index, start_score in enumerate(_lowerCamelCase      ):
                     for answer_length, end_score in enumerate(end_logits[start_index : start_index + max_answer_length]      ):
                            scores.append(((start_index, start_index + answer_length), start_score + end_score)      )
              __UpperCAmelCase  :				str       				=		sorted(_lowerCamelCase				,     key=lambda UpperCamelCase_      : x[1]				,     reverse=_lowerCamelCase      )
              __UpperCAmelCase  :				Any       				=		[]
              for (start_index, end_index), score in scores:
                     if start_index > end_index:
                            raise ValueError(f"""Wrong span indices: [{start_index}:{end_index}]"""      )
                     __UpperCAmelCase  :				Optional[Any]       				=		end_index - start_index + 1
                     if length > max_answer_length:
                            raise ValueError(f"""Span is too long: {length} > {max_answer_length}"""      )
                     if any(
                         start_index <= prev_start_index <= prev_end_index <= end_index
                         or prev_start_index <= start_index <= end_index <= prev_end_index
                         for (prev_start_index, prev_end_index) in chosen_span_intervals      ):
                            continue
                     chosen_span_intervals.append((start_index, end_index)      )

                     if len(_lowerCamelCase      ) == top_spans:
                            break
              return chosen_span_intervals






@add_end_docstrings(lowerCAmelCase__   )
class 		__A       (lowerCAmelCase__ ,					lowerCAmelCase__   ):
       snake_case       :Tuple				    =					VOCAB_FILES_NAMES
       snake_case       :List[str]				    =					READER_PRETRAINED_VOCAB_FILES_MAP
       snake_case       :Optional[int]				    =					READER_PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
       snake_case       :Union[str, Any]				    =					READER_PRETRAINED_INIT_CONFIGURATION
       snake_case       :int				    =					["input_ids", "attention_mask"]







'''simple docstring'''




import random

import torch
from huggingface_hub import HfApi

from diffusers import UNetaDModel


_a   :	Union[str, Any] 							=   HfApi()

_a   :	int 							=   {}
# fmt: off
_a   :	Optional[int] 							=   torch.tensor([
    -0.7_515, -1.6_883, 0.2_420, 0.0_300, 0.6_347, 1.3_433, -1.1_743, -3.7_467,
    1.2_342, -2.2_485, 0.4_636, 0.8_076, -0.7_991, 0.3_969, 0.8_498, 0.9_189,
    -1.8_887, -3.3_522, 0.7_639, 0.2_040, 0.6_271, -2.7_148, -1.6_316, 3.0_839,
    0.3_186, 0.2_721, -0.9_759, -1.2_461, 2.6_257, 1.3_557
])
_a   :	Optional[Any] 							=   torch.tensor([
    -2.3_639, -2.5_344, 0.0_054, -0.6_674, 1.5_990, 1.0_158, 0.3_124, -2.1_436,
    1.8_795, -2.5_429, -0.1_566, -0.3_973, 1.2_490, 2.6_447, 1.2_283, -0.5_208,
    -2.8_154, -3.5_119, 2.3_838, 1.2_033, 1.7_201, -2.1_256, -1.4_576, 2.7_948,
    2.4_204, -0.9_752, -1.2_546, 0.8_027, 3.2_758, 3.1_365
])
_a   :	int 							=   torch.tensor([
    -0.6_531, -0.6_891, -0.3_172, -0.5_375, -0.9_140, -0.5_367, -0.1_175, -0.7_869,
    -0.3_808, -0.4_513, -0.2_098, -0.0_083, 0.3_183, 0.5_140, 0.2_247, -0.1_304,
    -0.1_302, -0.2_802, -0.2_084, -0.2_025, -0.4_967, -0.4_873, -0.0_861, 0.6_925,
    0.0_250, 0.1_290, -0.1_543, 0.6_316, 1.0_460, 1.4_943
])
_a   :	str 							=   torch.tensor([
    0.0_911, 0.1_107, 0.0_182, 0.0_435, -0.0_805, -0.0_608, 0.0_381, 0.2_172,
    -0.0_280, 0.1_327, -0.0_299, -0.0_255, -0.0_050, -0.1_170, -0.1_046, 0.0_309,
    0.1_367, 0.1_728, -0.0_533, -0.0_748, -0.0_534, 0.1_624, 0.0_384, -0.1_805,
    -0.0_707, 0.0_642, 0.0_220, -0.0_134, -0.1_333, -0.1_505
])
_a   :	Union[str, Any] 							=   torch.tensor([
    0.1_321, 0.1_337, 0.0_440, 0.0_622, -0.0_591, -0.0_370, 0.0_503, 0.2_133,
    -0.0_177, 0.1_415, -0.0_116, -0.0_112, 0.0_044, -0.0_980, -0.0_789, 0.0_395,
    0.1_502, 0.1_785, -0.0_488, -0.0_514, -0.0_404, 0.1_539, 0.0_454, -0.1_559,
    -0.0_665, 0.0_659, 0.0_383, -0.0_005, -0.1_266, -0.1_386
])
_a   :	Any 							=   torch.tensor([
    0.1_154, 0.1_218, 0.0_307, 0.0_526, -0.0_711, -0.0_541, 0.0_366, 0.2_078,
    -0.0_267, 0.1_317, -0.0_226, -0.0_193, -0.0_014, -0.1_055, -0.0_902, 0.0_330,
    0.1_391, 0.1_709, -0.0_562, -0.0_693, -0.0_560, 0.1_482, 0.0_381, -0.1_683,
    -0.0_681, 0.0_661, 0.0_331, -0.0_046, -0.1_268, -0.1_431
])
_a   :	List[Any] 							=   torch.tensor([
    0.1_192, 0.1_240, 0.0_414, 0.0_606, -0.0_557, -0.0_412, 0.0_430, 0.2_042,
    -0.0_200, 0.1_385, -0.0_115, -0.0_132, 0.0_017, -0.0_965, -0.0_802, 0.0_398,
    0.1_433, 0.1_747, -0.0_458, -0.0_533, -0.0_407, 0.1_545, 0.0_419, -0.1_574,
    -0.0_645, 0.0_626, 0.0_341, -0.0_010, -0.1_199, -0.1_390
])
_a   :	Optional[int] 							=   torch.tensor([
    0.1_075, 0.1_074, 0.0_205, 0.0_431, -0.0_774, -0.0_607, 0.0_298, 0.2_042,
    -0.0_320, 0.1_267, -0.0_281, -0.0_250, -0.0_064, -0.1_091, -0.0_946, 0.0_290,
    0.1_328, 0.1_650, -0.0_580, -0.0_738, -0.0_586, 0.1_440, 0.0_337, -0.1_746,
    -0.0_712, 0.0_605, 0.0_250, -0.0_099, -0.1_316, -0.1_473
])
_a   :	Tuple 							=   torch.tensor([
    -1.4_572, -2.0_481, -0.0_414, -0.6_005, 1.4_136, 0.5_848, 0.4_028, -2.7_330,
    1.2_212, -2.1_228, 0.2_155, 0.4_039, 0.7_662, 2.0_535, 0.7_477, -0.3_243,
    -2.1_758, -2.7_648, 1.6_947, 0.7_026, 1.2_338, -1.6_078, -0.8_682, 2.2_810,
    1.8_574, -0.5_718, -0.5_586, -0.0_186, 2.3_415, 2.1_251])
_a   :	List[Any] 							=   torch.tensor([
    -1.3_690, -1.9_720, -0.4_090, -0.6_966, 1.4_660, 0.9_938, -0.1_385, -2.7_324,
    0.7_736, -1.8_917, 0.2_923, 0.4_293, 0.1_693, 1.4_112, 1.1_887, -0.3_181,
    -2.2_160, -2.6_381, 1.3_170, 0.8_163, 0.9_240, -1.6_544, -0.6_099, 2.5_259,
    1.6_430, -0.9_090, -0.9_392, -0.0_126, 2.4_268, 2.3_266
])
_a   :	Optional[Any] 							=   torch.tensor([
    -1.3_525, -1.9_628, -0.3_956, -0.6_860, 1.4_664, 1.0_014, -0.1_259, -2.7_212,
    0.7_772, -1.8_811, 0.2_996, 0.4_388, 0.1_704, 1.4_029, 1.1_701, -0.3_027,
    -2.2_053, -2.6_287, 1.3_350, 0.8_131, 0.9_274, -1.6_292, -0.6_098, 2.5_131,
    1.6_505, -0.8_958, -0.9_298, -0.0_151, 2.4_257, 2.3_355
])
_a   :	Union[str, Any] 							=   torch.tensor([
    -2.0_585, -2.7_897, -0.2_850, -0.8_940, 1.9_052, 0.5_702, 0.6_345, -3.8_959,
    1.5_932, -3.2_319, 0.1_974, 0.0_287, 1.7_566, 2.6_543, 0.8_387, -0.5_351,
    -3.2_736, -4.3_375, 2.9_029, 1.6_390, 1.4_640, -2.1_701, -1.9_013, 2.9_341,
    3.4_981, -0.6_255, -1.1_644, -0.1_591, 3.7_097, 3.2_066
])
_a   :	Optional[int] 							=   torch.tensor([
    -2.3_139, -2.5_594, -0.0_197, -0.6_785, 1.7_001, 1.1_606, 0.3_075, -2.1_740,
    1.8_071, -2.5_630, -0.0_926, -0.3_811, 1.2_116, 2.6_246, 1.2_731, -0.5_398,
    -2.8_153, -3.6_140, 2.3_893, 1.3_262, 1.6_258, -2.1_856, -1.3_267, 2.8_395,
    2.3_779, -1.0_623, -1.2_468, 0.8_959, 3.3_367, 3.2_243
])
_a   :	Union[str, Any] 							=   torch.tensor([
    -2.0_628, -2.7_667, -0.2_089, -0.8_263, 2.0_539, 0.5_992, 0.6_495, -3.8_336,
    1.6_025, -3.2_817, 0.1_721, -0.0_633, 1.7_516, 2.7_039, 0.8_100, -0.5_908,
    -3.2_113, -4.4_343, 2.9_257, 1.3_632, 1.5_562, -2.1_489, -1.9_894, 3.0_560,
    3.3_396, -0.7_328, -1.0_417, 0.0_383, 3.7_093, 3.2_343
])
_a   :	str 							=   torch.tensor([
    -1.4_574, -2.0_569, -0.0_473, -0.6_117, 1.4_018, 0.5_769, 0.4_129, -2.7_344,
    1.2_241, -2.1_397, 0.2_000, 0.3_937, 0.7_616, 2.0_453, 0.7_324, -0.3_391,
    -2.1_746, -2.7_744, 1.6_963, 0.6_921, 1.2_187, -1.6_172, -0.8_877, 2.2_439,
    1.8_471, -0.5_839, -0.5_605, -0.0_464, 2.3_250, 2.1_219
])
# fmt: on

_a   :	Optional[Any] 							=   api.list_models(filter="diffusers")
for mod in models:
   if "google" in mod.author or mod.modelId == "CompVis/ldm-celebahq-256":
      _a   :	List[str] 							=   "/home/patrick/google_checkpoints/" + mod.modelId.split("/")[-1]

      print(f"""Started running {mod.modelId}!!!""")

      if mod.modelId.startswith("CompVis"):
         _a   :	int 							=   UNetaDModel.from_pretrained(local_checkpoint, subfolder="unet")
      else:
         _a   :	Optional[int] 							=   UNetaDModel.from_pretrained(local_checkpoint)

      torch.manual_seed(0)
      random.seed(0)

      _a   :	str 							=   torch.randn(1, model.config.in_channels, model.config.sample_size, model.config.sample_size)
      _a   :	str 							=   torch.tensor([10] * noise.shape[0])
      with torch.no_grad():
         _a   :	str 							=   model(noise, time_step).sample

      assert torch.allclose(
          logits[0, 0, 0, :30], results["_".join("_".join(mod.modelId.split("/")).split("-"))], atol=1e-3
      )
      print(f"""{mod.modelId} has passed successfully!!!""")






