
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
github.com/wangchen615/hf_downloader
A lightweight and efficient Go package for downloading models from Hugging Face's model hub. This package provides a simple way to download machine learning models and their associated files from Hugging Face, with support for caching, parallel downloads, and custom storage locations.
go get github.com/wangchen615/hf_downloader
package main
import (
"fmt"
"github.com/wangchen615/hf_downloader/hfdownloader"
)
func main() {
// Create a new downloader instance
downloader := hfdownloader.NewDownloader()
// Download a model (using default revision "main")
downloadPath, err := downloader.Download("openai-community/gpt2", "main")
if err != nil {
fmt.Printf("Error: %v\n", err)
return
}
fmt.Printf("Model downloaded to: %s\n", downloadPath)
}
downloader := hfdownloader.NewDownloader()
downloader.SetCustomPath("/path/to/your/models")
downloadPath, err := downloader.Download("openai-community/gpt2", "main")
The package includes a command-line interface for easy model downloading:
# Basic usage (downloads openai-community/gpt2)
go run main.go
# Download specific model
go run main.go bert-base-uncased
# Download specific model revision
go run main.go bert-base-uncased v1.0
# Download to custom path
go run main.go bert-base-uncased main /path/to/download
For private models, set your Hugging Face token as an environment variable:
export HF_TOKEN=your_token_here
~/.cache/huggingface/hub
by default.md
, .txt
) are ignored by defaultContributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.