roboflow-python icon indicating copy to clipboard operation
roboflow-python copied to clipboard

Model Upload Failed when EMA activated in model

Open gurbain opened this issue 1 year ago • 2 comments

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!

gurbain avatar Apr 22 '24 16:04 gurbain

Any updates on that matter?

gkarantai avatar Jan 08 '25 10:01 gkarantai

Same issue

plannaAlain avatar Mar 21 '25 15:03 plannaAlain