-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import subprocess | ||
import sys | ||
|
||
if __name__ == "__main__": | ||
model_name = str(sys.argv[1]) | ||
|
||
subprocess.Popen( | ||
'''export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so:/usr/lib/nvidia-410/libGL.so; python load_agent.py '%s' ''' % model_name, shell=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import sys | ||
import gym | ||
import gym_real | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import datetime | ||
from stable_baselines.common.policies import MlpPolicy | ||
from stable_baselines.common.vec_env import SubprocVecEnv, DummyVecEnv | ||
from stable_baselines import PPO2 | ||
from stable_baselines.bench import Monitor | ||
from stable_baselines.results_plotter import load_results, ts2xy | ||
|
||
if __name__ == "__main__": | ||
file_name = str(sys.argv[1]) | ||
|
||
if file_name[:3] == "mod": | ||
model_name = file_name | ||
else: | ||
dirpath = os.path.join(os.path.dirname(os.path.realpath(__file__)), "models") | ||
log_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "tmp") | ||
model_name = os.path.join(dirpath, file_name) | ||
|
||
env_name = 'Real-v0' | ||
env = gym.make(env_name) | ||
model = PPO2.load(model_name) | ||
|
||
obs = env.reset() | ||
for i in range(1000): | ||
action, _states = model.predict(obs) | ||
obs, rewards, dones, info = env.step(action) | ||
env.render() |