Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/huggingfaceTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
with:
python-version: '3.11'

- name: Install HuggingFace CLI
- name: Install HuggingFace Library
if: matrix.os.name != 'macos'
run: |
pip install huggingface_hub
Expand Down
55 changes: 44 additions & 11 deletions buildtools/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -1160,15 +1160,32 @@ func huggingFaceUploadCmd(c *cli.Context, hfArgs []string) error {
if repoID == "" {
return cliutils.PrintHelpAndReturnError("Repository ID cannot be empty.", c)
}
revision := ""
if c.String("revision") != "" {
revision = c.String("revision")
serverDetails, err := coreConfig.GetDefaultServerConf()
if err != nil {
return err
}
if serverDetails == nil {
return fmt.Errorf("no default server configuration found. Please configure a server using 'jfrog config add' or specify a server using --server-id")
}
buildConfiguration, err := cliutils.CreateBuildConfigurationWithModule(c)
if err != nil {
return err
}
revision := c.String("revision")
if revision == "" {
revision = "main"
}
repoType := c.String("repo-type")
if repoType == "" {
repoType = "model"
}
huggingFaceUploadCmd := huggingfaceCommands.NewHuggingFaceUpload().SetFolderPath(folderPath).SetRepoId(repoID).SetRepoType(repoType).SetRevision(revision)
huggingFaceUploadCmd := huggingfaceCommands.NewHuggingFaceUpload().
SetFolderPath(folderPath).
SetRepoId(repoID).
SetRepoType(repoType).
SetRevision(revision).
SetServerDetails(serverDetails).
SetBuildConfiguration(buildConfiguration)
return commands.Exec(huggingFaceUploadCmd)
}

Expand All @@ -1177,18 +1194,24 @@ func huggingFaceDownloadCmd(c *cli.Context, hfArgs []string) error {
if len(hfArgs) < 1 {
return cliutils.PrintHelpAndReturnError("Model/Dataset name is required.", c)
}
const eTagTimeout = 86400
const defaultETagTimeout = 86400
repoID := hfArgs[0]
if repoID == "" {
return cliutils.PrintHelpAndReturnError("Model/Dataset name cannot be empty.", c)
}
revision := ""
if c.String("revision") != "" {
revision = c.String("revision")
serverDetails, err := coreConfig.GetDefaultServerConf()
if err != nil {
return err
}
if serverDetails == nil {
return fmt.Errorf("no default server configuration found. Please configure a server using 'jfrog config add' or specify a server using --server-id")
}
etagTimeout := eTagTimeout
buildConfiguration, err := cliutils.CreateBuildConfigurationWithModule(c)
if err != nil {
return err
}
etagTimeout := defaultETagTimeout
if c.String("etag-timeout") != "" {
var err error
etagTimeout, err = strconv.Atoi(c.String("etag-timeout"))
if err != nil {
return errorutils.CheckErrorf("invalid etag-timeout value: %s", c.String("etag-timeout"))
Expand All @@ -1198,7 +1221,17 @@ func huggingFaceDownloadCmd(c *cli.Context, hfArgs []string) error {
if repoType == "" {
repoType = "model"
}
huggingFaceDownloadCmd := huggingfaceCommands.NewHuggingFaceDownload().SetRepoId(repoID).SetRepoType(repoType).SetRevision(revision).SetEtagTimeout(etagTimeout)
revision := c.String("revision")
if revision == "" {
revision = "main"
}
huggingFaceDownloadCmd := huggingfaceCommands.NewHuggingFaceDownload().
SetRepoId(repoID).
SetRepoType(repoType).
SetRevision(revision).
SetEtagTimeout(etagTimeout).
SetServerDetails(serverDetails).
SetBuildConfiguration(buildConfiguration)
return commands.Exec(huggingFaceDownloadCmd)
}

Expand Down
8 changes: 4 additions & 4 deletions docs/buildtools/huggingface/help.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package huggingface

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

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

func GetArguments() string {
return ` d <model-name>
return ` download <model-name>
Download a model/dataset from HuggingFace Hub.
model-name
The HuggingFace model repository ID (e.g., 'bert-base-uncased' or 'username/model-name').

u <folder-path> <repo-id>
upload <folder-path> <repo-id>
Upload a model or dataset folder to HuggingFace Hub.
folder-path
Path to the folder to upload.
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/jfrog/build-info-go v1.13.1-0.20260216093441-40a4dc563294
github.com/jfrog/gofrog v1.7.6
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260216085810-1ade6c26b3df
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260220110856-b6523f01f9c7
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260227101327-7478579b5f25
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260218080258-3bf55ed18973
github.com/jfrog/jfrog-cli-evidence v0.8.3-0.20260202100913-d9ee9476845a
github.com/jfrog/jfrog-cli-platform-services v1.10.1-0.20260213131956-d1d39bf3a042
Expand Down Expand Up @@ -258,7 +258,7 @@ replace github.com/ktrysmt/go-bitbucket => github.com/ktrysmt/go-bitbucket v0.9.

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

// replace github.com/jfrog/jfrog-cli-artifactory => github.com/fluxxBot/jfrog-cli-artifactory v0.0.0-20260130044429-464a5025d08a
//replace github.com/jfrog/jfrog-cli-artifactory => github.com/naveenku-jfrog/jfrog-cli-artifactory v0.0.0-20260226133041-8d510cc4e5f6

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

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@ github.com/jfrog/jfrog-apps-config v1.0.1 h1:mtv6k7g8A8BVhlHGlSveapqf4mJfonwvXYL
github.com/jfrog/jfrog-apps-config v1.0.1/go.mod h1:8AIIr1oY9JuH5dylz2S6f8Ym2MaadPLR6noCBO4C22w=
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260216085810-1ade6c26b3df h1:raSyae8/h1y8HtzFLf7vZZj91fP/qD94AX+biwBJiqs=
github.com/jfrog/jfrog-cli-application v1.0.2-0.20260216085810-1ade6c26b3df/go.mod h1:xum2HquWO5uExa/A7MQs3TgJJVEeoqTR+6Z4mfBr1Xw=
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260220110856-b6523f01f9c7 h1:8k9xxh9MzsddPPAlPFnG1NPXR2+WO7LdHwbMHXFYj0E=
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260220110856-b6523f01f9c7/go.mod h1:qEUp3kyKkocqvf7xErppgAtkmudZR1TMaQUvDTGYCUI=
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260227101327-7478579b5f25 h1:ofIzdQmqaiI7fzvBvKedoorj2kxvqmJXlY8BMe4d3Ik=
github.com/jfrog/jfrog-cli-artifactory v0.8.1-0.20260227101327-7478579b5f25/go.mod h1:P9ZywyTQzp+WsNmeb4IiMQOdVb++eQUD5oXd18LRVj8=
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260218080258-3bf55ed18973 h1:fOlWUGkCuujnIcE3166gpTdvicwv1wAZhLrfbm+f6rY=
github.com/jfrog/jfrog-cli-core/v2 v2.60.1-0.20260218080258-3bf55ed18973/go.mod h1:GDveG1xAoiM12JlSx8RE0OcJ6Ov+xcmpmGv84we3pMA=
github.com/jfrog/jfrog-cli-evidence v0.8.3-0.20260202100913-d9ee9476845a h1:lTOAhUjKcOmM/0Kbj4V+I/VHPlW7YNAhIEVpGnCM5mI=
Expand Down
Loading
Loading