Skip to content

Commit

Permalink
Updated train.py file for Ray
Browse files Browse the repository at this point in the history
  • Loading branch information
flimdejong committed Nov 18, 2024
1 parent 4d2d0d3 commit 396e527
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions roboteam_ai/src/RL/RL_Ray/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
print(f"Adding to PYTHONPATH: {roboteam_ai_root}") # Debug print
sys.path.append(roboteam_ai_root)

from roboteam_ai.src.RL.env import RoboTeamEnv
from roboteam_ai.src.RL.env2 import RoboTeamEnv

os.environ["PYTHONWARNINGS"] = "ignore::DeprecationWarning"
import warnings
warnings.filterwarnings('ignore', category=DeprecationWarning)

def verify_imports():
import numpy
Expand All @@ -26,21 +27,23 @@ def verify_imports():
def main():
verify_imports()

if not ray.is_initialized():
ray.init(
address="ray://localhost:10001",
ignore_reinit_error=True,
runtime_env={
"env_vars": {
"NUMPY_EXPERIMENTAL_ARRAY_FUNCTION": "0",

},
"pip": [
#"numpy==1.24.3",
#"pyzmq==26.2.0"
]
}
)
# if not ray.is_initialized():
# ray.init(
# address="ray://192.168.49.2:31001",
# ignore_reinit_error=True,
# runtime_env={
# "env_vars": {
# "NUMPY_EXPERIMENTAL_ARRAY_FUNCTION": "0",

# },
# # "pip": [
# # "numpy==1.24.3",
# # "pyzmq==26.2.0"
# # ]
# }
# )

ray.init()

# We can set env_config here
def env_creator(env_config):
Expand All @@ -49,7 +52,6 @@ def env_creator(env_config):
# Register the environment
register_env("RoboTeamEnv", env_creator)


# Create list of callbacks
callbacks = [
JsonLoggerCallback(),
Expand Down

0 comments on commit 396e527

Please sign in to comment.