Skip to content
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

Demo collection script #38

Closed
yuchen93 opened this issue Jul 6, 2022 · 11 comments
Closed

Demo collection script #38

yuchen93 opened this issue Jul 6, 2022 · 11 comments

Comments

@yuchen93
Copy link

yuchen93 commented Jul 6, 2022

Hi, is the demonstration collection script available somewhere? The one in robosuite repo does not seem to output demos with the right format.

Thanks!

@yuchen93 yuchen93 closed this as completed Jul 6, 2022
@yuchen93 yuchen93 reopened this Jul 7, 2022
@yuchen93
Copy link
Author

yuchen93 commented Jul 7, 2022

I thought the conversion script works on the demos collected with robosuite but the file format and action space limits are still off.

@amandlek
Copy link
Member

amandlek commented Jul 7, 2022

This link here should be what you need. What version of robosuite (and branch) are you using, and what error are you running into?

@yuchen93
Copy link
Author

yuchen93 commented Jul 8, 2022

I am on the offline_study branch of robosuite and collected new data in the PickPlaceCan environment.
I processed the dataset with dataset_states_to_obs.py but the resulting observations do not match with those in robomimic dataset. It only has object-state as the observation key for some reason. If I initialize the environment with robosuite it has the correct observations.

Also, running get_data_set_information.py I got:

Traceback (most recent call last):
  File "get_dataset_info.py", line 134, in <module>
    raise Exception("Dataset should have actions in [-1., 1.] but got bounds [{}, {}]".format(action_min, action_max))
Exception: Dataset should have actions in [-1., 1.] but got bounds [-1.0, 1.7948744758575645]

I am not sure why there is a mismatch between environments.

@amandlek
Copy link
Member

amandlek commented Jul 8, 2022

This is very strange - is there any way we can reproduce the error on our end? Can you clarify exactly what scripts and commands you ran to collect and postprocess data so that we can try the same things on our end?

@yuchen93
Copy link
Author

yuchen93 commented Jul 8, 2022

These are the commands I ran:

In robosuite:

python collect_human_demonstrations.py --environment PickPlaceCan

In robomimic:

python conversion/convert_robosuite.py --dataset ~/robosuite/robosuite/models/assets/demonstrations/1657322008_8549528/demo.hdf5
python dataset_states_to_obs.py --done_mode 0 --dataset ~/robosuite/robosuite/models/assets/demonstrations/1657322008_8549528/demo.hdf5 --output_name low_dim.hdf5
python get_dataset_info.py --dataset ~/robosuite/robosuite/models/assets/demonstrations/1657322008_8549528/low_dim.hdf5

Error message this time:

Traceback (most recent call last):
  File "get_dataset_info.py", line 134, in <module>
    raise Exception("Dataset should have actions in [-1., 1.] but got bounds [{}, {}]".format(action_min, action_max))
Exception: Dataset should have actions in [-1., 1.] but got bounds [-3.7500000000000036, 3.7500000000000036]

@amandlek
Copy link
Member

amandlek commented Jul 9, 2022

I think this is because of an issue in the robosuite collection script - the action isn't being clipped to [-1, 1] before being taken in the environment (and recorded). Can you please add a action = np.clip(action, -1., 1.) line above this line here?

For some context, robomimic expects recorded demonstration actions to be in the range [-1., 1.] so that we can easily scale network outputs into that range (this usually improves learning performance). The robosuite environment also performs action clipping internally, so if you'd like to avoid collecting data again, you could probably just modify your demonstration hdf5 directly (manually clip the actions and update the hdf5) if you'd like to avoid collecting data again.

Hope this helps! Feel free to reopen the issue if errors persist.

@amandlek amandlek closed this as completed Jul 9, 2022
@yuchen93
Copy link
Author

yuchen93 commented Jul 9, 2022

OK! I'll clip the actions. But that is not the only issue. The observations I got only have 'object-state', which does not match with ones in the robomimic dataset that include 'robot0_' stuff. Do you know what could be the cause of this?

@amandlek
Copy link
Member

amandlek commented Jul 9, 2022

I just tried the same sequence of commands as you, and I am getting all of the observations. Here is a screenshot below. As a note, the object observations should be "object", not "object-state" - so this appears to be something wrong in your setup. The EnvRobosuite class's observation function should be replacing the raw "object-state" observation from the robosuite environment and renaming it to "object", so maybe you inadvertently changed that file? The relevant file in robomimic is robomimic/envs/env_robosuite.py
image

@yuchen93
Copy link
Author

yuchen93 commented Jul 9, 2022

OK thanks a lot for checking!

@yuchen93
Copy link
Author

Did you do any post-processing of the demo data? The ones I collected are all much longer than those in the robomimic dataset like ~700 steps vs <200 steps. Is it just an interface problem?

@amandlek
Copy link
Member

