atomgit 1.0.3__tar.gz → 1.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {atomgit-1.0.3 → atomgit-1.0.4}/PKG-INFO +1 -1
- {atomgit-1.0.3 → atomgit-1.0.4}/__init__.py +1 -1
- {atomgit-1.0.3 → atomgit-1.0.4}/api.py +10 -14
- {atomgit-1.0.3 → atomgit-1.0.4}/atomgit.egg-info/PKG-INFO +1 -1
- {atomgit-1.0.3 → atomgit-1.0.4}/cli.py +1 -1
- {atomgit-1.0.3 → atomgit-1.0.4}/setup.py +1 -1
- {atomgit-1.0.3 → atomgit-1.0.4}/README.md +0 -0
- {atomgit-1.0.3 → atomgit-1.0.4}/__main__.py +0 -0
- {atomgit-1.0.3 → atomgit-1.0.4}/atomgit.egg-info/SOURCES.txt +0 -0
- {atomgit-1.0.3 → atomgit-1.0.4}/atomgit.egg-info/dependency_links.txt +0 -0
- {atomgit-1.0.3 → atomgit-1.0.4}/atomgit.egg-info/entry_points.txt +0 -0
- {atomgit-1.0.3 → atomgit-1.0.4}/atomgit.egg-info/requires.txt +0 -0
- {atomgit-1.0.3 → atomgit-1.0.4}/atomgit.egg-info/top_level.txt +0 -0
- {atomgit-1.0.3 → atomgit-1.0.4}/atomgit_hub.py +0 -0
- {atomgit-1.0.3 → atomgit-1.0.4}/config.py +0 -0
- {atomgit-1.0.3 → atomgit-1.0.4}/setup.cfg +0 -0
- {atomgit-1.0.3 → atomgit-1.0.4}/test.py +0 -0
- {atomgit-1.0.3 → atomgit-1.0.4}/utils.py +0 -0
|
@@ -13,12 +13,7 @@ os.makedirs(cache_dir, exist_ok=True)
|
|
|
13
13
|
os.environ["HF_HOME"] = cache_dir
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
from huggingface_hub import hf_hub_download, create_repo, snapshot_download
|
|
17
|
-
|
|
18
|
-
try:
|
|
19
|
-
from .atomgit_hub import upload_folder as atomgit_upload_folder
|
|
20
|
-
except ImportError:
|
|
21
|
-
from atomgit_hub import upload_folder as atomgit_upload_folder
|
|
16
|
+
from huggingface_hub import hf_hub_download, upload_folder, create_repo, snapshot_download, constants as hf_constants
|
|
22
17
|
|
|
23
18
|
try:
|
|
24
19
|
from .config import config
|
|
@@ -153,15 +148,16 @@ class HuggingFaceAPI:
|
|
|
153
148
|
# 复制文件到临时目录
|
|
154
149
|
import shutil
|
|
155
150
|
shutil.copy2(file_path, target_file)
|
|
156
|
-
# 使用
|
|
151
|
+
# 使用 Monkey Patch 方式临时修改 huggingface_hub 的默认超时配置
|
|
157
152
|
commit_message = message or "Upload folder using atomgit client"
|
|
158
|
-
|
|
153
|
+
hf_constants.DEFAULT_REQUEST_TIMEOUT = upload_timeout
|
|
154
|
+
upload_folder(
|
|
159
155
|
repo_id=repo_id,
|
|
160
156
|
folder_path=str(temp_dir),
|
|
161
157
|
token=credentials['token'],
|
|
162
|
-
commit_message=commit_message
|
|
163
|
-
upload_timeout=upload_timeout
|
|
158
|
+
commit_message=commit_message
|
|
164
159
|
)
|
|
160
|
+
|
|
165
161
|
return True
|
|
166
162
|
finally:
|
|
167
163
|
# 清理临时目录
|
|
@@ -186,14 +182,14 @@ class HuggingFaceAPI:
|
|
|
186
182
|
print("未找到登录凭证")
|
|
187
183
|
return False
|
|
188
184
|
|
|
189
|
-
#
|
|
185
|
+
# 使用 Monkey Patch 方式临时修改 huggingface_hub 的默认超时配置
|
|
190
186
|
commit_message = message or "Upload folder using atomgit client"
|
|
191
|
-
|
|
187
|
+
hf_constants.DEFAULT_REQUEST_TIMEOUT = upload_timeout
|
|
188
|
+
upload_folder(
|
|
192
189
|
repo_id=repo_id,
|
|
193
190
|
folder_path=str(dir_path),
|
|
194
191
|
token=credentials['token'],
|
|
195
|
-
commit_message=commit_message
|
|
196
|
-
upload_timeout=upload_timeout
|
|
192
|
+
commit_message=commit_message
|
|
197
193
|
)
|
|
198
194
|
|
|
199
195
|
return True
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|