roboflow / roboflow/roboflow-python

Model Upload Failed when EMA activated in model

Open
#250 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
629
Forks
140
Avg merge
2d 2h
Merged PRs (30d)
5

Description

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in roboflow/core/version.py at deploy around line 468 and inspect how the checkpoint's model and ema entries are loaded for the reported YOLOv8 v8.2.2 file. Reproduce the upload with the reported checkpoint, then trace the platform's model-format requirements; done means a supported checkpoint uploads and deploys successfully without the NoneType error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.