[Bug] Official Nemotron example broken
Author: Davidnet
Pull request: no
Labels: name: bug

### System Info

transformers env fails with:
NameError: name 'CompletionCreateParamsStreaming' is not defined

but my pyproject if fairly simple (and python and cuda and packages are in here):

```
[project]
name = "nemotron-explorations"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
    "torch>=2.12.0",
    "torchvision>=0.27.0",
    "transformers==5.10.2",
    "mamba-ssm[causal-conv1d]",
]

[tool.uv.sources]
torch = { index = "pytorch-cu126" }
torchvision = { index = "pytorch-cu126" }

[tool.uv]
no-build-isolation-package = ["mamba-ssm"]

[[tool.uv.index]]
name = "pytorch-cu126"
url = "https://download.pytorch.org/whl/cu126"
explicit = true
```

### Who can help?

@suhara @ArthurZucker 

### Information

- [x] The official example scripts
- [ ] My own modified scripts

### Tasks

- [x] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

Consider:

```
from transformers import pipeline

pipe = pipeline("text-generation", model="nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16", trust_remote_code=True)
messages = [
    {"role": "user", "content": "Who are you?"},
]
pipe(messages)
```


then the traceback:

```
(nemotron-explorations) shadeform@brev-i10j30gd7:/ephemeral/projects/nemotron-explorations$ python main.py
Loading weights: 100%|██████████████████████████████████████████████████████████| 6243/6243 [00:01<00:00, 6110.90it/s]
[transformers] Both `max_new_tokens` (=256) and `max_length`(=20) seem to have been set. `max_new_tokens` will take precedence. Please refer to the documentation for more information. (https://huggingface.co/docs/transformers/main/en/main_classes/text_generation)
Traceback (most recent call last):
  File "/ephemeral/projects/nemotron-explorations/main.py", line 7, in <module>
    pipe(messages)
  File "/ephemeral/projects/nemotron-explorations/.venv/lib/python3.12/site-packages/transformers/pipelines/text_generation.py", line 299, in __call__
    return super().__call__(text_inputs, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ephemeral/projects/nemotron-explorations/.venv/lib/python3.12/site-packages/transformers/pipelines/base.py", line 1266, in __call__
    return self.run_single(inputs, preprocess_params, forward_params, postprocess_params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ephemeral/projects/nemotron-explorations/.venv/lib/python3.12/site-packages/transformers/pipelines/base.py", line 1273, in run_single
    model_outputs = self.forward(model_inputs, **forward_params)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ephemeral/projects/nemotron-explorations/.venv/lib/python3.12/site-packages/transformers/pipelines/base.py", line 1165, in forward
    model_outputs = self._forward(model_inputs, **forward_params)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ephemeral/projects/nemotron-explorations/.venv/lib/python3.12/site-packages/transformers/pipelines/text_generation.py", line 403, in _forward
    output = self.model.generate(input_ids=input_ids, attention_mask=attention_mask, **generate_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ephemeral/projects/nemotron-explorations/.venv/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 124, in decorate_context
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/ephemeral/projects/nemotron-explorations/.venv/lib/python3.12/site-packages/transformers/generation/utils.py", line 2582, in generate
    result = decoding_method(
             ^^^^^^^^^^^^^^^^
  File "/ephemeral/projects/nemotron-explorations/.venv/lib/python3.12/site-packages/transformers/generation/utils.py", line 2782, in _sample
    outputs = self._prefill(
              ^^^^^^^^^^^^^^
  File "/ephemeral/projects/nemotron-explorations/.venv/lib/python3.12/site-packages/transformers/generation/utils.py", line 3822, in _prefill
    model_inputs = self.prepare_inputs_for_generation(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ephemeral/models/hf/modules/transformers_modules/nvidia/NVIDIA_hyphen_Nemotron_hyphen_3_hyphen_Nano_hyphen_30B_hyphen_A3B_hyphen_BF16/cbd3fa9f933d55ef16a84236559f4ee2a0526848/modeling_nemotron_h.py", line 1633, in prepare_inputs_for_generation
    or cache_position[-1] >= input_ids.shape[1]  # Exception 3
       ~~~~~~~~~~~~~~^^^^
TypeError: 'NoneType' object is not subscriptable
``` 

### Expected behavior

text generation

Comments:
The `transformers env` `NameError: name 'CompletionCreateParamsStreaming' is not defined` part of this report is a real regression: `cli/serving/server.py` imports the chat/completion/response/transcription handlers unconditionally, but those modules reference `openai.types` symbols that are only imported under `if is_serve_available():` — so the whole CLI breaks when the `serve` extra isn't installed. Opened #46473 to fix it (lazy/guarded handler imports).

Note the `TypeError: 'NoneType' object is not subscriptable` in your main traceback comes from the model's remote `modeling_nemotron_h.py` (`trust_remote_code`), which lives in the model repo rather than transformers, so that part isn't addressed here.

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.

I think now the only remaining issue is in the remote code, and the fact that the model card on the Hub puts `trust_remote_code=True` in its examples. There's a native port now, so if someone wants to make a PR to the Hub repo to remove `trust_remote_code`, feel free!