



import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import Mock, patch

import diffusers.utils.hub_utils





class    __lowerCAmelCase					(	unittest.TestCase			):




				@patch("""diffusers.utils.hub_utils.get_full_repo_name"""						)
				def 				snake_case  (				self		,							_snake_case						):



									"""simple docstring"""





									_lowerCAmelCase         =       """full_repo_name"""
									with TemporaryDirectory() as tmpdir:
														# Dummy args values
														_lowerCAmelCase         =       Mock()
														_lowerCAmelCase         =       tmpdir
														_lowerCAmelCase         =       0
														_lowerCAmelCase         =       """hub_token"""
														_lowerCAmelCase         =       """dataset_name"""
														_lowerCAmelCase         =       0.01
														_lowerCAmelCase         =       100000
														_lowerCAmelCase         =       10000
														_lowerCAmelCase         =       0.01
														_lowerCAmelCase         =       0.02
														_lowerCAmelCase         =       0.03
														_lowerCAmelCase         =       0.0005
														_lowerCAmelCase         =       0.00_0001
														_lowerCAmelCase         =       1
														_lowerCAmelCase         =       10
														_lowerCAmelCase         =       0.001
														_lowerCAmelCase         =       0.1
														_lowerCAmelCase         =       0.2
														_lowerCAmelCase         =       True

														# Model card mush be rendered and saved
														diffusers.utils.hub_utils.create_model_card(_snake_case		,							model_name="""model_name"""						)
														self.assertTrue((Path(_snake_case						) / """README.md""").is_file()						)











'''simple docstring'''







import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device


if is_torch_available():
  import torch

  from transformers import CamembertModel




@require_torch
@require_sentencepiece
@require_tokenizers
class 					__UpperCAmelCase (		unittest.TestCase	):

      '''simple docstring'''





      @slow
      def 							lowerCamelCase     (					self						):
             UpperCAmelCase__	:   Optional[int]												=	CamembertModel.from_pretrained('''camembert-base'''						)
             model.to(_UpperCAmelCase						)

             UpperCAmelCase__	:   Optional[int]												=	torch.tensor(
                 [[5, 121, 11, 660, 16, 730, 2_5543, 110, 83, 6]]  ,		device=_UpperCAmelCase  ,		dtype=torch.long  ,		)  # J'aime le camembert !
             with torch.no_grad():
                    UpperCAmelCase__	:   Tuple												=	model(_UpperCAmelCase						)['''last_hidden_state''']
             UpperCAmelCase__	:   List[str]												=	torch.Size((1, 10, 768)						)
             self.assertEqual(output.shape  ,		_UpperCAmelCase						)
             # compare the actual values for a slice.
             UpperCAmelCase__	:   List[Any]												=	torch.tensor(
                 [[[-0.02_54, 0.02_35, 0.10_27], [0.06_06, -0.18_11, -0.04_18], [-0.15_61, -0.11_27, 0.26_87]]]  ,		device=_UpperCAmelCase  ,		dtype=torch.float  ,		)
             # camembert = torch.hub.load('pytorch/fairseq', 'camembert.v0')
             # camembert.eval()
             # expected_slice = roberta.model.forward(input_ids)[0][:, :3, :3].detach()

             self.assertTrue(torch.allclose(output[:, :3, :3]  ,		_UpperCAmelCase  ,		atol=1E-4						)						)