Bug fixed

parent cda66167
......@@ -130,4 +130,4 @@ dmypy.json
#NeuralMMO repository
neuralmmo/resource/maps
resource
......@@ -3,7 +3,7 @@
# FROM aicrowd/base-images:neural-mmo-py38-torch-190
# FROM aicrowd/base-images:neural-mmo-py38-torch-180
FROM aicrowd/base-images:neural-mmo-py38-torch-171
# FROM aicrowd/base-images:neural-mmo-py38-torch-171
# FROM aicrowd/base-images:neural-mmo-py38
USER root
......
from agents import BaselineCombatAgent, BaselineForageAgent, RandomNeuralMMOAgent, BaselineRandomAgent
from agents import BaselineCombatAgent, BaselineForageAgent, RandomNeuralMMOAgent, BaselineRandomAgent, NeuralBaselineAgent
class LocalEvaluationConfig:
......
......@@ -38,7 +38,10 @@ def createPolicies(config, mapPolicy):
def loadTrainer(config):
'''Create monolithic RLlib trainer object'''
torch.set_num_threads(1)
ray.init(local_mode=config.LOCAL_MODE)
ray.init(local_mode=config.LOCAL_MODE,
memory=2000 * 1024 * 1024,
object_store_memory=200 * 1024 * 1024,
)
#Register custom env
ray.tune.registry.register_env("Neural_MMO",
......@@ -88,12 +91,22 @@ def loadEvaluator(config):
def loadModel(config):
'''Load NN weights and optimizer state'''
imports()
trainer = loadTrainer(config)
utils.modelSize(trainer.defaultModel())
if config.LOAD:
trainer.restore()
return trainer
def imports():
'''conditional rl imports'''
global torch, ray, rllib, wrapper, utils
from neural_mmo.forge.ethyr.torch import utils
import torch
import ray
from ray import rllib
from projekt import rllib_wrapper as wrapper
class Anvil():
'''Neural MMO CLI powered by Google Fire
......@@ -120,32 +133,24 @@ class Anvil():
config.override(**kwargs)
self.config = config
def imports(self):
'''conditional rl imports'''
global torch, ray, rllib, wrapper, utils
from neural_mmo.forge.ethyr.torch import utils
import torch
import ray
from ray import rllib
from projekt import rllib_wrapper as wrapper
def train(self, **kwargs):
'''Train a model starting with the current value of --MODEL'''
self.imports()
imports()
loadModel(self.config).train()
def evaluate(self, **kwargs):
'''Evaluate a model on --EVAL_MAPS maps'''
self.config.EVALUATE = True
if not self.config.SCRIPTED:
self.imports()
imports()
loadEvaluator(self.config).evaluate(self.config.GENERALIZE)
def render(self, **kwargs):
'''Start a WebSocket server that autoconnects to the 3D Unity client'''
self.config.RENDER = True
if not self.config.SCRIPTED:
self.imports()
imports()
loadEvaluator(self.config).render()
def generate(self, **kwargs):
......
......@@ -80,7 +80,7 @@ class SmallMaps(config.SmallMaps, RLlibConfig, config.AllGameSystems):
EVALUATION_HORIZON = 1024
#Maps Path
PATH_MAPS = os.path.join(os.getcwd(),'neuralmmo/resource')
PATH_MAPS = os.path.join(os.getcwd(),'neuralmmo/resource/maps')
class Debug(SmallMaps, config.AllGameSystems):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment