Skip to content

Model Upload Failed when EMA activated in model #250

@gurbain

Description

@gurbain

Hello,

I'm trying to uplad a custom trained model based on yolov8l on roboflow in order to make my annotating process simpler. I have trained my model using ultralytics v8.2.2.

However, when I try to use the deploy function, I get the following error:

  File "[...]/python3.10/site-packages/roboflow/core/version.py", line 468, in deploy
    if isinstance(model["model"].names, list):
AttributeError: 'NoneType' object has no attribute 'names'

After some research, I realized that my model's weight are saved in model["ema"] and not in model["model"]. I replaced it and it simply like this in the file versions.py:

        elif "yolov5" in model_type or "yolov7" in model_type or "yolov9" in model_type:
            try:
                import torch
            except ImportError:
                raise (
                    "The torch python package is required to deploy yolov5 models."
                    " Please install it with `pip install torch`"
                )

        model = torch.load(os.path.join(model_path, filename))
        model["model"] = model["ema"]

Now, it uploads but I get the following error on the Roboflow platform:

Model Upload Failed
This model upload failed. A failure usually occurs because of an older, incompatible model version or possibly a new type we don't currently have support for.

I can't find how to disable EMA during training. Is there anything I can do to make this work?
Best regards!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions