from transformers import AutoModelForCausalLM, GenerationConfig
model = AutoModelForCausalLM.from_pretrained("my_account/my_model")  # doctest: +SKIP
generation_config = GenerationConfig(
     max_new_tokens=50, do_sample=True, top_k=50, eos_token_id=model.config.eos_token_id
 )
generation_config.save_pretrained("my_account/my_model", push_to_hub=True)  # doctest: +SKIP