generative-models icon indicating copy to clipboard operation
generative-models copied to clipboard

streamlit.runtime.caching.cache_errors.CacheKeyNotFoundError

Open fengxuefx opened this issue 2 years ago • 10 comments

2023-09-08 04:40:57.495 Uncaught app exception Traceback (most recent call last): File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 263, in _get_or_create_cached_value cached_result = cache.read_result(value_key) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/streamlit/runtime/caching/cache_resource_api.py", line 500, in read_result raise CacheKeyNotFoundError() streamlit.runtime.caching.cache_errors.CacheKeyNotFoundError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 311, in _handle_cache_miss cached_result = cache.read_result(value_key) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/streamlit/runtime/caching/cache_resource_api.py", line 500, in read_result raise CacheKeyNotFoundError() streamlit.runtime.caching.cache_errors.CacheKeyNotFoundError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/connectionpool.py", line 714, in urlopen httplib_response = self._make_request( File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/connectionpool.py", line 403, in _make_request self._validate_conn(conn) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1053, in validate_conn conn.connect() File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/connection.py", line 419, in connect self.sock = ssl_wrap_socket( File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/util/ssl.py", line 449, in ssl_wrap_socket ssl_sock = ssl_wrap_socket_impl( File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/util/ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/ssl.py", line 501, in wrap_socket return self.sslsocket_class._create( File "/home/software/miniconda3/envs/dl_base/lib/python3.9/ssl.py", line 1041, in _create self.do_handshake() File "/home/software/miniconda3/envs/dl_base/lib/python3.9/ssl.py", line 1310, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/connectionpool.py", line 798, in urlopen retries = retries.increment( File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/util/retry.py", line 550, in increment raise six.reraise(type(error), error, _stacktrace) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/packages/six.py", line 769, in reraise raise value.with_traceback(tb) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/connectionpool.py", line 714, in urlopen httplib_response = self._make_request( File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/connectionpool.py", line 403, in _make_request self._validate_conn(conn) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1053, in validate_conn conn.connect() File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/connection.py", line 419, in connect self.sock = ssl_wrap_socket( File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/util/ssl.py", line 449, in ssl_wrap_socket ssl_sock = ssl_wrap_socket_impl( File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/urllib3/util/ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/ssl.py", line 501, in wrap_socket return self.sslsocket_class._create( File "/home/software/miniconda3/envs/dl_base/lib/python3.9/ssl.py", line 1041, in _create self.do_handshake() File "/home/software/miniconda3/envs/dl_base/lib/python3.9/ssl.py", line 1310, in do_handshake self._sslobj.do_handshake() urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 552, in _run_script exec(code, module.dict) File "/home/fengxue/Codes/text2img/generative-models/scripts/demo/sampling.py", line 277, in state = init_st(version_dict, load_filter=True) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 211, in wrapper return cached_func(*args, **kwargs) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 240, in call return self._get_or_create_cached_value(args, kwargs) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 266, in _get_or_create_cached_value return self._handle_cache_miss(cache, value_key, func_args, func_kwargs) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/streamlit/runtime/caching/cache_utils.py", line 320, in _handle_cache_miss computed_value = self._info.func(*func_args, **func_kwargs) File "/home/fengxue/Codes/text2img/generative-models/./scripts/demo/streamlit_helpers.py", line 82, in init_st model, msg = load_model_from_config(config, ckpt if load_ckpt else None) File "/home/fengxue/Codes/text2img/generative-models/./scripts/demo/streamlit_helpers.py", line 122, in load_model_from_config model = instantiate_from_config(config.model) File "/home/fengxue/Codes/text2img/generative-models/./sgm/util.py", line 175, in instantiate_from_config return get_obj_from_str(config["target"])(**config.get("params", dict())) File "/home/fengxue/Codes/text2img/generative-models/./sgm/models/diffusion.py", line 61, in init self.conditioner = instantiate_from_config( File "/home/fengxue/Codes/text2img/generative-models/./sgm/util.py", line 175, in instantiate_from_config return get_obj_from_str(config["target"])(**config.get("params", dict())) File "/home/fengxue/Codes/text2img/generative-models/./sgm/modules/encoders/modules.py", line 88, in init embedder = instantiate_from_config(embconfig) File "/home/fengxue/Codes/text2img/generative-models/./sgm/util.py", line 175, in instantiate_from_config return get_obj_from_str(config["target"])(**config.get("params", dict())) File "/home/fengxue/Codes/text2img/generative-models/./sgm/modules/encoders/modules.py", line 360, in init self.tokenizer = CLIPTokenizer.from_pretrained(version) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/transformers/tokenization_utils_base.py", line 1723, in from_pretrained resolved_vocab_files[file_id] = cached_path( File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/transformers/utils/hub.py", line 282, in cached_path output_path = get_from_cache( File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/transformers/utils/hub.py", line 585, in get_from_cache http_get(url_to_download, temp_file, proxies=proxies, resume_size=resume_size, headers=headers) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/transformers/utils/hub.py", line 423, in http_get r = requests.get(url, stream=True, proxies=proxies, headers=headers) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, **kwargs) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, **kwargs) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, **send_kwargs) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "/home/software/miniconda3/envs/dl_base/lib/python3.9/site-packages/requests/adapters.py", line 501, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))

