Skip to content

Commit ce8ee25

Browse files
Updated huggingface commands schema as per latest changes available in jfrog-cli-artifactory
1 parent 7d96b32 commit ce8ee25

File tree

5 files changed

+52
-19
lines changed

5 files changed

+52
-19
lines changed

buildtools/cli.go

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,15 +1160,32 @@ func huggingFaceUploadCmd(c *cli.Context, hfArgs []string) error {
11601160
if repoID == "" {
11611161
return cliutils.PrintHelpAndReturnError("Repository ID cannot be empty.", c)
11621162
}
1163-
revision := ""
1164-
if c.String("revision") != "" {
1165-
revision = c.String("revision")
1163+
serverDetails, err := coreConfig.GetDefaultServerConf()
1164+
if err != nil {
1165+
return err
1166+
}
1167+
if serverDetails == nil {
1168+
return fmt.Errorf("no default server configuration found. Please configure a server using 'jfrog config add' or specify a server using --server-id")
1169+
}
1170+
buildConfiguration, err := cliutils.CreateBuildConfigurationWithModule(c)
1171+
if err != nil {
1172+
return err
1173+
}
1174+
revision := c.String("revision")
1175+
if revision == "" {
1176+
revision = "main"
11661177
}
11671178
repoType := c.String("repo-type")
11681179
if repoType == "" {
11691180
repoType = "model"
11701181
}
1171-
huggingFaceUploadCmd := huggingfaceCommands.NewHuggingFaceUpload().SetFolderPath(folderPath).SetRepoId(repoID).SetRepoType(repoType).SetRevision(revision)
1182+
huggingFaceUploadCmd := huggingfaceCommands.NewHuggingFaceUpload().
1183+
SetFolderPath(folderPath).
1184+
SetRepoId(repoID).
1185+
SetRepoType(repoType).
1186+
SetRevision(revision).
1187+
SetServerDetails(serverDetails).
1188+
SetBuildConfiguration(buildConfiguration)
11721189
return commands.Exec(huggingFaceUploadCmd)
11731190
}
11741191

@@ -1177,18 +1194,24 @@ func huggingFaceDownloadCmd(c *cli.Context, hfArgs []string) error {
11771194
if len(hfArgs) < 1 {
11781195
return cliutils.PrintHelpAndReturnError("Model/Dataset name is required.", c)
11791196
}
1180-
const eTagTimeout = 86400
1197+
const defaultETagTimeout = 86400
11811198
repoID := hfArgs[0]
11821199
if repoID == "" {
11831200
return cliutils.PrintHelpAndReturnError("Model/Dataset name cannot be empty.", c)
11841201
}
1185-
revision := ""
1186-
if c.String("revision") != "" {
1187-
revision = c.String("revision")
1202+
serverDetails, err := coreConfig.GetDefaultServerConf()
1203+
if err != nil {
1204+
return err
1205+
}
1206+
if serverDetails == nil {
1207+
return fmt.Errorf("no default server configuration found. Please configure a server using 'jfrog config add' or specify a server using --server-id")
11881208
}
1189-
etagTimeout := eTagTimeout
1209+
buildConfiguration, err := cliutils.CreateBuildConfigurationWithModule(c)
1210+
if err != nil {
1211+
return err
1212+
}
1213+
etagTimeout := defaultETagTimeout
11901214
if c.String("etag-timeout") != "" {
1191-
var err error
11921215
etagTimeout, err = strconv.Atoi(c.String("etag-timeout"))
11931216
if err != nil {
11941217
return errorutils.CheckErrorf("invalid etag-timeout value: %s", c.String("etag-timeout"))
@@ -1198,7 +1221,17 @@ func huggingFaceDownloadCmd(c *cli.Context, hfArgs []string) error {
11981221
if repoType == "" {
11991222
repoType = "model"
12001223
}
1201-
huggingFaceDownloadCmd := huggingfaceCommands.NewHuggingFaceDownload().SetRepoId(repoID).SetRepoType(repoType).SetRevision(revision).SetEtagTimeout(etagTimeout)
1224+
revision := c.String("revision")
1225+
if revision == "" {
1226+
revision = "main"
1227+
}
1228+
huggingFaceDownloadCmd := huggingfaceCommands.NewHuggingFaceDownload().
1229+
SetRepoId(repoID).
1230+
SetRepoType(repoType).
1231+
SetRevision(revision).
1232+
SetEtagTimeout(etagTimeout).
1233+
SetServerDetails(serverDetails).
1234+
SetBuildConfiguration(buildConfiguration)
12021235
return commands.Exec(huggingFaceDownloadCmd)
12031236
}
12041237

docs/buildtools/huggingface/help.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
package huggingface
22

3-
var Usage = []string{"hf d <model-name>",
4-
"hf u <folder-path> <repo-id>"}
3+
var Usage = []string{"hf download <model-name>",
4+
"hf upload <folder-path> <repo-id>"}
55

66
func GetDescription() string {
77
return `Download or upload models/datasets from/to HuggingFace Hub.`
88
}
99

1010
func GetArguments() string {
11-
return ` d <model-name>
11+
return ` download <model-name>
1212
Download a model/dataset from HuggingFace Hub.
1313
model-name
1414
The HuggingFace model repository ID (e.g., 'bert-base-uncased' or 'username/model-name').
1515
16-
u <folder-path> <repo-id>
16+
upload <folder-path> <repo-id>
1717
Upload a model or dataset folder to HuggingFace Hub.
1818
folder-path
1919
Path to the folder to upload.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ replace github.com/ktrysmt/go-bitbucket => github.com/ktrysmt/go-bitbucket v0.9.
258258

259259
//replace github.com/jfrog/jfrog-cli-core/v2 => ../jfrog-cli-core
260260

261-
replace github.com/jfrog/jfrog-cli-artifactory => github.com/naveenku-jfrog/jfrog-cli-artifactory v0.0.0-20260225152059-260a89cdd92e
261+
replace github.com/jfrog/jfrog-cli-artifactory => github.com/naveenku-jfrog/jfrog-cli-artifactory v0.0.0-20260226131045-5325d7c11857
262262

263263
//replace github.com/jfrog/build-info-go => github.com/fluxxBot/build-info-go v1.10.10-0.20260105070825-d3f36f619ba5
264264

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq
518518
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
519519
github.com/natefinch/atomic v1.0.1 h1:ZPYKxkqQOx3KZ+RsbnP/YsgvxWQPGxjC0oBt2AhwV0A=
520520
github.com/natefinch/atomic v1.0.1/go.mod h1:N/D/ELrljoqDyT3rZrsUmtsuzvHkeB/wWjHV22AZRbM=
521-
github.com/naveenku-jfrog/jfrog-cli-artifactory v0.0.0-20260225152059-260a89cdd92e h1:k3LLlU5yyrAYb9hGPO87CdNoE/MyWYl5UoOgZ9HoIg8=
522-
github.com/naveenku-jfrog/jfrog-cli-artifactory v0.0.0-20260225152059-260a89cdd92e/go.mod h1:qEUp3kyKkocqvf7xErppgAtkmudZR1TMaQUvDTGYCUI=
521+
github.com/naveenku-jfrog/jfrog-cli-artifactory v0.0.0-20260226131045-5325d7c11857 h1:6s3lpa50bqiuKO5uZqvDNHePxD3U5FkwUvWhvwrs8JU=
522+
github.com/naveenku-jfrog/jfrog-cli-artifactory v0.0.0-20260226131045-5325d7c11857/go.mod h1:P9ZywyTQzp+WsNmeb4IiMQOdVb++eQUD5oXd18LRVj8=
523523
github.com/nwaples/rardecode/v2 v2.2.2 h1:/5oL8dzYivRM/tqX9VcTSWfbpwcbwKG1QtSJr3b3KcU=
524524
github.com/nwaples/rardecode/v2 v2.2.2/go.mod h1:7uz379lSxPe6j9nvzxUZ+n7mnJNgjsRNb6IbvGVHRmw=
525525
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=

utils/cliutils/commandsflags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2000,7 +2000,7 @@ var commandFlags = map[string][]string{
20002000
BuildName, BuildNumber, module, Project, serverId, username, password,
20012001
},
20022002
HuggingFace: {
2003-
Revision, RepoType, EtagTimeout,
2003+
BuildName, BuildNumber, module, Project, serverId, Revision, RepoType, EtagTimeout,
20042004
},
20052005
RubyConfig: {
20062006
global, serverIdResolve, serverIdDeploy, repoResolve, repoDeploy,

0 commit comments

Comments
 (0)