YOLOE: Add assert in set_classes to check prompt-free models (#20024)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Laughing 2025-04-05 22:20:08 +08:00 committed by GitHub
parent 40f68b5e03
commit b9ade810c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 4 deletions

View File

@ -86,7 +86,7 @@ Make sure that MLflow logging is enabled in Ultralytics settings. Usually, this
mlflow server --backend-store-uri runs/mlflow
```
This will start a local server at http://127.0.0.1:5000 by default and save all mlflow logs to the 'runs/mlflow' directory. To specify a different URI, set the `MLFLOW_TRACKING_URI` environment variable.
This will start a local server at `http://127.0.0.1:5000` by default and save all mlflow logs to the 'runs/mlflow' directory. To specify a different URI, set the `MLFLOW_TRACKING_URI` environment variable.
4. **Kill MLflow Server Instances**: To stop all running MLflow instances, run:
@ -102,7 +102,7 @@ The logging is taken care of by the `on_pretrain_routine_end`, `on_fit_epoch_end
1. **Logging Custom Metrics**: You can add custom metrics to be logged by modifying the `trainer.metrics` dictionary before `on_fit_epoch_end` is called.
2. **View Experiment**: To view your logs, navigate to your MLflow server (usually http://127.0.0.1:5000) and select your experiment and run. <img width="1024" src="https://github.com/ultralytics/docs/releases/download/0/yolo-mlflow-experiment.avif" alt="YOLO MLflow Experiment">
2. **View Experiment**: To view your logs, navigate to your MLflow server (usually `http://127.0.0.1:5000`) and select your experiment and run. <img width="1024" src="https://github.com/ultralytics/docs/releases/download/0/yolo-mlflow-experiment.avif" alt="YOLO MLflow Experiment">
3. **View Run**: Runs are individual models inside an experiment. Click on a Run and see the Run details, including uploaded artifacts and model weights. <img width="1024" src="https://github.com/ultralytics/docs/releases/download/0/yolo-mlflow-run.avif" alt="YOLO MLflow Run">
@ -188,7 +188,7 @@ To start an MLflow server for tracking your experiments in Ultralytics YOLO, use
mlflow server --backend-store-uri runs/mlflow
```
This command starts a local server at http://127.0.0.1:5000 by default. If you need to stop running MLflow server instances, use the following bash command:
This command starts a local server at `http://127.0.0.1:5000` by default. If you need to stop running MLflow server instances, use the following bash command:
```bash
ps aux | grep 'mlflow' | grep -v 'grep' | awk '{print $2}' | xargs kill -9

View File

@ -260,7 +260,7 @@ To use TensorBoard in [Google Colab](https://colab.research.google.com/github/ul
tensorboard --logdir ultralytics/runs # replace with 'runs' directory
```
To use TensorBoard locally run the below command and view results at <http://localhost:6006/>.
To use TensorBoard locally run the below command and view results at `http://localhost:6006/`.
!!! example

View File

@ -912,6 +912,9 @@ class YOLOEModel(DetectionModel):
names (List[str]): List of class names.
embeddings (torch.Tensor): Embeddings tensor.
"""
assert not hasattr(self.model[-1], "lrpc"), (
"Prompt-free model does not support setting classes. Please try with Text/Visual prompt models."
)
assert embeddings.ndim == 3
self.pe = embeddings
self.model[-1].nc = len(names)