Hiya - what do i need to do to make the tf hub download imagenet etc files it wants from behind a proxy server?
cheers
TF-Hub uses "urllib" to download modules. It appears you can configure it via http_proxy environment variable.
hmm doesnt seem to want to work the https required
so found a workaround - that works for me.
editted
def download(handle, tmp_dir) in compressed_module_resolver.py
proxy_support = url.ProxyHandler({'http' : 'http://username:password@proxyip:port',
'https': 'https://username:password@proxyip:port'})
..
then later in the function
url_opener = url.build_opener(LoggingHTTPRedirectHandler,proxy_support )
and its working for me...yeah its hard coded and hardcoded == bad....but that'll do for me now
cheers
You can handle proxy this way from your code (e.g. you do not need to edit compressed_module_resolver.py) in python(3.6):
import tensorflow_hub as hub
import os
import getpass
module_url = "https://tfhub.dev/google/universal-sentence-encoder/2"
print("Loading model from {}".format(module_url))
user = getpass.getuser()
password = getpass.getpass("proxy password:")
os.environ["https_proxy"] = f"http://{user}:{password}@10.204.10.2:3128"
embed = hub.Module(module_url)
Most helpful comment
You can handle proxy this way from your code (e.g. you do not need to edit compressed_module_resolver.py) in python(3.6):