Skip to content

Train Network Error - KeyError: 'data' #3095

Closed

Description

@pvarsharavi

Is there an existing issue for this?

  • I have searched the existing issues

Operating System

Windows 11 Pro

DeepLabCut version

3.0.0rc9

What engine are you using?

pytorch

DeepLabCut mode

multi animal

Device type

Intel(R) Core(TM) i9-14900HX (2.20 GHz)

Bug description 🐛

Following a helpful suggestion made by @tlancaster6 to address training failures (#3089 ) by decreasing the initial learning rate in the pytorch_config.yaml, training the network prompted the following error. This error persisted after changing the lr for this project back to its original value (0.0005), and didn't show up when I tested training with another DLC 3.0 project.

Steps To Reproduce

  1. Create a multianimal project on DLC 3.0 and progress up to training the network - as per the setup described in Sudden training failure (High RMSE, NaN RMSE pcutoff, mAP/mAR=0) partway through training network #3089
  2. Training failure, change initial learning rate to 0.0025.
  3. See error.

Relevant log output

Traceback (most recent call last):
  File "C:\Users\itilton\AppData\Local\anaconda3\envs\DEEPLABCUT\lib\site-packages\deeplabcut\gui\tabs\train_network.py", line 244, in train_network
    compat.train_network(config, shuffle, **kwargs)
  File "C:\Users\itilton\AppData\Local\anaconda3\envs\DEEPLABCUT\lib\site-packages\deeplabcut\compat.py", line 287, in train_network
    return train_network(
  File "C:\Users\itilton\AppData\Local\anaconda3\envs\DEEPLABCUT\lib\site-packages\deeplabcut\pose_estimation_pytorch\apis\training.py", line 360, in train_network
    train(
  File "C:\Users\itilton\AppData\Local\anaconda3\envs\DEEPLABCUT\lib\site-packages\deeplabcut\pose_estimation_pytorch\apis\training.py", line 133, in train
    transform = build_transforms(run_config["data"]["train"])
KeyError: 'data'

Anything else?

Thank you for any help or insight into this issue!

Code of Conduct

Activity

  1. maximpavliv commented on Sep 15, 2025

    @maximpavliv
    Contributor

    Hi @pvarsharavi ,

    Can you please send your pytorch_config.yaml?

  2. added
    more-data-requested-by-us
    on Sep 15, 2025
  3. pvarsharavi commented on Sep 16, 2025

    @pvarsharavi
    Author

    Hi, I've attached the pytorch_config.yaml.

    pytorch_config.yaml

  4. maximpavliv commented on Sep 16, 2025

    @maximpavliv
    Contributor

    Hi @pvarsharavi ,

    Thanks for sharing your pytorch_config.yaml. I looked at the file, and the issue is that the "data" block in your YAML has a ++- in front of it. This is not valid YAML syntax, which is why the parser fails to read the "data" key and leads to the KeyError: 'data' during training.

    YAML parsers are very strict about formatting, and any extra characters like ++- will make the block unreadable. That’s why your network crashes even after resetting the learning rate.

    Simply remove the ++- so that it reads correctly:

    data:
      bbox_margin: 20
      colormode: RGB
      ...
    

    Save the file and restart training.
    After fixing this, the YAML parser should correctly read the "data" block, and the training should proceed normally.

    I’m going to close this issue since the problem is with the YAML formatting and not a bug in DeepLabCut.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

more-data-requested-by-us

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions