code: 
  
  
  
  
  
  import argparse
  
  from transformers import CanineConfig, CanineModel, CanineTokenizer, load_tf_weights_in_canine
  from transformers.utils import logging
  
  
  logging.set_verbosity_info()
  
  
  def 		_SCREAMING_SNAKE_CASE    (   lowerCAmelCase__       ,lowerCAmelCase__	):
  		# Initialize PyTorch model
  		lowerCamelCase_  :    Any   	=			CanineConfig()
  		lowerCamelCase_  :    Tuple   	=			CanineModel(lowerCAmelCase__	)
  		model.eval()
  
  		print(F"Building PyTorch model from configuration: {config}"	)
  
  		# Load weights from tf checkpoint
  		load_tf_weights_in_canine(lowerCAmelCase__       ,lowerCAmelCase__       ,lowerCAmelCase__	)
  
  		# Save pytorch-model (weights and configuration)
  		print(F"Save PyTorch model to {pytorch_dump_path}"	)
  		model.save_pretrained(lowerCAmelCase__	)
  
  		# Save tokenizer files
  		lowerCamelCase_  :    Dict   	=			CanineTokenizer()
  		print(F"Save tokenizer files to {pytorch_dump_path}"	)
  		tokenizer.save_pretrained(lowerCAmelCase__	)
  
  
  if __name__ == "__main__":
  		_lowercase		:     Any 					=argparse.ArgumentParser()
  		# Required parameters
  		parser.add_argument(
  		    """--tf_checkpoint_path""",
  		    default=None,
  		    type=str,
  		    required=True,
  		    help="""Path to the TensorFlow checkpoint. Should end with model.ckpt""",
  		)
  		parser.add_argument(
  		    """--pytorch_dump_path""",
  		    default=None,
  		    type=str,
  		    required=True,
  		    help="""Path to a folder where the PyTorch model will be placed.""",
  		)
  		_lowercase		:     Optional[int] 					=parser.parse_args()
  		convert_tf_checkpoint_to_pytorch(args.tf_checkpoint_path, args.pytorch_dump_path)
  
style_context: 
  
  
  
  
  
  import os
  import unittest
  
  import pytest
  from parameterized import parameterized
  
  from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device
  
  
  # skipping in unittest tests
  
  _lowercase		:     Optional[Any] 					=[(1,)]
  
  
  def 		_SCREAMING_SNAKE_CASE    (   ):
  		lowerCamelCase_  :    Union[str, Any]   	=			bool(os.getenv('RUN_SLOW'       ,0	)	)
  		if run_slow:
  				assert True
  		else:
  				assert False, "should have been skipped"
  
  
  def 		_SCREAMING_SNAKE_CASE    (   ):
  		lowerCamelCase_  :    List[str]   	=			bool(os.getenv('RUN_SLOW'       ,0	)	)
  		if run_slow and torch_device == "cuda":
  				assert True
  		else:
  				assert False, "should have been skipped"
  
  
  
  
  
  
  @require_torch
  class 	UpperCamelCase_     (     unittest.TestCase       ):
  
  
  
  					@slow
  					@require_torch_gpu
  					def      __a    (		self    :    Tuple	):
  							check_slow_torch_cuda()
  
  
  
  					@require_torch_gpu
  					@slow
  					def      __a    (		self    :    Optional[int]	):
  							check_slow_torch_cuda()
  
  
  
  
  
  					@parameterized.expand(lowerCamelCase	)
  					@slow
  					def      __a    (		self    :    List[str]					,			lowerCamelCase    :    Optional[Any]=None	):
  							check_slow()
  
  
  @slow
  @require_torch_gpu
  def 		_SCREAMING_SNAKE_CASE    (   ):
  		check_slow_torch_cuda()
  
  
  @require_torch_gpu
  @slow
  def 		_SCREAMING_SNAKE_CASE    (   ):
  		check_slow_torch_cuda()
  
  
  @slow
  @pytest.mark.parametrize('param'       ,[1]	)
  def 		_SCREAMING_SNAKE_CASE    (   lowerCAmelCase__	):
  		check_slow()
  
  
  
  
  
  @pytest.mark.parametrize('param'       ,[1]	)
  @slow
  def 		_SCREAMING_SNAKE_CASE    (   lowerCAmelCase__	):
  		check_slow()
  