ultralytics / ultralytics

Ultralytics YOLO11 🚀
https://docs.ultralytics.com
GNU Affero General Public License v3.0
36.32k stars 7k forks source link

How to replace the optimizer, can you give specific steps? #19061

Open yangershuai627 opened 6 days ago

yangershuai627 commented 6 days ago

Search before asking

Question

How to replace the optimizer, can you give specific steps?

Additional

No response

UltralyticsAssistant commented 6 days ago

👋 Hello @yangershuai627, thank you for your interest in Ultralytics 🚀! We recommend a visit to the Docs for new users, where you can find many Python and CLI usage examples that may already contain helpful information.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us investigate the issue.

For your ❓ Question on replacing the optimizer, while an Ultralytics engineer will respond soon with more details, we recommend sharing as much context as possible, such as code snippets, experiments, or specific challenges you're facing. Additionally, you might find useful guidance in our Tips for Best Training Results.

Join the Ultralytics community where it suits you best. For real-time chat, head to Discord 🎧. Prefer in-depth discussions? Check out Discourse. Or dive into threads on our Subreddit to share knowledge with the community.

Upgrade

In case the optimizer functionality has been updated recently, upgrade to the latest ultralytics package along with all requirements in a Python>=3.8 environment with PyTorch>=1.8:

pip install -U ultralytics

Environments

YOLO may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):

Status

Ultralytics CI

If this badge is green, all Ultralytics CI tests are currently passing. CI tests verify correct operation of all YOLO Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

Thank you for your question! An Ultralytics engineer will assist you soon 😊

jugal-sheth commented 6 days ago

sample of python training code results = model.train(data="xxxxxxx.yaml", epochs=100, patience=0, optimizer="AdamW", lr0=0.001, lrf=0.001, cos_lr=True)

for more info https://docs.ultralytics.com/modes/train/#train-settings

yangershuai627 commented 6 days ago

@jugal-sheth @Y-T-G What do I do if I want to replace optimizer with Lion, but yolo offers only the following Optimizers as options?

Image

Y-T-G commented 5 days ago

You will have to modify the source code