Repository: huggingface/transformers
Pull request: Fix failing `SmolLM3IntegrationTest`

# What does this PR do?
Fixes failing [`SmolLM3IntegrationTest:test_model_3b_long_prompt`](https://github.com/huggingface/transformers/actions/runs/23629638266/job/68826332952#step:14:216). `SmolLM3` has [`do_sample=True` by default](https://huggingface.co/HuggingFaceTB/SmolLM3-3B/blob/main/generation_config.json)

<img width="2374" height="135" alt="image" src="https://github.com/user-attachments/assets/4f18b58b-8747-4541-8598-7c1208936b91" />


## Code Agent Policy

The Transformers repo is currently being overwhelmed by a large number of PRs and issue comments written by
code agents. We are currently bottlenecked by our ability to review and respond to them. As a result, 
**we ask that new users do not submit pure code agent PRs** at this time. 
You may use code agents in drafting or to help you diagnose issues. We'd also ask autonomous "OpenClaw"-like agents
not to open any PRs or issues for the moment.

PRs that appear to be fully agent-written will probably be closed without review, and we may block users who do this
repeatedly or maliciously. 

This is a rapidly-evolving situation that's causing significant shockwaves in the open-source community. As a result, 
this policy is likely to be updated regularly in the near future. For more information, please read [`CONTRIBUTING.md`](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md).

- [x] I confirm that this is not a pure code agent PR.

## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?
@Rocketknight1 @vasqu

Changed files:
filename: tests/models/smollm3/test_modeling_smollm3.py
patch: @@ -100,14 +100,14 @@ def test_model_3b_logits(self):
 
     @slow
     def test_model_3b_generation(self):
-        EXPECTED_TEXT_COMPLETION = """Gravity is the force that pulls objects toward the center of the Earth. It is a force that is always present, even"""
+        EXPECTED_TEXT_COMPLETION = """Gravity is the force that pulls objects toward each other. It is the force that keeps your feet on the ground and makes"""
         prompt = "Gravity is the force"
         tokenizer = AutoTokenizer.from_pretrained(self.model_id)
         model = SmolLM3ForCausalLM.from_pretrained(self.model_id, device_map="auto")
         input_ids = tokenizer.encode(prompt, return_tensors="pt").to(model.model.embed_tokens.weight.device)
 
         # greedy generation outputs
-        generated_ids = model.generate(input_ids, max_new_tokens=20, temperature=0)
+        generated_ids = model.generate(input_ids, max_new_tokens=20, do_sample=False)
         text = tokenizer.decode(generated_ids[0], skip_special_tokens=True)
         self.assertEqual(EXPECTED_TEXT_COMPLETION, text)
 
@@ -130,14 +130,14 @@ def test_model_3b_long_prompt(self):
             attn_implementation="flash_attention_2",
         )
         input_ids = torch.tensor([input_ids]).to(model.model.embed_tokens.weight.device)
-        generated_ids = model.generate(input_ids, max_new_tokens=4, temperature=0)
+        generated_ids = model.generate(input_ids, max_new_tokens=4, do_sample=False)
         self.assertEqual(EXPECTED_OUTPUT_TOKEN_IDS, generated_ids[0][-2:].tolist())
 
         # Assisted generation
         assistant_model = model
         assistant_model.generation_config.num_assistant_tokens = 2
         assistant_model.generation_config.num_assistant_tokens_schedule = "constant"
-        generated_ids = model.generate(input_ids, max_new_tokens=4, temperature=0)
+        generated_ids = model.generate(input_ids, max_new_tokens=4, do_sample=False)
         self.assertEqual(EXPECTED_OUTPUT_TOKEN_IDS, generated_ids[0][-2:].tolist())
 
         del assistant_model