Skip to content

Commit 2743296

Browse files
authored
feat: support HF_ENDPOINT environment when downloading model (#505)
1 parent f1634ba commit 2743296

File tree

4 files changed

+9
-20
lines changed

4 files changed

+9
-20
lines changed

Cargo.lock

Lines changed: 4 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backends/candle/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ memmap2 = "^0.9"
2929
[dev-dependencies]
3030
insta = { git = "https://github.com/OlivierDehaene/insta", rev = "f4f98c0410b91fb5a28b10df98e4422955be9c2c", features = ["yaml"] }
3131
is_close = "0.1.3"
32-
hf-hub = "0.4.2"
32+
hf-hub = { workspace = true }
3333
anyhow = { workspace = true }
3434
tokenizers = { workspace = true }
3535
serial_test = { workspace = true }

backends/candle/tests/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub fn download_artifacts(
107107
model_id: &'static str,
108108
revision: Option<&'static str>,
109109
) -> Result<PathBuf> {
110-
let mut builder = ApiBuilder::new().with_progress(false);
110+
let mut builder = ApiBuilder::from_env().with_progress(false);
111111

112112
if let Some(cache_dir) = std::env::var_os("HUGGINGFACE_HUB_CACHE") {
113113
builder = builder.with_cache_dir(cache_dir.into());

router/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ pub async fn run(
7070
// Using a local model
7171
(model_id_path.to_path_buf(), None)
7272
} else {
73-
let mut builder = ApiBuilder::new().with_progress(false).with_token(hf_token);
73+
let mut builder = ApiBuilder::from_env()
74+
.with_progress(false)
75+
.with_token(hf_api_token);
7476

7577
if let Some(cache_dir) = huggingface_hub_cache {
7678
builder = builder.with_cache_dir(cache_dir.into());

0 commit comments

Comments
 (0)