Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangkx1
prj_csghub
Commits
84f93e11
Commit
84f93e11
authored
Apr 28, 2026
by
wangkx1
Browse files
init
parent
fbaa7b4c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
auto_uoload.py
auto_uoload.py
+15
-5
No files found.
auto_uoload.py
View file @
84f93e11
...
...
@@ -8,7 +8,7 @@ import argparse
BASE_URL
=
"http://10.20.100.5:4997"
TOKEN
=
"a2683e780fee4aa4b16cbedee0f75a45"
def
upload
(
local_path
,
repo_id
,
repo_type
=
"model"
):
def
upload
(
local_path
,
repo_id
,
repo_type
=
"model"
,
force
=
False
):
csg_api
=
CsgHubApi
()
use_full_repo_id
=
f
"root/
{
repo_id
}
"
...
...
@@ -17,8 +17,11 @@ def upload(local_path, repo_id, repo_type="model"):
endpoint
=
BASE_URL
,
token
=
TOKEN
)
if
repoExist
:
print
(
f
"
{
repo_id
}
has exists."
)
if
not
force
:
print
(
f
"
{
repo_id
}
has exists. Use --force to update it."
)
return
else
:
print
(
f
"
{
repo_id
}
has exists. Updating it because --force is set."
)
else
:
create_repo
(
api
=
csg_api
,
...
...
@@ -55,6 +58,13 @@ if __name__ == "__main__":
help
=
"本地模型文件夹的路径"
)
# 添加强制更新参数
parser
.
add_argument
(
"--force"
,
action
=
"store_true"
,
help
=
"强制更新远程仓库,即使仓库已存在"
)
# 解析命令行参数
args
=
parser
.
parse_args
()
...
...
@@ -77,4 +87,4 @@ if __name__ == "__main__":
print
(
f
"目标仓库:
{
repo_id
}
"
)
# 执行上传
upload
(
local_path
,
repo_id
)
\ No newline at end of file
upload
(
local_path
,
repo_id
,
force
=
args
.
force
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment