Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
Mon-ius committed May 4, 2024
1 parent e097d62 commit 0d34769
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 10 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
- package-ecosystem: "cargo"
directory: "/"
schedule:
interval: weekly
37 changes: 37 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: ci

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always
CARGO_LOCA: "hfd-cli/Cargo.toml"
CARGO_BIN: "hfd"

permissions:
contents: write

on:
workflow_dispatch:
push:
branches:
- "main"
paths:
- "hfd-cli/Cargo.toml"
- ".github/workflows/ci.yml"

jobs:
pre:
runs-on: ubuntu-latest
outputs:
cargo_loc: ${{ env.CARGO_LOCA }}
cargo_bin: ${{ env.CARGO_BIN }}
steps:
- run: echo "Bypass GitHub Action Restriction"

call:
needs:
- pre
uses: AUTOM77/Rust-Actions/.github/workflows/ci.yml@main
with:
cargo_loc: ${{ needs.pre.outputs.cargo_loc }}
cargo_bin: ${{ needs.pre.outputs.cargo_bin }}
secrets: inherit
13 changes: 3 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
# Generated by Cargo
# will have compiled files and executables
.DS_Store
.vscode/
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
*.pdb
14 changes: 14 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[workspace]
members = ["hfd-cli"]
resolver = "2"

[profile.release]
lto = true
strip = true
panic = 'abort'
opt-level = 3
codegen-units = 1

[profile.bench]
lto = true
codegen-units = 1
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# hfd

[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/AUTOM77/hfd/ci.yml)](https://github.com/AUTOM77/hfd/actions)
[![GitHub license](https://img.shields.io/github/license/AUTOM77/hfd)](./LICENSE)
[![GitHub contributors](https://img.shields.io/github/contributors/AUTOM77/hfd)](https://github.com/AUTOM77/hfd/graphs/contributors)
[![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/m/AUTOM77/hfd)](https://github.com/AUTOM77/hfd/commits)
[![GitHub top language](https://img.shields.io/github/languages/top/AUTOM77/hfd?logo=rust&label=)](./hfd-cli/Cargo.toml#L4)
[![Open Issues](https://img.shields.io/github/issues/AUTOM77/hfd)](https://github.com/AUTOM77/hfd/issues)
[![Code Size](https://img.shields.io/github/languages/code-size/AUTOM77/hfd)](.)
[![GitHub all releases](https://img.shields.io/github/downloads/AUTOM77/hfd/total?logo=github)](https://github.com/AUTOM77/hfd/releases)
[![GitHub release (with filter)](https://img.shields.io/github/v/release/AUTOM77/hfd?logo=github)](https://github.com/AUTOM77/hfd/releases)


🎈Rust-based interface for Huggingface 🤗 download
13 changes: 13 additions & 0 deletions hfd-cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "hfd-cli"
version = "0.1.0"
edition = "2021"

[dependencies]
tokio = { version = "1.37.0", features = ["full"] }
clap = { version= "4.5.4", features=["derive"] }
hf-hub ={ version="0.3.2", features = ["tokio"]}

[[bin]]
name = "hfd"
path = "src/cli.rs"
12 changes: 12 additions & 0 deletions hfd-cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use tokio;

#[tokio::main]
async fn main() {
let api = hf_hub::api::tokio::Api::new().unwrap();

let _filename = api
.model("meta-llama/Llama-2-7b-hf".to_string())
.get("model-00001-of-00002.safetensors")
.await
.unwrap();
}

0 comments on commit 0d34769

Please sign in to comment.