Comments (7)
Hi @Achyar-CN thank you for writing in. While we don't know how the train.py
script structure looks like, it seems that way of integrating Sweeps with your code, it can cause issues. You're starting a wandb run, and inside that run's singleton you're calling an external script. Are you starting another run in that script?
For your use case, it would be most recommended that you define the sweep hyperparameter in a yaml file, and you add in the file the python script and its arguments using a similar format to this one:
https://docs.wandb.ai/guides/sweeps/faq#how-do-i-use-custom-cli-commands-with-sweeps
You will then only have to execute those two CLI commands:
wandb sweep --project sweep-demo-cli config.yaml
wandb agent --count $NUM your-entity/sweep-demo-cli/sweepID
Please let me know if that would work for you, or if you needed further assistance with this.
from wandb.
Hello @thanos-wandb, thank you for your response. I'm not entirely sure if it was calling an external script and initiating another run. From my understanding, there already exists a wandb, run within the YOLOv7 training process by default. I believe that when I run the sweeps, it also executes the internal wandb scripts.
Btw, I followed your suggestion regarding the CLI commands, and it worked perfectly. Many thanks for your assistance 👍👍
from wandb.
Hi @elon1992 , here are the steps I've taken for YOLOv7, which I believe also apply to YOLOv9:
- Ensure that you're in the active directory path for YOLOv7.
- Create a new 'config.yaml' file, for example:
program: train.py
method: bayes
metric:
goal: maximize
name: metrics/mAP_0.5
parameters:
epochs:
values: [2, 3]
command:
- ${env}
- python
- ${program}
- ${args}
- "--batch-size=32"
- "--img=800"
- "--device=0"
- "--workers=4"
- "--data=/content/gdrive/MyDrive/YOLOv7_tiny/yolov7/data/coco.yaml"
- "--weights=/content/gdrive/MyDrive/YOLOv7_tiny/yolov7/yolov7-tiny.pt"
- "--cfg=/content/gdrive/MyDrive/YOLOv7_tiny/yolov7/cfg/training/yolov7-tiny.yaml"
- Run the first CLI command in the terminal, or a Jupyter notebook (by starting with %%bash).
%%bash
wandb sweep --project your_sweep_project_name config.yaml
- From the output of the second step, you will receive the code for the second CLI command including the sweep_id, and next you can copy that code and add the number of hyperparameter tuning iterations you want. For example, the command for conducting hyperparameter tuning with 3 iterations could be:
%%bash
wandb agent --count 3 your-entity/sweep-demo-cli/sweepID
I hope this helps! Let me know if you have any questions.
from wandb.
Hello @thanos-wandb, @Achyar-CN Could you please explain me how did you solve this with some more detailed approach. Thanks
from wandb.
Great, glad to hear this is now fixed, and thank you for the code snippet, @Achyar-CN - much appreciated!
from wandb.
Hello @Achyar-CN , Thank you so much for the code snippet. But i have questions like the hyperparameter you chose for tuning is just epch what if i have to use batch-size which is used in args, and what if i want to try different optimizers or lr0 or anything. Will inserting the hyperparameter name and value works same as epoch?
Thank you
from wandb.
Hi @elon1992, from my understanding, there are two types of hyperparameters in YOLOv7: direct parser hyperparameters (such as epoch, batch-size, img, etc.) and hyperparameters included within hyp.scratch.tiny.yaml (like lr0, momentum, etc.). For instance, you could directly add both as shown below:
program: train.py
method: bayes
metric:
goal: maximize
name: metrics/mAP_0.5
parameters:
epochs:
values: [2, 3]
batch-size:
values: [8, 16, 32]
hyp:
parameters:
momentum:
values: [0.8]
lr0:
max: 0.02
min: 0.005
distribution: uniform
command:
- ${env}
- python
- ${program}
- ${args}
- "--img=800"
- "--device=0"
- "--workers=4"
- "--data=/content/gdrive/MyDrive/YOLOv7_tiny/yolov7/data/pothole.yaml"
- "--weights=/content/gdrive/MyDrive/YOLOv7_tiny/yolov7/yolov7-tiny.pt"
- "--cfg=/content/gdrive/MyDrive/YOLOv7_tiny/yolov7/cfg/training/yolov7_pothole-tiny.yaml"
from wandb.
Related Issues (20)
- [Q]how to launch job in self-built k8s environment, is there has guides about this? HOT 3
- [App]: Excessive WebGL VRAM usage with Plotly graphs HOT 1
- [App]: The list of options for X-axis is non-deterministic HOT 1
- Changing WANDB_CACHE_DIR breaks artifact retrieval HOT 5
- [CLI]: Wandb config and summary not fully saved during some offline runs HOT 3
- [Q] Can't import wandb HOT 9
- [Feature]: Delete an org HOT 1
- [Q] What process is being tracked on a launch job? HOT 5
- [Q] Is there tool to render offline data to a html report? HOT 4
- [CLI]: wandb sweep command not prefixing runs with "python [filename].py" HOT 1
- 训练超参数epochs的选择
- [CLI]: wandb makes no progress uploading artifacts after hours of waiting HOT 3
- wandb: ERROR Error while calling W&B API: An internal error occurred. Please contact support. (<Response [500]>) HOT 5
- [CLI]: ERROR logging tables. Error while calling W&B API: An internal error occurred. Please contact support. (<Response [500]>) HOT 2
- [Q] argument `fps` to `wandb.Video` does not change speed of created video HOT 2
- [Q] Create matplotlib and save as wandb.Image HOT 3
- [App]: Sweep run the same parameters multiply times. HOT 2
- [Q] Can I delete all of my created teams in wandb? HOT 4
- [CLI]: `TypeError: Object of type Error is not JSON serializable` when using `wandb.integration.openai.fine_tuning` HOT 2
- [Q] Can I restore the project I deleted? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wandb.