hf-hub
hf-hub copied to clipboard
Connection Timeout
In my Windows OS, when I run the example:
use hf_hub::api::sync::Api;
fn main() {
let api = Api::new().unwrap();
let repo = api.model("bert-base-uncased".to_string());
let _filename = repo.get("config.json").unwrap();
}
- It always raise
Connect Timeoutexception. I tried to use proxy, but it didn't work too. - If using Python
huggingface_hubpackage, the exception didn't happen.
The same problem, but it works fine after cloning hf-hub to the project directory.
[dependencies] hf-hub = { path = "./rust-lib/hf-hub" }
Thanks, let me have a try.
I cannot read that error message in Chinese, sorry.
Seems like there was an issue connecting to huggingface.co and I think connecting to it from China is causing regular issues. It looks like a regular network issue.
Edit: One hour later it is now working again. I didn't do anything (other than sit in the hot tub).
I am suddenly having issues with this as well on Ubuntu (from USA).
The same hf-hub code and repo that I was using a few weeks ago no longer works.
Regular git requests to hf.co work fine.
Cloning hf-hub from git and loading from path in Cargo.toml does not help.
In order to match this issue I tried bert-base-uncased:
thread 'main' panicked at src/main.rs:18:45:
called `Result::unwrap()` on an `Err` value: RequestError(Transport(Transport { kind: Io, message: None, url: Some(Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("huggingface.co")), port: None, path: "/bert-base-uncased/resolve/main/README.md", query: None, fragment: None }), source: Some(Custom { kind: TimedOut, error: "timed out reading response" }) }))
The same problem, but it works fine after cloning
hf-hubto the project directory.[dependencies] hf-hub = { path = "./rust-lib/hf-hub" }
Thanks! This solved the problem for me. I have a proxy by setting HTTP_PROXY to reach the hugging face hub without any issue. Maybe it's somehow not able to read this environment variable causing this issue.
Which versions are you guy using ? We may just need to make a new release (although I' m not sure we made any change whatsoever since the last release)
Just the latest 0.3.2
Just the latest 0.3.2
@Narsil when can we have a new version which includes the proxy setting?
Ordinary proxies cannot be used in China. To solve this problem, sock5 support is required. I have added pr for this purpose.
Before pr is merged, you can directly use the following version to automatically obtain socks5 proxy in system.
hf-hub = { git = "https://github.com/oovm/hf-hub" }
make sure you are using
export http_proxy="socks5://127.0.0.1:7890"
export https_proxy="socks5://127.0.0.1:7890"
There is no need for that.
You always could enable socks on your own projects. It's showcased here: https://github.com/huggingface/hf-hub/pull/81
It's important we do not enable that feature by default, because otherwise:
We need to add every transient feature of every dependency, which is at least cumbersome.
We don't want users to be compiling the most complex versions of dependency if they don't need it.
This is to the best of my understanding how feature were designed and created.
Closing the issue since I gave a solution to this issue. Feel free to reopen if this doesn't solve it.