-
Notifications
You must be signed in to change notification settings - Fork 154
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
Added RGBD diffusion policy implementation as well as Draw Triangle task #643
Open
arnavg115
wants to merge
14
commits into
haosulab:main
Choose a base branch
from
arnavg115:main
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.
Open
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5c25469
Added draw triangle with success condition
arnavg115 f1e4826
parallelized progress
arnavg115 de9b921
fixed triangle rotation issues
arnavg115 1189e32
clean up and format
arnavg115 645a74c
rgbd diffusion policy progress
arnavg115 2bd9cfc
diff policy rgbd cpu fixes
arnavg115 41bc78a
minor diff policy fixes and finished draw triangle parallelization
arnavg115 e322dad
Added depth arg to diff pol rgbd + formatting
arnavg115 46c3b22
Removed unused code
arnavg115 4f598bd
Made requested fixes, made bugfix to frame stack wrapper
arnavg115 7a52287
Edited make_env and frame_stack
arnavg115 7adcd5d
Added state obs to draw triangle
arnavg115 a209f59
Update draw_triangle max steps
arnavg115 b5528d6
Added DrawTriangle Docs
arnavg115 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
There are no files selected for viewing
This file contains 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
65 changes: 65 additions & 0 deletions
65
examples/baselines/diffusion_policy/diffusion_policy/plain_conv.py
This file contains 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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import torch.nn as nn | ||
|
||
|
||
def make_mlp(in_channels, mlp_channels, act_builder=nn.ReLU, last_act=True): | ||
c_in = in_channels | ||
module_list = [] | ||
for idx, c_out in enumerate(mlp_channels): | ||
module_list.append(nn.Linear(c_in, c_out)) | ||
if last_act or idx < len(mlp_channels) - 1: | ||
module_list.append(act_builder()) | ||
c_in = c_out | ||
return nn.Sequential(*module_list) | ||
|
||
|
||
class PlainConv(nn.Module): | ||
def __init__( | ||
self, | ||
in_channels=3, | ||
out_dim=256, | ||
pool_feature_map=False, | ||
last_act=True, # True for ConvBody, False for CNN | ||
): | ||
super().__init__() | ||
# assume input image size is 64x64 | ||
|
||
self.out_dim = out_dim | ||
self.cnn = nn.Sequential( | ||
nn.Conv2d(in_channels, 16, 3, padding=1, bias=True), | ||
nn.ReLU(inplace=True), | ||
nn.MaxPool2d(2, 2), # [32, 32] | ||
nn.Conv2d(16, 32, 3, padding=1, bias=True), | ||
nn.ReLU(inplace=True), | ||
nn.MaxPool2d(2, 2), # [16, 16] | ||
nn.Conv2d(32, 64, 3, padding=1, bias=True), | ||
nn.ReLU(inplace=True), | ||
nn.MaxPool2d(2, 2), # [8, 8] | ||
nn.Conv2d(64, 128, 3, padding=1, bias=True), | ||
nn.ReLU(inplace=True), | ||
nn.MaxPool2d(2, 2), # [4, 4] | ||
nn.Conv2d(128, 128, 1, padding=0, bias=True), | ||
nn.ReLU(inplace=True), | ||
) | ||
|
||
if pool_feature_map: | ||
self.pool = nn.AdaptiveMaxPool2d((1, 1)) | ||
self.fc = make_mlp(128, [out_dim], last_act=last_act) | ||
else: | ||
self.pool = None | ||
self.fc = make_mlp(128 * 4 * 4 * 4, [out_dim], last_act=last_act) | ||
|
||
self.reset_parameters() | ||
|
||
def reset_parameters(self): | ||
for name, module in self.named_modules(): | ||
if isinstance(module, (nn.Linear, nn.Conv1d, nn.Conv2d)): | ||
if module.bias is not None: | ||
nn.init.zeros_(module.bias) | ||
|
||
def forward(self, image): | ||
x = self.cnn(image) | ||
if self.pool is not None: | ||
x = self.pool(x) | ||
x = x.flatten(1) | ||
x = self.fc(x) | ||
return x |
Oops, something went wrong.
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.
can this not just inherit the maniskill frame stack wrapper?
I purposely didn't use the original framestack wrapper from gymnasium since it was not properly GPU parallelized.