From 9cf3ee59a0ce2f5419be264f909b2258977f194c Mon Sep 17 00:00:00 2001 From: chen de <72677659+cccddd77@users.noreply.github.com> Date: Wed, 29 May 2024 10:17:38 +0800 Subject: [PATCH 1/2] fix fuse-bn-add-relu bug. (#10533) fix NormalizationAddReluPass bug --- .../cudnn_fused_normalization_add_relu_pass.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/oneflow/core/job_rewriter/cudnn_fused_normalization_add_relu_pass.cpp b/oneflow/core/job_rewriter/cudnn_fused_normalization_add_relu_pass.cpp index 0a07f3a43c2..545dfb15414 100644 --- a/oneflow/core/job_rewriter/cudnn_fused_normalization_add_relu_pass.cpp +++ b/oneflow/core/job_rewriter/cudnn_fused_normalization_add_relu_pass.cpp @@ -84,7 +84,11 @@ Maybe CudnnFusedNormalizationAddReluPass::Apply(Job* job, JobPassCtx* ctx) OperatorConf new_op_conf = op_conf; auto mute_attrs = new_op_conf.mutable_user_conf()->mutable_attr(); auto training_it = mute_attrs->find("training"); - if (training_it != mute_attrs->end()) { mute_attrs->erase(training_it); } + if (training_it != mute_attrs->end()) { + const bool training = user_op_conf.attr("training"); + if (!training) { return; } + mute_attrs->erase(training_it); + } new_op_conf.mutable_user_conf()->set_op_type_name("cudnn_fused_" + op_type_name); job_builder.MutOpsOnlyOnce({new_op_conf}); }); From 850b4ad23567e809b52510e0e874a39e0d92206b Mon Sep 17 00:00:00 2001 From: Qunhong Zeng <871206929@qq.com> Date: Thu, 20 Jun 2024 14:21:19 +0800 Subject: [PATCH 2/2] fix: limit numpy version to < 2.0 and fix missing dependency (#10537) --- dev-requirements.txt | 3 ++- python/oneflow/mock_torch/mock_utils.py | 2 +- python/setup.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dev-requirements.txt b/dev-requirements.txt index 3c3eb680c4e..8827f89ccea 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,6 +1,6 @@ black==19.10b0; python_version >= "3.6" click==8.0.0; python_version >= "3.6" # https://github.com/psf/black/issues/2964 -numpy>=1.21.6 +numpy>=1.21.6, <2.0 protobuf>=3.9.2, <4.0 wheel tqdm @@ -16,3 +16,4 @@ pytest-xdist pytest-repeat rich portalocker +typing-extensions>=4.0.0, <5.0 diff --git a/python/oneflow/mock_torch/mock_utils.py b/python/oneflow/mock_torch/mock_utils.py index 64662be79c7..e695370a708 100644 --- a/python/oneflow/mock_torch/mock_utils.py +++ b/python/oneflow/mock_torch/mock_utils.py @@ -19,7 +19,7 @@ from collections import deque from importlib import import_module -if sys.version_info < (3, 8): +if sys.version_info <= (3, 8): try: from importlib_metadata import requires except ImportError: diff --git a/python/setup.py b/python/setup.py index 54adeaa904b..9f1bb18eae4 100644 --- a/python/setup.py +++ b/python/setup.py @@ -53,8 +53,9 @@ def get_version(): REQUIRED_PACKAGES = [ - f"numpy>={np.__version__}", + f"numpy>={np.__version__}, <2.0", "protobuf>=3.9.2, <4.0", + "typing-extensions>=4.0.0, <5.0", "tqdm", "requests", "pillow",