fengxuefx avatar Sep 07 '23 08:09 fengxuefx

请问,有人见过这个错误吗?

fengxuefx avatar Sep 07 '23 09:09 fengxuefx

我也遇到了差不多的错误,看起来是要从huggingface中下载一些模型到torch的缓存文件夹,但是网络超时了,得科学上网或者手动将模型下载下来放到缓存文件夹

yuan199696 avatar Sep 07 '23 14:09 yuan199696

Thanksfully, I have solved this problem. For those who can not dirrectly attach huggingface.co, you need to download two more models manually. The first is https://huggingface.co/laion/CLIP-ViT-bigG-14-laion2B-39B-b160k/resolve/main/open_clip_pytorch_model.bin For the second it is clip.load("ViT-L/14", device=device) Place them into the right place, and there you go.

tuzeao-tal avatar Nov 16 '23 08:11 tuzeao-tal

Thanksfully, I have solved this problem. For those who can not dirrectly attach huggingface.co, you need to download two more models manually. The first is https://huggingface.co/laion/CLIP-ViT-bigG-14-laion2B-39B-b160k/resolve/main/open_clip_pytorch_model.bin For the second it is clip.load("ViT-L/14", device=device) Place them into the right place, and there you go.

where should i place them?

Brewnut-98 avatar Nov 22 '23 11:11 Brewnut-98

Thanksfully, I have solved this problem. For those who can not dirrectly attach huggingface.co, you need to download two more models manually. The first is https://huggingface.co/laion/CLIP-ViT-bigG-14-laion2B-39B-b160k/resolve/main/open_clip_pytorch_model.bin For the second it is clip.load("ViT-L/14", device=device) Place them into the right place, and there you go.

where should i place them?

+1

youngstu avatar Nov 24 '23 02:11 youngstu

+2

happened avatar Nov 24 '23 08:11 happened

+2+1

RodolpheCalvet avatar Dec 03 '23 21:12 RodolpheCalvet

find path, like this: ~/.cache/huggingface/hub/models--laion--CLIP-ViT-bigG-14-laion2B-39B-b160k

winjia avatar Dec 26 '23 11:12 winjia

Thanksfully, I have solved this problem. For those who can not dirrectly attach huggingface.co, you need to download two more models manually. The first is https://huggingface.co/laion/CLIP-ViT-bigG-14-laion2B-39B-b160k/resolve/main/open_clip_pytorch_model.bin For the second it is clip.load("ViT-L/14", device=device) Place them into the right place, and there you go.

where is the code clip.load("ViT-L/14", device=device) .

WenB777 avatar Dec 30 '23 08:12 WenB777

clip.load("ViT-L/14", device=device)在anaconda3/envs/pytorch/lib/python3.10/site-packages/clip-1.0-py3.10.egg/clip/clip.py的120行,可以更改其路径model_path = _download(_MODELS[name], download_root or os.path.expanduser("yourpath_root/clip")) CLIP-ViT-bigG-14-laion2B-39B-b160k/open_clip_pytorch_model.bin好像是在anaconda3/envs/pytorch/lib/python3.10/site-packages/open_clip/factory.py文件的create_model方法279行的if pretrained:判断语句下加下面的代码 if pretrained == 'laion2b_s39b_b160k' and model_name == 'ViT-bigG-14': pretrained = 'yourpath/CLIP-ViT-bigG-14-laion2B-39B-b160k/open_clip_pytorch_model.bin'

yy-victory avatar Jan 26 '24 10:01 yy-victory