Skip to content

Yolov9-s and Gelan-S training custom model: Missing attribute 'ELAN1' on <module 'models.common' common.py #659

@NathanHGayle

Description

@NathanHGayle

Using Colab Pro, trying to get around the GPU limits by using smaller models.

%cd {HOME}/yolov9

!python train.py \
--batch 16 --epochs 25 --img 640 --device 0 --min-items 0 --close-mosaic 15 \
--data /content/label_studio_pre_annotating/yolov9/data/coco.yaml \
--weights /content/label_studio_pre_annotating/weights/gelan-s.pt \
--cfg models/detect/gelan-s.yaml \
--hyp hyp.scratch-high.yaml \
--project /content/drive/MyDrive/yolov9_runs \
--name gelan_s_coco \
--noplots

This returns:

/content/label_studio_pre_annotating/yolov9/train.py:108: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  ckpt = torch.load(weights, map_location='cpu')  # load checkpoint to CPU to avoid CUDA memory leak
Traceback (most recent call last):
  File "/content/label_studio_pre_annotating/yolov9/train.py", line 634, in <module>
    main(opt)
  File "/content/label_studio_pre_annotating/yolov9/train.py", line 528, in main
    train(opt.hyp, opt, device, callbacks)
  File "/content/label_studio_pre_annotating/yolov9/train.py", line 108, in train
    ckpt = torch.load(weights, map_location='cpu')  # load checkpoint to CPU to avoid CUDA memory leak
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/torch/serialization.py", line 1360, in load
    return _load(
           ^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/torch/serialization.py", line 1848, in _load
    result = unpickler.load()
             ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/torch/serialization.py", line 1837, in find_class
    return super().find_class(mod_name, name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: Can't get attribute 'ELAN1' on <module 'models.common' from '/content/label_studio_pre_annotating/yolov9/models/common.py'>

What am I missing here?

Context:
I pip install requirements.txt but hashing out:
# torch==2.5.1
# torchvision==0.20.1
# torchaudio==2.5.1

Then perform:

!pip install torch==2.5.1+cu121 torchvision==0.20.1+cu121 torchaudio==2.5.1+cu121 --index-url https://download.pytorch.org/whl/cu121

This was done to get around some other issues - can't recall off-memory right now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions