yconst / balance-bot

OpenAI Gym environment for training a balancing bot
MIT License
34 stars 23 forks source link

Module baseline.deepq.models has no attribute mlp #2

Open gitndlaity opened 4 years ago

gitndlaity commented 4 years ago

Hello, What can we do in that case Thank You Screenshot from 2020-04-25 15-59-38

akashkmr27089 commented 4 years ago

import gym from baselines import deepq import balance_bot

def callback(lcl, glb):

stop training if reward exceeds 199

#is_solved = lcl['t'] > 100 and sum(lcl['episode_rewards'][-101:-1]) / 100 >= 199
is_solved = lcl['episode_rewards'][-1] >= 10
print('\r Current Score {} current status {}'.format(lcl['episode_rewards'][-1], is_solved),end=' ')
return is_solved

def main():

create the environment

env = gym.make("balancebot-v0") # <-- this we need to create

# create the learning agent
#model = deepq.models.mlp([16, 16])

# train the agent on the environment
act = deepq.learn(
    env, network='mlp', lr=1e-3,
    total_timesteps=200000, buffer_size=50000, exploration_fraction=0.5,
    exploration_final_eps=0.02, print_freq=5, callback=callback
)

# save trained model
act.save("balance.pkl")

if name == 'main': main()

akashkmr27089 commented 4 years ago

comment model = deepq.models.mlp([16, 16]) and assign network parameter to 'mlp' and change to total_timesteps according to new update gym environment

gitndlaity commented 4 years ago

Thanks, Sir it's working very well.

Le sam. 9 mai 2020 à 14:52, Aakash Kumar notifications@github.com a écrit :

comment model = deepq.models.mlp([16, 16]) and assign network parameter to 'mlp' and change to total_timesteps according to new update gym environment

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yconst/balance-bot/issues/2#issuecomment-626117659, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL5YPU4ZLNDUFVXM52SKFCLRQT4ULANCNFSM4MQUQZOQ .

-- Merci cordialemt