From e9e20397a4ec99f5607b91a27179f7262e763fd7 Mon Sep 17 00:00:00 2001 From: "nate.river" Date: Thu, 20 Mar 2025 17:11:17 +0800 Subject: [PATCH 1/4] use official mindspore for CI (#1999) --- .github/workflows/ci_pipeline.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci_pipeline.yaml b/.github/workflows/ci_pipeline.yaml index 1c52c64df..2daa959a3 100644 --- a/.github/workflows/ci_pipeline.yaml +++ b/.github/workflows/ci_pipeline.yaml @@ -129,8 +129,7 @@ jobs: OS: ubuntu-latest PYTHON: 3.11 run: | - python .github/install_mindspore.py - pip install -r download.txt + pip install mindspore - name: Test with pytest run: | pytest -vs tests/transformers/models/${{ matrix.alpha }}*/test_modeling* From a660aec9d1b945b770e80acb91810da6550797eb Mon Sep 17 00:00:00 2001 From: "nate.river" Date: Thu, 20 Mar 2025 19:26:16 +0800 Subject: [PATCH 2/4] Update make_wheel_releases.yml --- .github/workflows/make_wheel_releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make_wheel_releases.yml b/.github/workflows/make_wheel_releases.yml index 554ce5017..76dd5354a 100644 --- a/.github/workflows/make_wheel_releases.yml +++ b/.github/workflows/make_wheel_releases.yml @@ -27,7 +27,7 @@ jobs: run: python -m build --wheel - name: Upload file - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: mindnlp-whl path: dist/* From 797fade8c0bc98a3a57aa18def233166ee95dcb5 Mon Sep 17 00:00:00 2001 From: hongziqi <1102229410@qq.com> Date: Fri, 21 Mar 2025 16:28:03 +0800 Subject: [PATCH 3/4] Fix mint.nonzero interface call (#2001) --- mindnlp/core/ops/array.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mindnlp/core/ops/array.py b/mindnlp/core/ops/array.py index 1cd14c2c6..1eb318aee 100644 --- a/mindnlp/core/ops/array.py +++ b/mindnlp/core/ops/array.py @@ -130,7 +130,7 @@ def narrow(input, dim, start, length): has_nonzero = hasattr(mindspore.mint, 'nonzero') def nonzero(input, *, as_tuple=False): if use_pyboost() and has_nonzero: - return mindspore.mint.nonzero(input, as_tuple) + return mindspore.mint.nonzero(input, as_tuple=as_tuple) _nonzero = _get_cache_prim(ops.NonZero)() out = _nonzero(input) if as_tuple: From d3fb50d98f161b3f2dcc43f38da1d0db00985966 Mon Sep 17 00:00:00 2001 From: YNLIN Date: Sat, 22 Mar 2025 20:35:13 +0800 Subject: [PATCH 4/4] threads_exclusive_http_get fix --- mindnlp/utils/download.py | 7 ++++++- mindnlp/utils/winfcntlock.py | 7 ++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mindnlp/utils/download.py b/mindnlp/utils/download.py index 299f8d201..45ad56cc4 100644 --- a/mindnlp/utils/download.py +++ b/mindnlp/utils/download.py @@ -149,7 +149,7 @@ def threads_exclusive_http_get(url, storage_folder=None, md5sum=None, download_f if sys.platform != "win32": import fcntl # pylint: disable=import-error else: - import winfcntlock as fcntl # pylint: disable=import-error + from . import winfcntlock as fcntl # pylint: disable=import-error with open(lock_file_path, 'w') as lock_file: fd = lock_file.fileno() try: @@ -160,6 +160,11 @@ def threads_exclusive_http_get(url, storage_folder=None, md5sum=None, download_f raise exp finally: fcntl.flock(fd, fcntl.LOCK_UN) + lock_file.close() + try: + os.remove(lock_file_path) + except Exception as delete_exp: + logging.error(f"Failed to delete lock file: {delete_exp}") def http_get(url, path=None, md5sum=None, download_file_name=None, proxies=None, headers=None): diff --git a/mindnlp/utils/winfcntlock.py b/mindnlp/utils/winfcntlock.py index a3988e2c7..e6ab54d28 100644 --- a/mindnlp/utils/winfcntlock.py +++ b/mindnlp/utils/winfcntlock.py @@ -21,12 +21,13 @@ LOCK_EX = win32con.LOCKFILE_EXCLUSIVE_LOCK LOCK_SH = 0 # The default value LOCK_NB = win32con.LOCKFILE_FAIL_IMMEDIATELY +LOCK_UN = 0x08 __overlapped = pywintypes.OVERLAPPED() -def lock(file, flags): - hfile = win32file._get_osfhandle(file.fileno()) +def flock(file, flags): + hfile = win32file._get_osfhandle(file) win32file.LockFileEx(hfile, flags, 0, 0xffff0000, __overlapped) def unlock(file): - hfile = win32file._get_osfhandle(file.fileno()) + hfile = win32file._get_osfhandle(file) win32file.UnlockFileEx(hfile, 0, 0xffff0000, __overlapped)