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

Packaging the bi-dexhands directory #17

Open
ltzheng opened this issue Feb 2, 2023 · 5 comments
Open

Packaging the bi-dexhands directory #17

ltzheng opened this issue Feb 2, 2023 · 5 comments

Comments

@ltzheng
Copy link
Contributor

ltzheng commented Feb 2, 2023

It would be easier to use if you can rename the folder bi-dexhands to bidexhands and add a __init__.py to turn it into a python package.
This allows directly use this package in the code. Otherwise there will be a ModuleNotFoundError when importing bidexhands.

The setup.py can be updated as follows.

import os
from setuptools import setup, find_packages
import setuptools

def get_version() -> str:
    init = open(os.path.join("bidexhands", "__init__.py"), "r").read().split()
    return init[init.index("__version__") + 2][1:-1]

setup(
    name="bidexhands",
    version=get_version(),
    description="xxx",
    long_description=open("README.md", encoding="utf8").read(),
    long_description_content_type="text/markdown",
    author="xxx",
    author_email="xxx",
    packages=setuptools.find_packages(),
    keywords="xxx",
    python_requires='>=3.7',
)

You also need to modify several import lines inside the package, e.g., change

from tasks.shadow_hand_over import ShadowHandOver

to

from bidexhands.tasks.shadow_hand_over import ShadowHandOver

If you don't mind, I can open a pull request.

@cypypccpy
Copy link
Collaborator

cypypccpy commented Feb 4, 2023

Dear @ltzheng ,

Thank you for your concern! Yeah it is my bad and we also want to do this before. But I've been busy lately so haven't done QAQ.

If you don't mind, I can open a pull request.

Yeah, if you'd like to open a PR we would greatly appreciate it!

Hope this can help you.

@cypypccpy
Copy link
Collaborator

Hi @ltzheng ,

We package the Bi-DexHands as your suggestions. Thank you very much!

An example usage, also added in the README.md:

import bidexhands as bi
import torch

env_name = 'ShadowHandOver'
algo = "ppo"
env = bi.make(env_name, algo)

obs = env.reset()
terminated = False

while not terminated:
    act = torch.tensor(env.action_space.sample()).repeat((env.num_envs, 1))
    obs, reward, done, info = env.step(act)

Hope this can help you.

@ltzheng
Copy link
Contributor Author

ltzheng commented Feb 10, 2023

Sorry for didn't notice your comment five days ago.
I created a fork 2 days ago, but it seems you've already fixed it now.
Well done. Really appreciate it :)

@ltzheng
Copy link
Contributor Author

ltzheng commented Feb 10, 2023

Hi @cypypccpy
I think there still exist some bugs. I have opened a PR and maybe you can have a check when available.

@cypypccpy
Copy link
Collaborator

Hi @cypypccpy I think there still exist some bugs. I have opened a PR and maybe you can have a check when available.

Hi @ltzheng ,

Yeah I also agree. I have merged your PR, thank you for your contribution!

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