Comments (10)
For what it is worth, I'm working on a new environment that creates a simple quadcopter model and allows learning to fly this.
I'm not sure if it would be of interest to contribute.
from roboschool.
Hi @peabody124. These files exported directly by learning tool. You can tell by the difference in -v0 and -v1 we're working on tools as well. No special script to do this.
from roboschool.
@olegklimov which learning tool, or is this something not released? for example the graphs for flag runner harder say they are using PPO. This algorithm from baselines is working fairly well in my environments, but I'm not exactly sure how to dump the parameters from the MlpPolicy into a script like that which can be executed to reload the weights.
from roboschool.
Oh, from baselines is really straightforward to export this.
from roboschool.
@olegklimov any hints or links? :)
from roboschool.
Yeah, sure.
def recursive_np_array_print(a, idx):
if len(idx)==len(a.shape)-1:
return "[" + ",".join(["%+8.4f" % a[tuple(idx + [i])] for i in range(a.shape[len(idx)]) ]) + "]"
else:
return "[\n" + ",\n".join([recursive_np_array_print(a, idx + [i]) for i in range(a.shape[len(idx)]) ]) + "\n]"
from roboschool.
For what it is worth, this was what I ultimately used to dump from a PPO MlpPolicy to create the weights file
model_meta_fn = 'FILENAME.cpkt.meta'
import tensorflow as tf
sess = tf.Session()
saver = tf.train.import_meta_graph(model_meta_fn)
saver.restore(sess, tf.train.latest_checkpoint('.'))
graph = tf.get_default_graph()
print("Model loaded")
def get_var_by_name(desired):
return [v for v in tf.global_variables() if v.name == desired][0]
state_mean = get_var_by_name('pi/obfilter/runningsum:0') / get_var_by_name('pi/obfilter/count:0')
state_std = tf.sqrt(tf.maximum(get_var_by_name('pi/obfilter/runningsumsq:0') / get_var_by_name('pi/obfilter/count:0') - tf.square(state_mean), 1e-2))
policy = { 'state_means': sess.run(state_mean),
'state_std': sess.run(state_std),
'w0': sess.run(get_var_by_name('pi/polfc1/w:0')),
'b0': sess.run(get_var_by_name('pi/polfc1/b:0')),
'w1': sess.run(get_var_by_name('pi/polfc2/w:0')),
'b1': sess.run(get_var_by_name('pi/polfc2/b:0')),
'w2': sess.run(get_var_by_name('pi/polfinal/w:0')),
'b2': sess.run(get_var_by_name('pi/polfinal/b:0'))
}
def recursive_np_array_print(a, idx):
if len(idx)==len(a.shape)-1:
return "[" + ",".join(["%+8.4f" % a[tuple(idx + [i])] for i in range(a.shape[len(idx)]) ]) + "]"
else:
return "[\n" + ",\n".join([recursive_np_array_print(a, idx + [i]) for i in range(a.shape[len(idx)]) ]) + "\n]"
str = "import numpy as np\n"
for key in policy:
str += key + " = np.array(" + recursive_np_array_print(policy[key], []) + ")\n"
file = open('model.weights', "w")
file.write(str)
file.close()
print("Policy weights dumped to model.weights")
from roboschool.
Hi! @peabody124
In the agent_zoo directory there are some files about weights. I want to use my weights that trained by the tensorflow about baselines.ddpg algorithm but there are some issues. I want to know whether I can change my weights file and load it .and how did you do that?
Thanks a lot !!!
from roboschool.
@peabody124 I run the code above and change my model file 'model.ckpt.meta' to 'model.weights' . My model is from ddpg algorithm .But there are some issues :
state_mean = get_var_by_name('pi/obfilter/runningsum:0') / get_var_by_name('pi/obfilter/count:0')
return [v for v in tf.global_variables() if v.name == desired][0] IndexError:list index out of range
Could you please tell me the reason and how to modify It ?
Thanks a lot !!
from roboschool.
Hi @peabody124 . Would would mind making the quadcopter model available? I would really appreciate! I was digging in the c++ python bullet binding to find a function to apply a pure force or a torque to a robot in roboschool, but I could not find anything. Did I miss something?
from roboschool.
Related Issues (20)
- RoboschoolHumanoidFlagrun-v1 flies in an endless summersault?
- Searching bullet source files in wrong folder
- Frozen render window
- unknown option 'qt' when running make -j4 HOT 9
- Baselines for roboschool environments HOT 1
- The ATLAS robot COLLADA/DAE models have invalid texture references.
- Can provide the API for save & restore the state of the environment?
- I cannot install libgl1-mesa-dev on centos, so I always meet the error that ImportError: cannot import name 'cpp_household'. HOT 1
- Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/svu/biehz/zhimin/software/roboschool_lib/roboschool/__init__.py", line 112, in <module> from roboschool.gym_pendulums import RoboschoolInvertedPendulum File "/home/svu/biehz/zhimin/software/roboschool_lib/roboschool/gym_pendulums.py", line 1, in <module> from roboschool.scene_abstract import SingleRobotEmptyScene File "/home/svu/biehz/zhimin/software/roboschool_lib/roboschool/scene_abstract.py", line 12, in <module> from roboschool import cpp_household as cpp_household ImportError: cannot import name 'cpp_household' >>> HOT 1
- ld: library not found for -lPhysicsClientC_API
- Segmentation Fault when calling render()
- ImportError: cannot import name 'cpp_household' [Google Colab] HOT 5
- unexpected keyword argument 'tags' HOT 6
- Package 'libav-tools' has no installation candidate HOT 4
- import roboschool after pip install gives TypeError due to 'tags' HOT 3
- problem of using cpp_household.Joint..reset_current_position
- ImportError: libQt5OpenGL.so.5: cannot open shared object file: No such file or directory HOT 4
- PyBullet Links don't work
- AttributeError: 'EntryPoints' object has no attribute 'get' HOT 1
- [email protected]
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from roboschool.