mirror of
https://github.com/saymrwulf/stable-baselines3.git
synced 2026-05-22 22:10:16 +00:00
21 lines
655 B
Python
21 lines
655 B
Python
import os
|
|
|
|
import gym
|
|
|
|
from torchy_baselines import TD3, CEMRL
|
|
|
|
def test_pendulum():
|
|
model = TD3('MlpPolicy', 'Pendulum-v0', policy_kwargs=dict(net_arch=[64, 64]), start_timesteps=100, verbose=1)
|
|
model.learn(total_timesteps=500, eval_freq=100)
|
|
model.save("test_save")
|
|
model.load("test_save")
|
|
os.remove("test_save.pth")
|
|
|
|
|
|
def test_cemrl():
|
|
model = CEMRL('MlpPolicy', 'Pendulum-v0', policy_kwargs=dict(net_arch=[64, 64]), pop_size=5, n_grad=2,
|
|
start_timesteps=100, verbose=1)
|
|
model.learn(total_timesteps=1000, eval_freq=500)
|
|
model.save("test_save")
|
|
model.load("test_save")
|
|
os.remove("test_save.pth")
|