From ea73fb43249577571b79c71213f6cc9b8f6a6732 Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Wed, 29 Nov 2023 19:08:00 +0100 Subject: [PATCH 01/21] feat: update to SheepRLv0.4.8 --- diambra/arena/sheeprl/make_sheeprl_env.py | 72 +++++++++++------------ setup.py | 2 +- 2 files changed, 36 insertions(+), 38 deletions(-) diff --git a/diambra/arena/sheeprl/make_sheeprl_env.py b/diambra/arena/sheeprl/make_sheeprl_env.py index e7da196..d567f9e 100644 --- a/diambra/arena/sheeprl/make_sheeprl_env.py +++ b/diambra/arena/sheeprl/make_sheeprl_env.py @@ -61,18 +61,36 @@ def thunk() -> gym.Env: instantiate_kwargs["rank"] = rank + vector_env_idx env = hydra.utils.instantiate(cfg.env.wrapper, **instantiate_kwargs) + if not ( + isinstance(cfg.algo.mlp_keys.encoder, list) + and isinstance(cfg.algo.cnn_keys.encoder, list) + and len(cfg.algo.cnn_keys.encoder + cfg.algo.mlp_keys.encoder) > 0 + ): + raise ValueError( + "`algo.cnn_keys.encoder` and `algo.mlp_keys.encoder` must be lists of strings, got: " + f"cnn encoder keys `{cfg.algo.cnn_keys.encoder}` of type `{type(cfg.algo.cnn_keys.encoder)}` " + f"and mlp encoder keys `{cfg.algo.mlp_keys.encoder}` of type `{type(cfg.algo.mlp_keys.encoder)}`. " + "Both must be non-empty lists." + ) + + if ( + len( + set(k for k in env.observation_space.keys()).intersection( + set(cfg.algo.mlp_keys.encoder + cfg.algo.cnn_keys.encoder) + ) + ) + == 0 + ): + raise ValueError( + f"The user specified keys `{cfg.algo.mlp_keys.encoder + cfg.algo.cnn_keys.encoder}` " + "are not a subset of the " + f"environment `{env.observation_space.keys()}` observation keys. Please check your config file." + ) + env_cnn_keys = set( - [ - k - for k in env.observation_space.spaces.keys() - if len(env.observation_space[k].shape) in {2, 3} - ] + [k for k in env.observation_space.spaces.keys() if len(env.observation_space[k].shape) in {2, 3}] ) - if cfg.cnn_keys.encoder is None: - user_cnn_keys = set() - else: - user_cnn_keys = set(cfg.cnn_keys.encoder) - cnn_keys = env_cnn_keys.intersection(user_cnn_keys) + cnn_keys = env_cnn_keys.intersection(set(cfg.algo.cnn_keys.encoder)) def transform_obs(obs: Dict[str, Any]): for k in cnn_keys: @@ -93,9 +111,7 @@ def transform_obs(obs: Dict[str, Any]): # resize if current_obs.shape[:-1] != (cfg.env.screen_size, cfg.env.screen_size): current_obs = cv2.resize( - current_obs, - (cfg.env.screen_size, cfg.env.screen_size), - interpolation=cv2.INTER_AREA, + current_obs, (cfg.env.screen_size, cfg.env.screen_size), interpolation=cv2.INTER_AREA ) # to grayscale @@ -116,14 +132,7 @@ def transform_obs(obs: Dict[str, Any]): env = gym.wrappers.TransformObservation(env, transform_obs) for k in cnn_keys: env.observation_space[k] = gym.spaces.Box( - 0, - 255, - ( - 1 if cfg.env.grayscale else 3, - cfg.env.screen_size, - cfg.env.screen_size, - ), - np.uint8, + 0, 255, (1 if cfg.env.grayscale else 3, cfg.env.screen_size, cfg.env.screen_size), np.uint8 ) if cnn_keys is not None and len(cnn_keys) > 0 and cfg.env.frame_stack > 1: @@ -131,9 +140,7 @@ def transform_obs(obs: Dict[str, Any]): raise ValueError( f"The frame stack dilation argument must be greater than zero, got: {cfg.env.frame_stack_dilation}" ) - env = FrameStack( - env, cfg.env.frame_stack, cnn_keys, cfg.env.frame_stack_dilation - ) + env = FrameStack(env, cfg.env.frame_stack, cnn_keys, cfg.env.frame_stack_dilation) if cfg.env.reward_as_observation: env = RewardAsObservationWrapper(env) @@ -141,24 +148,15 @@ def transform_obs(obs: Dict[str, Any]): env.action_space.seed(seed) env.observation_space.seed(seed) if cfg.env.max_episode_steps and cfg.env.max_episode_steps > 0: - env = gym.wrappers.TimeLimit( - env, max_episode_steps=cfg.env.max_episode_steps - ) + env = gym.wrappers.TimeLimit(env, max_episode_steps=cfg.env.max_episode_steps) env = gym.wrappers.RecordEpisodeStatistics(env) - if ( - cfg.env.capture_video - and rank == 0 - and vector_env_idx == 0 - and run_name is not None - ): + if cfg.env.capture_video and rank == 0 and vector_env_idx == 0 and run_name is not None: if cfg.env.grayscale: env = GrayscaleRenderWrapper(env) env = gym.experimental.wrappers.RecordVideoV0( - env, - os.path.join(run_name, prefix + "_videos" if prefix else "videos"), - disable_logger=True, + env, os.path.join(run_name, prefix + "_videos" if prefix else "videos"), disable_logger=True ) env.metadata["render_fps"] = env.frames_per_sec return env - return thunk + return thunk \ No newline at end of file diff --git a/setup.py b/setup.py index ed50d8e..8dc8107 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "stable-baselines3": ["stable-baselines3[extra]~=2.1.0", "pyyaml"], "ray-rllib": ["ray[rllib]~=2.7.0", "tensorflow", "torch", "pyyaml"], "sheeprl": [ - "sheeprl==0.4.7", + "sheeprl==0.4.8", "importlib-resources==6.1.0", ], } From b242f372aef9840707b0445f8d3f29f9bcd55240 Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Tue, 19 Dec 2023 15:30:54 +0100 Subject: [PATCH 02/21] feat: update SheepRL to v0.5.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8dc8107..34bc88b 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "stable-baselines3": ["stable-baselines3[extra]~=2.1.0", "pyyaml"], "ray-rllib": ["ray[rllib]~=2.7.0", "tensorflow", "torch", "pyyaml"], "sheeprl": [ - "sheeprl==0.4.8", + "sheeprl==0.5.1", "importlib-resources==6.1.0", ], } From 6051244aec26e298afcb54bb2bb6bc0525eb9c1e Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Tue, 19 Dec 2023 15:31:48 +0100 Subject: [PATCH 03/21] feat: added pre-cooked dependenvies images --- images/sheeprl/Dockerfile | 16 ++++++++++++++++ images/sheeprl/on.arg | 3 +++ 2 files changed, 19 insertions(+) create mode 100644 images/sheeprl/Dockerfile create mode 100644 images/sheeprl/on.arg diff --git a/images/sheeprl/Dockerfile b/images/sheeprl/Dockerfile new file mode 100644 index 0000000..d50689a --- /dev/null +++ b/images/sheeprl/Dockerfile @@ -0,0 +1,16 @@ +ARG on +FROM python:${on} + +RUN apt-get -qy update && \ + apt-get -qy install libgl1 && \ + rm -rf /var/lib/apt/lists/* && \ + apt-get -qy clean + +ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 + +# Copy arena to tmp since bind-mount is read-only and pip doesn't support +# out-of-tree builds. +RUN --mount=target=/usr/src/arena,type=bind,source=. \ + cp -r /usr/src/arena /tmp/arena && \ + pip install /tmp/arena[sheeprl] && \ + rm -rf /tmp/arena diff --git a/images/sheeprl/on.arg b/images/sheeprl/on.arg new file mode 100644 index 0000000..b8de1df --- /dev/null +++ b/images/sheeprl/on.arg @@ -0,0 +1,3 @@ +3.10-bullseye +3.9-bullseye +3.8-bullseye From bc8b63a21d4622aff793b43a3c708d6d4dd10d3e Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Mon, 26 Feb 2024 15:22:37 +0100 Subject: [PATCH 04/21] feat: update sheeprl to v0.5.4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 34bc88b..c5b5c5d 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "stable-baselines3": ["stable-baselines3[extra]~=2.1.0", "pyyaml"], "ray-rllib": ["ray[rllib]~=2.7.0", "tensorflow", "torch", "pyyaml"], "sheeprl": [ - "sheeprl==0.5.1", + "sheeprl==0.5.4", "importlib-resources==6.1.0", ], } From 0f41914d52455344dbd6146abd4bb9126c6605c7 Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Mon, 26 Feb 2024 15:28:12 +0100 Subject: [PATCH 05/21] feat: update sheeprl to v0.5.4 --- images/sheeprl/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/images/sheeprl/Dockerfile b/images/sheeprl/Dockerfile index 5e64697..7641987 100644 --- a/images/sheeprl/Dockerfile +++ b/images/sheeprl/Dockerfile @@ -17,4 +17,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena[sheeprl] && \ rm -rf /tmp/arena -ENV HF_HOME=/tmp \ No newline at end of file +ENV HF_HOME=/tmp From 276481fac6b65eeb69d3503798c1b3f4bef86acf Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Tue, 19 Dec 2023 15:30:54 +0100 Subject: [PATCH 06/21] feat: update SheepRL to v0.5.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8dc8107..34bc88b 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "stable-baselines3": ["stable-baselines3[extra]~=2.1.0", "pyyaml"], "ray-rllib": ["ray[rllib]~=2.7.0", "tensorflow", "torch", "pyyaml"], "sheeprl": [ - "sheeprl==0.4.8", + "sheeprl==0.5.1", "importlib-resources==6.1.0", ], } From 2a03981706a35c053d9a04a1f16e0686f52866af Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Tue, 19 Dec 2023 15:31:48 +0100 Subject: [PATCH 07/21] feat: added pre-cooked dependenvies images --- images/sheeprl/Dockerfile | 16 ++++++++++++++++ images/sheeprl/on.arg | 3 +++ 2 files changed, 19 insertions(+) create mode 100644 images/sheeprl/Dockerfile create mode 100644 images/sheeprl/on.arg diff --git a/images/sheeprl/Dockerfile b/images/sheeprl/Dockerfile new file mode 100644 index 0000000..d50689a --- /dev/null +++ b/images/sheeprl/Dockerfile @@ -0,0 +1,16 @@ +ARG on +FROM python:${on} + +RUN apt-get -qy update && \ + apt-get -qy install libgl1 && \ + rm -rf /var/lib/apt/lists/* && \ + apt-get -qy clean + +ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 + +# Copy arena to tmp since bind-mount is read-only and pip doesn't support +# out-of-tree builds. +RUN --mount=target=/usr/src/arena,type=bind,source=. \ + cp -r /usr/src/arena /tmp/arena && \ + pip install /tmp/arena[sheeprl] && \ + rm -rf /tmp/arena diff --git a/images/sheeprl/on.arg b/images/sheeprl/on.arg new file mode 100644 index 0000000..b8de1df --- /dev/null +++ b/images/sheeprl/on.arg @@ -0,0 +1,3 @@ +3.10-bullseye +3.9-bullseye +3.8-bullseye From 8272dbcaf6a00c69e3cf18dc7560919762707780 Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Mon, 26 Feb 2024 15:22:37 +0100 Subject: [PATCH 08/21] feat: update sheeprl to v0.5.4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 34bc88b..c5b5c5d 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "stable-baselines3": ["stable-baselines3[extra]~=2.1.0", "pyyaml"], "ray-rllib": ["ray[rllib]~=2.7.0", "tensorflow", "torch", "pyyaml"], "sheeprl": [ - "sheeprl==0.5.1", + "sheeprl==0.5.4", "importlib-resources==6.1.0", ], } From bef61df2e8b3012aac3bf46742a927c4ed8849a2 Mon Sep 17 00:00:00 2001 From: Alessandro Palmas Date: Sat, 6 Jan 2024 11:50:39 -0500 Subject: [PATCH 09/21] Update copyright --- LICENSE.txt | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index a298784..b716fe0 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -© 2018-2023, DIAMBRA Inc., https://diambra.ai +© 2018-2024, DIAMBRA Inc., https://diambra.ai Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index 4033578..24a823a 100644 --- a/README.md +++ b/README.md @@ -241,4 +241,4 @@ Paper: https://arxiv. DIAMBRA Arena software package is subject to our Terms of Use. By using it, you accept them in full. -###### DIAMBRA, Inc. © Copyright 2018-2023. All Rights Reserved. +###### DIAMBRA, Inc. © Copyright 2018-2024. All Rights Reserved. From 288d592bec31284434732127c1411f0c2def8428 Mon Sep 17 00:00:00 2001 From: Alessandro Palmas Date: Sun, 18 Feb 2024 11:49:07 -0500 Subject: [PATCH 10/21] Removed GetError call, deprecated. Protobuf interface to be updated with next engine minor version change --- diambra/arena/engine/interface.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/diambra/arena/engine/interface.py b/diambra/arena/engine/interface.py index 0ac5f28..285bc59 100644 --- a/diambra/arena/engine/interface.py +++ b/diambra/arena/engine/interface.py @@ -5,9 +5,7 @@ from diambra.engine import Client, model import grpc -CONNECTION_FAILED_ERROR_TEXT = """DIAMBRA Arena failed to connect to the Engine Server. - - If you are running a Python script, are you running with DIAMBRA CLI: `diambra run python script.py`? - - If you are running a Python Notebook, have you started Jupyter Notebook with DIAMBRA CLI: `diambra run jupyter notebook`? +CONNECTION_FAILED_ERROR_TEXT = """DIAMBRA Arena failed to connect to the Engine Server. Are you running it with DIAMBRA CLI: `diambra run python script.py`? See the docs (https://docs.diambra.ai) for additional details, or join DIAMBRA Discord Server (https://diambra.ai/discord) for support.""" @@ -32,12 +30,7 @@ def env_init(self, env_settings_pb): try: response = self.client.EnvInit(env_settings_pb) except: - try: - response = self.client.GetError(model.Empty()) - exceptionMessage = "Received error message from engine: " + response.errorMessage - self.logger.error(exceptionMessage) - except: - raise Exception(CONNECTION_FAILED_ERROR_TEXT) + raise Exception(CONNECTION_FAILED_ERROR_TEXT) return response From 1e9e9431d0bc8b2bbb50ce2a18391924a85ae8c7 Mon Sep 17 00:00:00 2001 From: Alessandro Palmas Date: Fri, 16 Feb 2024 01:17:14 -0500 Subject: [PATCH 11/21] Add support for HF download --- images/base/Dockerfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/images/base/Dockerfile b/images/base/Dockerfile index aac5d5a..911e337 100644 --- a/images/base/Dockerfile +++ b/images/base/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 +ENV HF_HOME=/tmp # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. @@ -14,3 +15,5 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ cp -r /usr/src/arena /tmp/arena && \ pip install /tmp/arena && \ rm -rf /tmp/arena + +RUN pip install huggingface_hub From b61bbf13bb3878376258f4dba84eb5ec6e288ef8 Mon Sep 17 00:00:00 2001 From: Alessandro Palmas Date: Sun, 18 Feb 2024 15:39:48 -0500 Subject: [PATCH 12/21] Add HF and python 3.8 support to image build --- images/base/on.arg | 1 + images/ray_rllib/Dockerfile | 3 +++ images/ray_rllib/on.arg | 1 + images/sheeprl/Dockerfile | 3 +++ images/stable-baselines/Dockerfile | 3 +++ images/stable-baselines3/Dockerfile | 3 +++ images/stable-baselines3/on.arg | 1 + 7 files changed, 15 insertions(+) diff --git a/images/base/on.arg b/images/base/on.arg index c0edbb8..0950f0c 100644 --- a/images/base/on.arg +++ b/images/base/on.arg @@ -1,3 +1,4 @@ 3.10-bullseye 3.9-bullseye +3.8-bullseye 3.7-bullseye diff --git a/images/ray_rllib/Dockerfile b/images/ray_rllib/Dockerfile index e913449..150495b 100644 --- a/images/ray_rllib/Dockerfile +++ b/images/ray_rllib/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 HOME=/tmp +ENV HF_HOME=/tmp # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. @@ -14,3 +15,5 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ cp -r /usr/src/arena /tmp/arena && \ pip install /tmp/arena[ray-rllib] && \ rm -rf /tmp/arena + +RUN pip install huggingface_hub diff --git a/images/ray_rllib/on.arg b/images/ray_rllib/on.arg index dfb0f67..b8de1df 100644 --- a/images/ray_rllib/on.arg +++ b/images/ray_rllib/on.arg @@ -1,2 +1,3 @@ 3.10-bullseye 3.9-bullseye +3.8-bullseye diff --git a/images/sheeprl/Dockerfile b/images/sheeprl/Dockerfile index d50689a..d5ca75f 100644 --- a/images/sheeprl/Dockerfile +++ b/images/sheeprl/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 +ENV HF_HOME=/tmp # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. @@ -14,3 +15,5 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ cp -r /usr/src/arena /tmp/arena && \ pip install /tmp/arena[sheeprl] && \ rm -rf /tmp/arena + +RUN pip install huggingface_hub diff --git a/images/stable-baselines/Dockerfile b/images/stable-baselines/Dockerfile index 6708702..0852752 100644 --- a/images/stable-baselines/Dockerfile +++ b/images/stable-baselines/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 +ENV HF_HOME=/tmp # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. @@ -18,3 +19,5 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena[stable-baselines] && \ pip install tensorflow==1.15.0 && \ rm -rf /tmp/arena + +RUN pip install huggingface_hub diff --git a/images/stable-baselines3/Dockerfile b/images/stable-baselines3/Dockerfile index 347afb1..4b85b64 100644 --- a/images/stable-baselines3/Dockerfile +++ b/images/stable-baselines3/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 +ENV HF_HOME=/tmp # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. @@ -14,3 +15,5 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ cp -r /usr/src/arena /tmp/arena && \ pip install /tmp/arena[stable-baselines3] && \ rm -rf /tmp/arena + +RUN pip install huggingface_hub diff --git a/images/stable-baselines3/on.arg b/images/stable-baselines3/on.arg index dfb0f67..b8de1df 100644 --- a/images/stable-baselines3/on.arg +++ b/images/stable-baselines3/on.arg @@ -1,2 +1,3 @@ 3.10-bullseye 3.9-bullseye +3.8-bullseye From 22b9210a8e22e566766513642b1ccf515105a0cd Mon Sep 17 00:00:00 2001 From: Alessandro Palmas Date: Mon, 19 Feb 2024 16:17:02 -0500 Subject: [PATCH 13/21] Rearranging instructions in dockerfiles --- images/base/Dockerfile | 5 +++-- images/ray_rllib/Dockerfile | 5 +++-- images/sheeprl/Dockerfile | 5 +++-- images/stable-baselines/Dockerfile | 5 +++-- images/stable-baselines3/Dockerfile | 5 +++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/images/base/Dockerfile b/images/base/Dockerfile index 911e337..70415c2 100644 --- a/images/base/Dockerfile +++ b/images/base/Dockerfile @@ -7,7 +7,8 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 -ENV HF_HOME=/tmp + +RUN pip install huggingface_hub # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. @@ -16,4 +17,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena && \ rm -rf /tmp/arena -RUN pip install huggingface_hub +ENV HF_HOME=/tmp diff --git a/images/ray_rllib/Dockerfile b/images/ray_rllib/Dockerfile index 150495b..cc3e66f 100644 --- a/images/ray_rllib/Dockerfile +++ b/images/ray_rllib/Dockerfile @@ -7,7 +7,8 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 HOME=/tmp -ENV HF_HOME=/tmp + +RUN pip install huggingface_hub # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. @@ -16,4 +17,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena[ray-rllib] && \ rm -rf /tmp/arena -RUN pip install huggingface_hub +ENV HF_HOME=/tmp diff --git a/images/sheeprl/Dockerfile b/images/sheeprl/Dockerfile index d5ca75f..7641987 100644 --- a/images/sheeprl/Dockerfile +++ b/images/sheeprl/Dockerfile @@ -7,7 +7,8 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 -ENV HF_HOME=/tmp + +RUN pip install huggingface_hub # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. @@ -16,4 +17,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena[sheeprl] && \ rm -rf /tmp/arena -RUN pip install huggingface_hub +ENV HF_HOME=/tmp diff --git a/images/stable-baselines/Dockerfile b/images/stable-baselines/Dockerfile index 0852752..09fe03a 100644 --- a/images/stable-baselines/Dockerfile +++ b/images/stable-baselines/Dockerfile @@ -7,7 +7,8 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 -ENV HF_HOME=/tmp + +RUN pip install huggingface_hub # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. @@ -20,4 +21,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install tensorflow==1.15.0 && \ rm -rf /tmp/arena -RUN pip install huggingface_hub +ENV HF_HOME=/tmp diff --git a/images/stable-baselines3/Dockerfile b/images/stable-baselines3/Dockerfile index 4b85b64..936625d 100644 --- a/images/stable-baselines3/Dockerfile +++ b/images/stable-baselines3/Dockerfile @@ -7,7 +7,8 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 -ENV HF_HOME=/tmp + +RUN pip install huggingface_hub # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. @@ -16,4 +17,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena[stable-baselines3] && \ rm -rf /tmp/arena -RUN pip install huggingface_hub +ENV HF_HOME=/tmp From a650ada7066234c536e5793863a258c1f687fbd2 Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Wed, 29 Nov 2023 19:08:00 +0100 Subject: [PATCH 14/21] feat: update to SheepRLv0.4.8 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c5b5c5d..8dc8107 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "stable-baselines3": ["stable-baselines3[extra]~=2.1.0", "pyyaml"], "ray-rllib": ["ray[rllib]~=2.7.0", "tensorflow", "torch", "pyyaml"], "sheeprl": [ - "sheeprl==0.5.4", + "sheeprl==0.4.8", "importlib-resources==6.1.0", ], } From 9bcfab4595b22c6dfca1c24739501c02096c7ec3 Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Tue, 19 Dec 2023 15:30:54 +0100 Subject: [PATCH 15/21] feat: update SheepRL to v0.5.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8dc8107..34bc88b 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "stable-baselines3": ["stable-baselines3[extra]~=2.1.0", "pyyaml"], "ray-rllib": ["ray[rllib]~=2.7.0", "tensorflow", "torch", "pyyaml"], "sheeprl": [ - "sheeprl==0.4.8", + "sheeprl==0.5.1", "importlib-resources==6.1.0", ], } From 4cf734eae1a7e77f95541a15edc141c2d279dd9d Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Tue, 19 Dec 2023 15:31:48 +0100 Subject: [PATCH 16/21] feat: added pre-cooked dependenvies images --- images/sheeprl/Dockerfile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/images/sheeprl/Dockerfile b/images/sheeprl/Dockerfile index 7641987..d50689a 100644 --- a/images/sheeprl/Dockerfile +++ b/images/sheeprl/Dockerfile @@ -8,13 +8,9 @@ RUN apt-get -qy update && \ ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 -RUN pip install huggingface_hub - # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. RUN --mount=target=/usr/src/arena,type=bind,source=. \ cp -r /usr/src/arena /tmp/arena && \ pip install /tmp/arena[sheeprl] && \ rm -rf /tmp/arena - -ENV HF_HOME=/tmp From feec29268ec1ceb9745f332f9ffe7ad9984fb895 Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Mon, 26 Feb 2024 15:22:37 +0100 Subject: [PATCH 17/21] feat: update sheeprl to v0.5.4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 34bc88b..c5b5c5d 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "stable-baselines3": ["stable-baselines3[extra]~=2.1.0", "pyyaml"], "ray-rllib": ["ray[rllib]~=2.7.0", "tensorflow", "torch", "pyyaml"], "sheeprl": [ - "sheeprl==0.5.1", + "sheeprl==0.5.4", "importlib-resources==6.1.0", ], } From b6fa459d132efe173fe2fc2d59215909fc9bb4e7 Mon Sep 17 00:00:00 2001 From: Michele Milesi Date: Tue, 19 Dec 2023 15:30:54 +0100 Subject: [PATCH 18/21] feat: update SheepRL to v0.5.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c5b5c5d..34bc88b 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ "stable-baselines3": ["stable-baselines3[extra]~=2.1.0", "pyyaml"], "ray-rllib": ["ray[rllib]~=2.7.0", "tensorflow", "torch", "pyyaml"], "sheeprl": [ - "sheeprl==0.5.4", + "sheeprl==0.5.1", "importlib-resources==6.1.0", ], } From 2d62891099c66b168a3a05cf439aa33849936775 Mon Sep 17 00:00:00 2001 From: Alessandro Palmas Date: Fri, 16 Feb 2024 01:17:14 -0500 Subject: [PATCH 19/21] Add support for HF download --- images/base/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/images/base/Dockerfile b/images/base/Dockerfile index 70415c2..7741d50 100644 --- a/images/base/Dockerfile +++ b/images/base/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 +ENV HF_HOME=/tmp RUN pip install huggingface_hub @@ -17,4 +18,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena && \ rm -rf /tmp/arena -ENV HF_HOME=/tmp +RUN pip install huggingface_hub From 58497ac2187480e40babaa55f625567383a75ac2 Mon Sep 17 00:00:00 2001 From: Alessandro Palmas Date: Sun, 18 Feb 2024 15:39:48 -0500 Subject: [PATCH 20/21] Add HF and python 3.8 support to image build --- images/ray_rllib/Dockerfile | 3 ++- images/sheeprl/Dockerfile | 3 +++ images/stable-baselines/Dockerfile | 3 ++- images/stable-baselines3/Dockerfile | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/images/ray_rllib/Dockerfile b/images/ray_rllib/Dockerfile index cc3e66f..815af23 100644 --- a/images/ray_rllib/Dockerfile +++ b/images/ray_rllib/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 HOME=/tmp +ENV HF_HOME=/tmp RUN pip install huggingface_hub @@ -17,4 +18,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena[ray-rllib] && \ rm -rf /tmp/arena -ENV HF_HOME=/tmp +RUN pip install huggingface_hub diff --git a/images/sheeprl/Dockerfile b/images/sheeprl/Dockerfile index d50689a..d5ca75f 100644 --- a/images/sheeprl/Dockerfile +++ b/images/sheeprl/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 +ENV HF_HOME=/tmp # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. @@ -14,3 +15,5 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ cp -r /usr/src/arena /tmp/arena && \ pip install /tmp/arena[sheeprl] && \ rm -rf /tmp/arena + +RUN pip install huggingface_hub diff --git a/images/stable-baselines/Dockerfile b/images/stable-baselines/Dockerfile index 09fe03a..c2e9c4c 100644 --- a/images/stable-baselines/Dockerfile +++ b/images/stable-baselines/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 +ENV HF_HOME=/tmp RUN pip install huggingface_hub @@ -21,4 +22,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install tensorflow==1.15.0 && \ rm -rf /tmp/arena -ENV HF_HOME=/tmp +RUN pip install huggingface_hub diff --git a/images/stable-baselines3/Dockerfile b/images/stable-baselines3/Dockerfile index 936625d..92b25df 100644 --- a/images/stable-baselines3/Dockerfile +++ b/images/stable-baselines3/Dockerfile @@ -7,6 +7,7 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 +ENV HF_HOME=/tmp RUN pip install huggingface_hub @@ -17,4 +18,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena[stable-baselines3] && \ rm -rf /tmp/arena -ENV HF_HOME=/tmp +RUN pip install huggingface_hub From 1f1df6e7c09a6eda50fac78066e1e0f3ef1dcdb9 Mon Sep 17 00:00:00 2001 From: Alessandro Palmas Date: Mon, 19 Feb 2024 16:17:02 -0500 Subject: [PATCH 21/21] Rearranging instructions in dockerfiles --- images/base/Dockerfile | 5 +++-- images/ray_rllib/Dockerfile | 5 +++-- images/sheeprl/Dockerfile | 5 +++-- images/stable-baselines/Dockerfile | 5 +++-- images/stable-baselines3/Dockerfile | 5 +++-- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/images/base/Dockerfile b/images/base/Dockerfile index 7741d50..33498fb 100644 --- a/images/base/Dockerfile +++ b/images/base/Dockerfile @@ -7,7 +7,8 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 -ENV HF_HOME=/tmp + +RUN pip install huggingface_hub RUN pip install huggingface_hub @@ -18,4 +19,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena && \ rm -rf /tmp/arena -RUN pip install huggingface_hub +ENV HF_HOME=/tmp diff --git a/images/ray_rllib/Dockerfile b/images/ray_rllib/Dockerfile index 815af23..ea5bb4a 100644 --- a/images/ray_rllib/Dockerfile +++ b/images/ray_rllib/Dockerfile @@ -7,7 +7,8 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 HOME=/tmp -ENV HF_HOME=/tmp + +RUN pip install huggingface_hub RUN pip install huggingface_hub @@ -18,4 +19,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena[ray-rllib] && \ rm -rf /tmp/arena -RUN pip install huggingface_hub +ENV HF_HOME=/tmp diff --git a/images/sheeprl/Dockerfile b/images/sheeprl/Dockerfile index d5ca75f..7641987 100644 --- a/images/sheeprl/Dockerfile +++ b/images/sheeprl/Dockerfile @@ -7,7 +7,8 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 -ENV HF_HOME=/tmp + +RUN pip install huggingface_hub # Copy arena to tmp since bind-mount is read-only and pip doesn't support # out-of-tree builds. @@ -16,4 +17,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena[sheeprl] && \ rm -rf /tmp/arena -RUN pip install huggingface_hub +ENV HF_HOME=/tmp diff --git a/images/stable-baselines/Dockerfile b/images/stable-baselines/Dockerfile index c2e9c4c..0cb0291 100644 --- a/images/stable-baselines/Dockerfile +++ b/images/stable-baselines/Dockerfile @@ -7,7 +7,8 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 -ENV HF_HOME=/tmp + +RUN pip install huggingface_hub RUN pip install huggingface_hub @@ -22,4 +23,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install tensorflow==1.15.0 && \ rm -rf /tmp/arena -RUN pip install huggingface_hub +ENV HF_HOME=/tmp diff --git a/images/stable-baselines3/Dockerfile b/images/stable-baselines3/Dockerfile index 92b25df..ac2e0e5 100644 --- a/images/stable-baselines3/Dockerfile +++ b/images/stable-baselines3/Dockerfile @@ -7,7 +7,8 @@ RUN apt-get -qy update && \ apt-get -qy clean ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 -ENV HF_HOME=/tmp + +RUN pip install huggingface_hub RUN pip install huggingface_hub @@ -18,4 +19,4 @@ RUN --mount=target=/usr/src/arena,type=bind,source=. \ pip install /tmp/arena[stable-baselines3] && \ rm -rf /tmp/arena -RUN pip install huggingface_hub +ENV HF_HOME=/tmp