Git Product home page Git Product logo

Comments (5)

witwolf avatar witwolf commented on July 26, 2024
  1. SocialRobot should run in the same thread that it is created because of its inner implementation (gazebo::sensors) . There are three options to solve this to work with tf_agents: 1) move the creation from main thread to BatchedPyEnvironment 2) using ParallelPyEnvironment 3) wrap gazebo interface in one thread . Since gazebo can not spawn multi instances by multi-threads 1) and 3) is not necessery

  2. tf_agents support parallel environments using multi-threads (BatchedPyEnvironment) or mutil-process (ParallelPyEnvironment)

  3. example to work with tf_agents
    train_eval.py
    train_eval.patch diff with tf_agents/agents/ddpg/examples/v2/train_eval.py

from alf.

emailweixu avatar emailweixu commented on July 26, 2024

👍
Is it possible to make some wrap for socialrobot environment so that we don't need to change tf_agents code to run with social robot environment? It will be cool if that's possible.

from alf.

witwolf avatar witwolf commented on July 26, 2024

Is it possible to make some wrap for socialrobot environment so that we don't need to change tf_agents code to run with social robot environment? It will be cool if that's possible.

All examples in tf_agents (tf_agents/agents/*/examples/v*/*) creates at least two environments tf_env (created in self process by BatchedPyEnvironment or created in new process by ParallelPyEnvironment for collect data) and eval_tf_env (one instance created in self process for test ) .
Since many singletons implementation in gazebo and multi instances in one process is not supported, partial examples that created tf_env and eval_tf_env in the same process can not run without changing code . Besides, different port should be specified explicitly or generate randomly for each gazebo instance .

from alf.

emailweixu avatar emailweixu commented on July 26, 2024

A possible implementation would be to wrap socialbot using ProcessPyEnvironment in socialbot_suite. For port, we can automatically do increment from a given starting port (from environment). So it can be used in the same way as other environment.

from alf.

witwolf avatar witwolf commented on July 26, 2024

A possible implementation would be to wrap socialbot using ProcessPyEnvironment in socialbot_suite. For port, we can automatically do increment from a given starting port (from environment). So it can be used in the same way as other environment.

with commit update wrap with process and config.gin :

import alf.environments.suite_socialbot

train_eval.env_name = "SocialBot-Pr2Gripper-v0"
train_eval.env_load_fn = @suite_socialbot.load
train_eval.num_parallel_environments = 2

suite_socialbot.load.wrap_with_process = False # recommend set to False when num_parallel_environments > 2

we can run trainning as

python -m tf_agents.agents.ddpg.examples.v2.train_eval --gin_file=config.gin --root_dir=~/tmp/ddpg/socialbot/Pr2Gripper

from alf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.