def __init__(self, config, args): trinity = Trinity(Pantheon, God, Sword) self.env = smith.Native(config, args, trinity)
Application(env, god.tick.remote) if __name__ == '__main__': #Set up experiment configuration #ray infra, and command line args config = Experiment('env', Config).init( NPOP=1, NENT=128, ) args = parseArgs() if args.render: args.ray = 'local' lib.ray.init(args.ray) #Create a Trinity object specifying #Cluster, Server, and Core level execution trinity = Trinity(Pantheon, God, Sword) if args.render: render(trinity, config) trinity.init(config) #Run and print logs while True: time = trinity.step() TimeLog.log(trinity)
#Pass the tick thunk to a twisted WebSocket server god = trinity.god.remote(trinity, config, idx=0) model = Model(Policy, config).load(None, config.BEST).weights env = god.getEnv.remote() god.tick.remote(model) #Start a websocket server for rendering. This requires #forge/embyr, which is automatically downloaded from #jsuarez5341/neural-mmo-client in scripts/setup.sh from forge.embyr.twistedserver import Application Application(env, god.tick.remote) if __name__ == '__main__': #Experiment + command line args specify configuration #Trinity specifies Cluster-Server-Core infra modules config = Experiment('pop', Config).init() trinity = Trinity(Pantheon, God, Sword) args = parseArgs(config) #Blocking call: switches execution to a #Web Socket Server module if args.render: render(trinity, config, args) #Train until AGI emerges trinity.init(config, args) while True: log = trinity.step() print(log)
Application(env, sword.tick.remote) if __name__ == '__main__': #Set up experiment configuration #ray infra, and command line args config = Experiment('demo', Config).init( NPOP=1, NENT=128, ) args = parseArgs() if args.render: args.ray = 'local' lib.ray.init(args.ray) #Create a Trinity object specifying #Cluster, Server, and Core level execution trinity = Trinity(Pantheon, God, Sword) if args.render: render(trinity, config, args) trinity.init(config, args) #Run and print logs while True: time = trinity.step() logs = trinity.logs() logs = TimeLog.log(logs)