-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Add Differentiable Physics: Mass-Spring System example #1332
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
Open
AbhiLegend
wants to merge
11
commits into
pytorch:main
Choose a base branch
from
AbhiLegend:add-mass-spring-example
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+206
−0
Open
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7d3d2a1
Add Differentiable Physics: Mass-Spring System example
AbhiLegend 39a0c8e
Add differentiable_physics to run_all() in test script
AbhiLegend 3d01b48
Resolved merge conflict and integrated differentiable_physics test
AbhiLegend 77c8abc
Add visualization and update training code in mass_spring.py
AbhiLegend 84072d5
Finalize differentiable_physics with visualization and CI integration
AbhiLegend 8a7cf5e
Finalize differentiable_physics with visualization and CI integration
AbhiLegend f20fa20
Finalize differentiable_physics with the updates
AbhiLegend e14251f
Update requirements.txt for differentiable_physics
AbhiLegend 96e04f1
Update run_python_examples.sh to test differentiable_physics in CI
AbhiLegend 35b0afa
Add mass spring example and update requirements
AbhiLegend f1a806e
Add mass spring example and update requirements
AbhiLegend File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Resolved merge conflict and integrated differentiable_physics test
- Loading branch information
commit 3d01b48212049a6d263ceb22736cedff609628c8
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,19 +4,20 @@ | |
# The purpose is just as an integration test, not to actually train models in any meaningful way. | ||
# For that reason, most of these set epochs = 1 and --dry-run. | ||
# | ||
# Optionally specify a comma separated list of examples to run. Can be run as: | ||
# * To run all examples: | ||
# To run all examples: | ||
# ./run_python_examples.sh | ||
# * To run few specific examples: | ||
# | ||
# To run specific examples: | ||
# ./run_python_examples.sh "dcgan,fast_neural_style" | ||
# | ||
# To test examples on CUDA accelerator, run as: | ||
# USE_CUDA=True ./run_python_examples.sh | ||
# USE_CUDA=True ./run_python_examples.sh → for CUDA | ||
# USE_ACCEL=True ./run_python_examples.sh → for any accelerator (CUDA/MPS/XPU) | ||
# | ||
# To test examples on hardware accelerator (CUDA, MPS, XPU, etc.), run as: | ||
# USE_ACCEL=True ./run_python_examples.sh | ||
# To use a custom pip install source: | ||
# PIP_INSTALL_ARGS="--pre -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html" ./run_python_examples.sh | ||
# | ||
# Script requires uv to be installed. It installs requirements from requirements.txt per example. | ||
# To force venv per example: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changed |
||
# VIRTUAL_ENV=".venv" ./run_python_examples.sh | ||
|
||
BASE_DIR="$(pwd)/$(dirname $0)" | ||
source $BASE_DIR/utils.sh | ||
|
@@ -39,7 +40,7 @@ case $USE_CUDA in | |
ACCEL_FLAG="" | ||
;; | ||
"") | ||
exit 1; | ||
exit 1 | ||
;; | ||
esac | ||
|
||
|
@@ -53,7 +54,6 @@ function fast_neural_style() { | |
uv run download_saved_models.py | ||
fi | ||
test -d "saved_models" || { error "saved models not found"; return; } | ||
|
||
echo "running fast neural style model" | ||
uv run neural_style/neural_style.py eval --content-image images/content-images/amber.jpg --model saved_models/candy.pth --output-image images/output-images/amber-candy.jpg $ACCEL_FLAG || error "neural_style.py failed" | ||
} | ||
|
@@ -80,7 +80,7 @@ function mnist() { | |
} | ||
|
||
function mnist_forward_forward() { | ||
uv run main.py --epochs 1 --no_mps --no_cuda || error "mnist forward forward failed" | ||
uv run main.py --epochs 1 --no_accel || error "mnist forward forward failed" | ||
} | ||
|
||
function mnist_hogwild() { | ||
|
@@ -205,7 +205,7 @@ function run_all() { | |
run fx | ||
run gcn | ||
run gat | ||
run differentiable_physics # ✅ Your example now runs in CI! | ||
run differentiable_physics | ||
} | ||
|
||
if [ "" == "$EXAMPLES" ]; then | ||
|
You are viewing a condensed version of this merge commit. You can view the full changes here.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these changes be better moved to separate PR. These are unrelated to the example being added and some are arguable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made it to as it was.