code: 
  
  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    SCREAMING_SNAKE_CASE__      (unittest.TestCase  ):
  
  
  
  
  
      @slow
      def    snake_case_       (   self):
           lowercase__					:     Any   = CamembertModel.from_pretrained('camembert-base')
           model.to(a)
  
           lowercase__					:     Any   = torch.tensor(
               [[5, 121, 11, 660, 16, 730, 2_5543, 110, 83, 6]]		,     device=a		,     dtype=torch.long		,     )  # J'aime le camembert !
           with torch.no_grad():
                lowercase__					:     int   = model(a)['last_hidden_state']
           lowercase__					:     List[Any]   = torch.Size((1, 10, 768))
           self.assertEqual(output.shape		,     a)
           # compare the actual values for a slice.
           lowercase__					:     List[str]   = torch.tensor(
               [[[-0.0_254, 0.0_235, 0.1_027], [0.0_606, -0.1_811, -0.0_418], [-0.1_561, -0.1_127, 0.2_687]]]		,     device=a		,     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]		,     a		,     atol=1e-4))
  
  
style_context: 
  
  from transformers.models.cpm.tokenization_cpm import CpmTokenizer
  from transformers.testing_utils import custom_tokenizers
  
  from ..xlnet.test_modeling_xlnet import XLNetModelTest
  
  
  @custom_tokenizers
  class    SCREAMING_SNAKE_CASE__      (__snake_case  ):
  
  
  
  
  
      def    snake_case_       (   self		,     a		,     a		,     a		,     a		,     a):
           return True
  
  
  
  
  
      def    snake_case_       (   self):
           lowercase__					:     Tuple   = CpmTokenizer.from_pretrained('TsinghuaAI/CPM-Generate')
           lowercase__					:     str   = 'Hugging Face大法好，谁用谁知道。'
           lowercase__					:     Optional[int]   = 'Hugging Face大法好,谁用谁知道。<unk>'
           lowercase__					:     Any   = '▁Hu gg ing ▁ ▂ ▁F ace ▁大法 ▁好 ▁ , ▁谁 ▁用 ▁谁 ▁知 道 ▁ 。'.split()
  
           lowercase__					:     Any   = tokenizer.tokenize(a)
           self.assertListEqual(a		,     a)
  
           lowercase__					:     List[Any]   = tokens + [tokenizer.unk_token]
  
           lowercase__					:     Any   = [1_3789, 1_3283, 1421, 8, 10, 1164, 1_3608, 1_6528, 63, 8, 9, 440, 108, 440, 121, 90, 8, 12, 0]
           self.assertListEqual(tokenizer.convert_tokens_to_ids(a)		,     a)
  
           lowercase__					:     Optional[Any]   = tokenizer.decode(a)
           self.assertEqual(a		,     a)
  
  