From d050beb6274bc295d8af51300e0679db4e2bad16 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 26 Nov 2023 11:40:46 +0000 Subject: [PATCH 1/3] Bump torch from 2.0.1 to 2.1.1 Bumps [torch](https://github.com/pytorch/pytorch) from 2.0.1 to 2.1.1. - [Release notes](https://github.com/pytorch/pytorch/releases) - [Changelog](https://github.com/pytorch/pytorch/blob/main/RELEASE.md) - [Commits](https://github.com/pytorch/pytorch/compare/v2.0.1...v2.1.1) --- updated-dependencies: - dependency-name: torch dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- requirements-freqai-rl.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-freqai-rl.txt b/requirements-freqai-rl.txt index fba25d409..6256c387a 100644 --- a/requirements-freqai-rl.txt +++ b/requirements-freqai-rl.txt @@ -2,7 +2,7 @@ -r requirements-freqai.txt # Required for freqai-rl -torch==2.0.1 +torch==2.1.1 #until these branches will be released we can use this gymnasium==0.29.1 stable_baselines3==2.2.1 From d3d9f3281ef19b242e3236fe38be08c19e618429 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 6 Dec 2023 19:26:09 +0100 Subject: [PATCH 2/3] Fix torch logging setup mess --- tests/freqai/conftest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/freqai/conftest.py b/tests/freqai/conftest.py index be208408f..d2383c5b9 100644 --- a/tests/freqai/conftest.py +++ b/tests/freqai/conftest.py @@ -20,6 +20,11 @@ def is_mac() -> bool: return "Darwin" in machine +@pytest.fixture(autouse=True) +def patch_torch_initlogs(mocker) -> None: + mocker.patch("torch._logging._init_logs") + + @pytest.fixture(scope="function") def freqai_conf(default_conf, tmp_path): freqaiconf = deepcopy(default_conf) From d123d3bb8212e449613f050574eb2e1a572b8c4e Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 7 Dec 2023 07:25:34 +0100 Subject: [PATCH 3/3] Completely mock Torch on macos we already skip tests - now we also need to skip it's imports. --- tests/freqai/conftest.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/freqai/conftest.py b/tests/freqai/conftest.py index d2383c5b9..8a9425a32 100644 --- a/tests/freqai/conftest.py +++ b/tests/freqai/conftest.py @@ -22,7 +22,17 @@ def is_mac() -> bool: @pytest.fixture(autouse=True) def patch_torch_initlogs(mocker) -> None: - mocker.patch("torch._logging._init_logs") + + if is_mac(): + # Mock torch import completely + import sys + import types + + module_name = 'torch' + mocked_module = types.ModuleType(module_name) + sys.modules[module_name] = mocked_module + else: + mocker.patch("torch._logging._init_logs") @pytest.fixture(scope="function")