Yup I would strongly suspect it's an interface problem. I'm also not sure whether you are postprocessing the demo data to only keep successes (I don't think the robosuite code does that for you) - that might also play a role in the data quality you're seeing.

As for interface considerations, I'd strongly recommend using a SpaceMouse (3D mouse) over the keyboard interface to collect better quality demos. More info here.

amandlek added a commit that referenced this issue May 24, 2023
* initial BC-mingpt implementation

* added adamw and weight scheduler

* updated mingpt configs for sweep

* rename mingpt -> transformer

* cleaned up bc transformer in bc.py

* cleaned up code comments

* remove internal config gen scripts

* addressing Danfei's comments in PR

* update template configs and make some cosmetic changes

* add ack for mingpt

---------

Co-authored-by: Ajay Mandlekar <ajay.mandlekar@gmail.com>
Co-authored-by: amandlek <amandlek@users.noreply.github.com>
snasiriany added a commit that referenced this issue Jun 15, 2023
* initial BC-mingpt implementation

* added adamw and weight scheduler

* updated mingpt configs for sweep

* rename mingpt -> transformer

* cleaned up bc transformer in bc.py

* cleaned up code comments

* remove internal config gen scripts

* addressing Danfei's comments in PR

* update template configs and make some cosmetic changes

* add ack for mingpt

---------

Co-authored-by: Ajay Mandlekar <ajay.mandlekar@gmail.com>
Co-authored-by: amandlek <amandlek@users.noreply.github.com>
amandlek added a commit that referenced this issue Jul 4, 2023
* colab links in readme and docs

* move colab link to getting_started in docs, add colab banner in readme

* basic support for logging warnings

* wandb logging; revamped warning logging; macros

* addressed PR comments; moved wandb proj name to experiments.logging section; hyperparam generator populates tags

* change tags to meta. add wandb api key to macros

* check that Macros.WANDB_ENTITY is not None

* fix depth unprocessing, fix config modality handling

* limit torch threads

* space saving options in dataset extraction script

* changes to make image uint8 to float conversion happen on GPU

* disable load next obs if BC

* small bug fix

* add storage flags to docs

* add some 2022 refs

* add viola

* add link to old docs on tab bar and logo into tab bar

* make sure kwargs are empty in default configs for easy override

* move some models into obs core file

* minor change

* work with older robosuite versions

* add some 2023 refs

* making validation hdf5 key explicit

* IQL implementation; todo: comments and testing

* revamped comments for IQL

* add minimal iql test and fix template

* added comments and tests; removed filter_type feature

* updated docs and configs for d4rl v2 envs; added iql results

* update iql template json config to reflect v0.3 changes

* generate iql configs for d4rl

* fixed small bug with d4rl
output dirs

* update version numbers for d4rl docs

* adding r3m and mvp pretraining

* clean

* add doc for pretrain

* fix

* revert change to env robosuite

* minor rename

* update pretrained reps tutorial

* fix minor issues

* small update to iql config

* small docs fix

* add orbit reference

* more 2023 papers

* working version of color jitter net

* add gaussian noise randomizer

* fix bug in GaussianNoiseRandomizer

* randomizer visualization

* center cropping for CropRandomizer eval mode

* viz randomizer

* move randomizers to obs_core.py

* remove dups

* remove dups

* missing import

* doc instruction for visualizing randomizer

* Fix tab issue

* update reqs with matplotlib

* modified docs for new datasets, new algos, wandb support

* add note about using offline_study datasets

* postprocess xml for v1.3

* update postprocess function

* added verification exps

* limit num torch threads

* updated dataset gen script

* mj211 verification runs

* started conversion script for robosuite v1.3.1. WIP

* initial conversion script ready

* add verion to env_robosuite; fix bug from observation modality PR

* added v_1_3_1 verification jsons

* converted lift dataset, wip on can

* playback with can appears working but state divergence still high

* all tasks minimally in place now without mujoco exceptions

* minimal script for robosuite v140 conversion; created configs

* updated robosuite v140 convertion script

* added version checks for robosuite

* update dataset registry to point to v141 raw datasets

* generating and downloading datasets for v141

* updated obs extraction script to use v141 robosuite datasets

* remove unsued scripts

* remove unnec script

* delete old verification scripts

* remove unnec changes

* add low_dim dataset links back in, more informative message for unstored datasets

* Transformer support (#38)

* initial BC-mingpt implementation

* added adamw and weight scheduler

* updated mingpt configs for sweep

* rename mingpt -> transformer

* cleaned up bc transformer in bc.py

* cleaned up code comments

* remove internal config gen scripts

* addressing Danfei's comments in PR

* update template configs and make some cosmetic changes

* add ack for mingpt

---------

Co-authored-by: Ajay Mandlekar <ajay.mandlekar@gmail.com>
Co-authored-by: amandlek <amandlek@users.noreply.github.com>

* bump version and minor docs update

* remove file

* some minor docs fixes for updated test_v141 hdf5

* small change to gitignore for test hdf5

* some minor docs fixes

* update 2023 refs

* Update obs_core.py with import

* Add wandb description in "viewing results" tutorial page

* added more wandb info to docs

* fix observation postprocessing for nested obs dicts

* added bc transformer tests

* V0.3 transformer tutorial (#59)

* added transformer tutorial

* Update bc_transformer.json

* Update bc_transformer.json

* Update training_transformers.md

* adjusting tutorial docs based on feedback

* changes to pretrained representations and transformer tutorial

* added data loader params for pretrained reps tutorial

---------

Co-authored-by: Bronars <mattbronars82@gmail.com>

* add readme note

* V0.3 pretrained rep fix (#64)

* fixed error in base_nets for R3MConv

* added error messages for Sequential

* added doc string for Sequential init

---------

Co-authored-by: Danfei Xu <danfeix@nvidia.com>
Co-authored-by: snasiriany <snasiriany@gmail.com>
Co-authored-by: josiah_wong <84cremebrule@gmail.com>
Co-authored-by: Soroush Nasiriany <sornasir324@gmail.com>
Co-authored-by: Soroush Nasiriany <snasiriany@users.noreply.github.com>
Co-authored-by: j96w <j96w@qq.com>
Co-authored-by: danfei <danfeiX@users.noreply.github.com>
Co-authored-by: MBronars <35738375+MBronars@users.noreply.github.com>
Co-authored-by: Bronars <mattbronars82@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants