[feature] Add torch profiler in training/eval tool #2503
+135
−34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this does
Explain what this PR does. Feel free to tag your PR with the appropriate label(s).
This PR adds torch profiler in training/eval tools, which can help find the performance bottleneck of lerobot training/eval tool
How it was tested
Explain/show how you tested your changes.
add the option of "profiling" to enable this feature, and the trace json file will be generated in the current working folder
Training example
TOKENIZERS_PARALLELISM=false lerobot-train --policy.type=smolvla --policy.repo_id=xxxx/smolvla-test --dataset.repo_id=lerobot/svla_so100_stacking/ --batch_size=64 --steps=20 --policy.push_to_hub False --profiling True
Eval example:
TOKENIZERS_PARALLELISM=false lerobot-eval --policy.path=HuggingFaceVLA/smolvla_libero --env.type=libero --env.task=libero_object --eval.batch_size=1 --eval.n_episodes=1 --policy.device=cuda --profiling True
How to checkout & try? (for the reviewer)
Provide a simple way for the reviewer to try out your changes.
based on this PR, run "pip install .[all]" to install lerobot
run the below command to generate tracing files for SmolVLA model
Training example
TOKENIZERS_PARALLELISM=false lerobot-train --policy.type=smolvla --policy.repo_id=xxxx/smolvla-test --dataset.repo_id=lerobot/svla_so100_stacking/ --batch_size=64 --steps=20 --policy.push_to_hub False --profiling True
Eval example:
TOKENIZERS_PARALLELISM=false lerobot-eval --policy.path=HuggingFaceVLA/smolvla_libero --env.type=libero --env.task=libero_object --eval.batch_size=1 --eval.n_episodes=1 --policy.device=cuda --profiling True