Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: dump_all() got an unexpected keyword argument 'sort_keys' #414

Closed
IamSparky opened this issue Jul 15, 2020 · 11 comments · Fixed by #2030 or #2021
Closed

TypeError: dump_all() got an unexpected keyword argument 'sort_keys' #414

IamSparky opened this issue Jul 15, 2020 · 11 comments · Fixed by #2030 or #2021
Labels
question Further information is requested Stale Stale and schedule for closing soon

Comments

@IamSparky
Copy link

IamSparky commented Jul 15, 2020

image

Got this error while running the train.py file in Google Colab

the full link of the notebook is - https://colab.research.google.com/drive/10J3_S3_pjpvh55ZwoBnjK3xyX0zTRSSq?usp=sharing

🐛 Bug

A clear and concise description of what the bug is.

To Reproduce (REQUIRED)

Input:

!python train.py --img 1024 --batch 32 --epochs 10 --data /content/wheat.yaml --cfg models/yolov5s.yaml --name wm --nosave --cache

Output:

Apex recommended for faster mixed precision training: https://github.com/NVIDIA/apex
Namespace(batch_size=32, bucket='', cache_images=True, cfg='models/yolov5s.yaml', data='/content/wheat.yaml', device='', epochs=10, evolve=False, hyp='', img_size=[1024], multi_scale=False, name='wm', noautoanchor=False, nosave=True, notest=False, rect=False, resume=False, single_cls=False, weights='')
Using CUDA device0 _CudaDeviceProperties(name='Tesla K80', total_memory=11441MB)

2020-07-14 21:11:21.719560: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
Start Tensorboard with "tensorboard --logdir=runs", view at http://localhost:6006/
Hyperparameters {'optimizer': 'SGD', 'lr0': 0.01, 'momentum': 0.937, 'weight_decay': 0.0005, 'giou': 0.05, 'cls': 0.58, 'cls_pw': 1.0, 'obj': 1.0, 'obj_pw': 1.0, 'iou_t': 0.2, 'anchor_t': 4.0, 'fl_gamma': 0.0, 'hsv_h': 0.014, 'hsv_s': 0.68, 'hsv_v': 0.36, 'degrees': 0.0, 'translate': 0.0, 'scale': 0.5, 'shear': 0.0}
Traceback (most recent call last):
  File "train.py", line 404, in <module>
    train(hyp)
  File "train.py", line 57, in train
    yaml.dump(hyp, f, sort_keys=False)
  File "/usr/local/lib/python3.6/dist-packages/yaml/__init__.py", line 200, in dump
    return dump_all([data], stream, Dumper=Dumper, **kwds)
TypeError: dump_all() got an unexpected keyword argument 'sort_keys'

Expected behavior

It should start training the model

Environment

I was running it on google colab Gpu

Additional context

Add any other context about the problem here.

@IamSparky IamSparky added the bug Something isn't working label Jul 15, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Jul 15, 2020

Hello @soumochatterjee, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom model or data training question, please note that Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

  • Cloud-based AI systems operating on hundreds of HD video streams in realtime.
  • Edge AI integrated into custom iOS and Android apps for realtime 30 FPS video inference.
  • Custom data training, hyperparameter evolution, and model exportation to any destination.

For more information please visit https://www.ultralytics.com.

@glenn-jocher
Copy link
Member

@soumochatterjee appears your pyyaml is not up to date. You should follow the Setup instructions in the official notebook. At the same time, removing the sort_keys arguments from the code does not appear to have any adverse effects.

@glenn-jocher glenn-jocher added question Further information is requested and removed bug Something isn't working labels Jul 15, 2020
@glenn-jocher
Copy link
Member

Screen Shot 2020-07-15 at 10 52 57 AM

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale Stale and schedule for closing soon label Aug 15, 2020
@wwdok
Copy link
Contributor

wwdok commented Jan 24, 2021

I met the exact same issue, i fixed it by upgrage PyYAML version to > 3.13, not include =3.13 : !pip install PyYAML==5.4.1

@glenn-jocher
Copy link
Member

@wwdok thanks for the comment! What environment did you encounter the error in? Perhaps we need to increase the pyYAML requirement.

@wwdok
Copy link
Contributor

wwdok commented Jan 24, 2021

@glenn-jocher hi, i run it with latest colab just now, so the environment is the latest colab used.

@glenn-jocher
Copy link
Member

@wwdok ok understood. It appears I made a poor design decision in reverting the yaml requirement. It works for me on my Colab, but if it doesn't work on your Colab then it may not work for others either and I should increase the version. I will update requirements.txt with this info.

@glenn-jocher glenn-jocher reopened this Jan 24, 2021
@glenn-jocher glenn-jocher linked a pull request Jan 24, 2021 that will close this issue
@glenn-jocher glenn-jocher linked a pull request Jan 24, 2021 that will close this issue
@glenn-jocher
Copy link
Member

@wwdok @seahawks8 PR #2030 is merged, which updates the pyYAML requirement to ==5.4.1. Please git pull to receive this update, and let us know if you run into any other issues.

Thank you for your feedback!

@bryanbocao
Copy link

I met the exact same issue, i fixed it by upgrage PyYAML version to > 3.13, not include =3.13 : !pip install PyYAML==5.4.1

Thanks! It works!

@glenn-jocher
Copy link
Member

@bryanbocao glad to hear that it's working for you now! If you have any more questions or run into any other issues, feel free to ask. Happy coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale Stale and schedule for closing soon
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants