Skip to content

Commit c275f61

Browse files
authored
Merge pull request #14 from BaizeAI/copilot/fix-13
Fix synchronization timeout issue for large file uploads
2 parents 76fc820 + a7b13f2 commit c275f61

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

sync.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import requests
88
from qiniu import Auth, put_file, put_stream_v2, put_data
9+
from qiniu import config as qiniu_config
910
from jinja2 import Environment, BaseLoader
1011
from huggingface_hub import HfApi, hf_hub_url
1112
from huggingface_hub.hf_api import RepoFolder
@@ -142,6 +143,10 @@ def upload_hf_repo(
142143

143144

144145
if __name__ == '__main__':
146+
# Configure longer timeout for large file uploads (5 minutes instead of default 30s)
147+
# This prevents TimeoutError when uploading large files like model.bin through qiniu's put_stream_v2
148+
qiniu_config.set_default(connection_timeout=60*60*3)
149+
145150
parser = argparse.ArgumentParser()
146151
parser.add_argument('--ak', type=str, help='qiniu access key')
147152
parser.add_argument('--sk', type=str, help='qiniu secret key')

0 commit comments

Comments
 (0)