You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the time of writing, I don't see a way to download models when the machine is situated behind a Proxy Server.
This issue has been raised before (#1249), however it was closed due to staleness (and not fixed).
Solution
For methods that allow for a download, allow for a proxy configuration to be passed. This can then be passed to the method that handles downloading from URL.
I believe the following snippet handles the downloading, but correct me if I am wrong:
Allowing for proxy can be done simply with requests. However the parameter for the proxy would need to be added to all methods that download over URL or be able to get set as a config in someway.
Hi @Guust-Franssens I can see how this adds value, so I implemented a draft for it: #3082 however I have no proxy setup so I cannot fully test it. Can you try it out?
defset_proxies(proxies: typing.Dict[str, str]) ->None:
""" Allows for data downloaded from urls to be forwarded to a proxy, see https://requests.readthedocs.io/en/latest/user/advanced/#proxies :param proxies: A dictionary of proxies according to the requests documentation. :return: None """globalurl_proxiesurl_proxies=proxiesset_proxies({"http": "...", "https": "..."})
# test on random flair embeddingreq=requests.get("https://flair.informatik.hu-berlin.de/resources/embeddings/flair/lm-pt-forward.pt", stream=True, headers={"User-Agent": "Flair"}, proxies=url_proxies)
print(req)
>>><Response [200]>
Problem statement
At the time of writing, I don't see a way to download models when the machine is situated behind a Proxy Server.
This issue has been raised before (#1249), however it was closed due to staleness (and not fixed).
Solution
For methods that allow for a download, allow for a proxy configuration to be passed. This can then be passed to the method that handles downloading from URL.
I believe the following snippet handles the downloading, but correct me if I am wrong:
flair/flair/file_utils.py
Lines 223 to 269 in a22e70a
Allowing for proxy can be done simply with requests. However the parameter for the proxy would need to be added to all methods that download over URL or be able to get set as a config in someway.
source: https://stackoverflow.com/questions/8287628/proxies-with-python-requests-module
I might try to contribute later if I have time.
The text was updated successfully, but these errors were encountered: