import argparse
import os
import agents
import gym
import gym.spaces
import numpy as np
import tensorflow as tf
from dm_control import suite # Must be imported after TensorFlow.
# Full example for my blog post at:
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
tfd = tf.contrib.distributions
import functools
import tensorflow as tf
class share_variables(object):
def __init__(self, func):
self._func = func
self._obj = None
def minitaur_config():
# General
algorithm = ppo.PPOAlgorithm
num_agents = 10
eval_episodes = 30
use_gpu = False
# Environment
env = 'MinitaurBulletEnv-v0'
max_length = 1000
steps = 1e7 # 10M
python -c "import gym,time;d=10000;e=gym.make('Ant-v1');s=time.time();e.reset();[e.reset() if e.step(e.action_space.sample())[2] else 0 for _ in range(d)];print(d/(time.time()-s),'FPS')"

TensorFlow Agents PyBullet Usage Example

This example shows how to install TensorFlow agents and use it on custom environments, such as the environments that come with PyBullet.

It works for both Python 3 and Python 2. Just replace pip3 and python3 with pip2 and python2.

Set up the dependencies:

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import tensorflow as tf
class GRU(tf.contrib.rnn.RNNCell):
View edit_dirs
"""Move or delete directories via your text editor.
- Install via `pip3 install sh`.
- Save this file into a directory in your $PATH, for example `~/bin`.
import argparse
import tempfile
"""Character based language modeling with multi-layer GRUs.
To train the model:
python3 --mode training \
--logdir path/to/logdir --corpus path/to/corpus.txt
To generate text from seed words:
python3 --mode sampling \
import numpy as np
class Network:
def __init__(self, num_inputs, num_hidden, num_output,
self.w1 = np.random.normal(
0, init_weight_scale, (num_inputs + 1, num_hidden))
self.w2 = np.random.normal(