Skip to content

Commit

Permalink
Merge pull request #90 from breezedeus/pytorch
Browse files Browse the repository at this point in the history
Fix compatibility issue of setting environment variables on Windows s…
  • Loading branch information
breezedeus authored Dec 8, 2024
2 parents 6811470 + 26a3b29 commit 47eae63
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
12 changes: 12 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Release Notes

## Update 2024.12.08:发布 V1.2.5.2

Bug Fixes:

* Fix compatibility issue of setting environment variables on Windows systems
* Use subprocess.run instead of os.system for better cross-platform support

Bug Fixes:

* 修复在 Windows 系统下设置环境变量的兼容性问题
* 使用 subprocess.run 替代 os.system 以提供更好的跨平台支持

## Update 2024.11.30:发布 V1.2.5.1

Major Changes:
Expand Down
2 changes: 1 addition & 1 deletion cnstd/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
# specific language governing permissions and limitations
# under the License.

__version__ = '1.2.5.1'
__version__ = '1.2.5.2'
7 changes: 5 additions & 2 deletions cnstd/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from functools import cmp_to_key
import shutil
import tempfile
import subprocess

from tqdm import tqdm
import cv2
Expand Down Expand Up @@ -117,11 +118,13 @@ def prepare_model_files(model_fp, remote_repo, mirror_url='https://hf-mirror.com
shutil.rmtree(str(model_dir))
model_dir.mkdir(parents=True)
download_cmd = f'huggingface-cli download --repo-type model --resume-download --local-dir-use-symlinks False {remote_repo} --local-dir {model_dir}'
os.system(download_cmd)
subprocess.run(download_cmd, shell=True)
if not model_fp.exists(): # download failed above
if model_dir.exists():
shutil.rmtree(str(model_dir))
os.system(f'HF_ENDPOINT={mirror_url} ' + download_cmd)
env = os.environ.copy()
env['HF_ENDPOINT'] = mirror_url
subprocess.run(download_cmd, env=env, shell=True)
return model_fp


Expand Down

0 comments on commit 47eae63

Please sign in to comment.