docstr: Tests that we can overwrite attributes at `from_pretrained` time.
docstr_tok: ["Tests","that","we","can","overwrite","attributes","at","`","from_pretrained","`","time","."]
code: def test_kwarg_init(self):
      """Tests that we can overwrite attributes at `from_pretrained` time."""
      default_config = GenerationConfig()
      self.assertEqual(default_config.temperature, 1.0)
      self.assertEqual(default_config.do_sample, False)
      self.assertEqual(default_config.num_beams, 1)
  
      config = GenerationConfig(
          do_sample=True,
          temperature=0.7,
          length_penalty=1.0,
          bad_words_ids=[[1, 2, 3], [4, 5]],
      )
      self.assertEqual(config.temperature, 0.7)
      self.assertEqual(config.do_sample, True)
      self.assertEqual(config.num_beams, 1)
  
      with tempfile.TemporaryDirectory() as tmp_dir:
          config.save_pretrained(tmp_dir)
          loaded_config = GenerationConfig.from_pretrained(
              tmp_dir, temperature=1.0
          )
  
      self.assertEqual(loaded_config.temperature, 1.0)
      self.assertEqual(loaded_config.do_sample, True)
      self.assertEqual(loaded_config.num_beams, 1)
  
imports: import copy
  import os
  import tempfile
  import unittest
  import warnings
  from huggingface_hub import HfFolder, delete_repo
  from parameterized import parameterized
  from requests.exceptions import HTTPError
  from transformers import AutoConfig, GenerationConfig
  from transformers.testing_utils import TOKEN, USER, is_staging_test
label_desc: Use image node_id 5 for calling the GenerationConfigTest obj's underlying member method code with example usage: obj.test_kwarg_init() without return types