text: Title: nms=true for exporting to onnx
  Body: ### Search before asking
  
  - [x] I have searched the Ultralytics YOLO [issues](https://github.com/ultralytics/ultralytics/issues) and found no similar bug report.
  
  
  ### Ultralytics YOLO Component
  
  _No response_
  
  ### Bug
  
  
  
  
  i get this error
  
  ```
  (yolo) root@workstation-016:/mnt/4T/Tohidi/object_detector_service# yolo export model=yolo11
  x.pt nms=true format=engine device=3                                                        
  Ultralytics 8.3.71 🚀 Python-3.10.0 torch-2.5.1+cu124 CUDA:3 (NVIDIA H100 PCIe, 80995MiB)   
  YOLO11x summary (fused): 464 layers, 56,919,424 parameters, 0 gradients, 194.9 GFLOPs       
  Traceback (most recent call last):                                                          
    File "/opt/anaconda3/envs/yolo/bin/yolo", line 8, in <module>                             
      sys.exit(entrypoint())                                                                  
    File "/opt/anaconda3/envs/yolo/lib/python3.10/site-packages/ultralytics/cfg/__init__.py", 
  line 986, in entrypoint                                                                     
      getattr(model, mode)(**overrides)  # default args from model                            
    File "/opt/anaconda3/envs/yolo/lib/python3.10/site-packages/ultralytics/engine/model.py", 
  line 740, in export                                                                         
      return Exporter(overrides=args, _callbacks=self.callbacks)(model=self.model)            
    File "/opt/anaconda3/envs/yolo/lib/python3.10/site-packages/ultralytics/engine/exporter.py
  ", line 354, in __call__                                                                    
      y = NMSModel(model, self.args)(im) if self.args.nms and not coreml else model(im)       
    File "/opt/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/nn/modules/module.py", l
  ine 1736, in _wrapped_call_impl                                                             
      return self._call_impl(*args, **kwargs)                                                 
    File "/opt/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/nn/modules/module.py", l
  ine 1747, in _call_impl                                                                     
      return forward_call(*args, **kwargs)                                                    
    File "/opt/anaconda3/envs/yolo/lib/python3.10/site-packages/ultralytics/engine/exporter.py
  ", line 1559, in forward                                                                    
      extra_shape = pred.shape[-1] - (4 + self.model.nc)  # extras from Segment, OBB, Pose    
    File "/opt/anaconda3/envs/yolo/lib/python3.10/site-packages/torch/nn/modules/module.py", l
  ine 1931, in __getattr__                                                                    
      raise AttributeError(                                                                   
  AttributeError: 'DetectionModel' object has no attribute 'nc'                               
  ```
  
  ****
  
  ### Environment
  
  ```
  Ultralytics 8.3.71 🚀 Python-3.10.0 torch-2.5.1+cu124 CUDA:0 (NVIDIA H100 80GB HBM3, 80995MiB)    
  Setup complete ✅ (255 CPUs, 1007.7 GB RAM, 1807.6/1831.2 GB disk)                                
                                                                                                    
  OS                  Linux-5.15.0-131-generic-x86_64-with-glibc2.35                                
  Environment         Linux                                                                         
  Python              3.10.0                                                                        
  Install             pip                                                                           
  RAM                 1007.65 GB                                                                    
  Disk                1807.6/1831.2 GB                                                              
  CPU                 AMD EPYC 7773X 64-Core Processor                                              
  CPU count           255                                                                           
  GPU                 NVIDIA H100 80GB HBM3, 80995MiB                                               
  GPU count           6                                                                             
  CUDA                12.4                                                                          
                                                                                                    
  numpy               ✅ 1.26.4<=2.1.1,>=1.23.0                                                     
  matplotlib          ✅ 3.10.0>=3.3.0                                                              
  opencv-python       ✅ 4.11.0.86>=4.6.0                                                           
  pillow              ✅ 11.1.0>=7.1.2                                                              
  pyyaml              ✅ 6.0.2>=5.3.1                                                               
  requests            ✅ 2.32.3>=2.23.0                                                             
  scipy               ✅ 1.15.1>=1.4.1                                                              
  torch               ✅ 2.5.1>=1.8.0                                                               
  torch               ✅ 2.5.1!=2.4.0,>=1.8.0; sys_platform == "win32"                              
  torchvision         ✅ 0.20.1>=0.9.0                                                              
  tqdm                ✅ 4.67.1>=4.64.0                                                             
  psutil              ✅ 6.1.1                                                                      
  py-cpuinfo          ✅ 9.0.0                                                                      
  pandas              ✅ 2.0.3>=1.1.4                                                               
  seaborn             ✅ 0.13.2>=0.11.0                                                             
  ultralytics-thop    ✅ 2.0.14>=2.0.0                                                              
  
  ```
  
  ### Minimal Reproducible Example
  
  ```
  yolo export model=yolo11x.pt format=engine device=3 nms=true
  ```
  
  ### Additional
  
  _No response_
  
  ### Are you willing to submit a PR?
  
  - [ ] Yes I'd like to help by submitting a PR!