Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection Timeout #41

Open
Jordan-Haidee opened this issue Jan 13, 2024 · 11 comments
Open

Connection Timeout #41

Jordan-Haidee opened this issue Jan 13, 2024 · 11 comments

Comments

@Jordan-Haidee
Copy link

Jordan-Haidee commented Jan 13, 2024

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 Timeout exception. I tried to use proxy, but it didn't work too.
  • If using Python huggingface_hub package, the exception didn't happen.
    image
@liafuzho
Copy link

The same problem, but it works fine after cloning hf-hub to the project directory.

[dependencies]
hf-hub = { path = "./rust-lib/hf-hub" }

@Jordan-Haidee
Copy link
Author

Thanks, let me have a try.

@Narsil
Copy link
Collaborator

Narsil commented Jan 22, 2024

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.

@danielclough
Copy link

danielclough commented Jan 25, 2024

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" }) }))

@garyli1019
Copy link

The same problem, but it works fine after cloning hf-hub to 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.

@Narsil
Copy link
Collaborator

Narsil commented Jan 31, 2024

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)

@Jordan-Haidee
Copy link
Author

Just the latest 0.3.2

1 similar comment
@Jordan-Haidee
Copy link
Author

Just the latest 0.3.2

@npuichigo
Copy link

@Narsil when can we have a new version which includes the proxy setting?

@oovm
Copy link

oovm commented Aug 9, 2024

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"

@Narsil
Copy link
Collaborator

Narsil commented Dec 25, 2024

There is no need for that.

You always could enable socks on your own projects. It's showcased here: #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants