Closed sriprad closed 3 years ago
As mentioned in #1350, please share:
Otherwise it will be impossible to debug / replicate.
I have the same problems.Following is my logs. F:\github_download\semantic_search\haystack>docker-compose pull [+] Running 13/22
F:\github_download\semantic_search\haystack>docker-compose up [+] Running 3/3
pip install 'ray[default]'
. Please update your install command.
haystack-api_1 | "update your install command.", FutureWarning)
haystack-api_1 | pdftotext version 4.03 [www.xpdfreader.com]
haystack-api_1 | Copyright 1996-2021 Glyph & Cog, LLC
haystack-api_1 | [nltk_data] Downloading package punkt to /root/nltk_data...
haystack-api_1 | [nltk_data] Error downloading 'punkt' from
haystack-api_1 | [nltk_data] <https://raw.githubusercontent.com/nltk/nltk_data/gh-
haystack-api_1 | [nltk_data] pages/packages/tokenizers/punkt.zip>: <urlopen error
haystack-api_1 | [nltk_data] [Errno 0] Error>
haystack-api_1 | 08/23/2021 06:34:18 - INFO - elasticsearch - HEAD http://elasticsearch:9200/ [status:200 request:0.089s]
haystack-api_1 | 08/23/2021 06:34:18 - INFO - elasticsearch - HEAD http://elasticsearch:9200/document [status:200 request:0.009s]
haystack-api_1 | 08/23/2021 06:34:18 - INFO - elasticsearch - GET http://elasticsearch:9200/document [status:200 request:0.004s]
haystack-api_1 | 08/23/2021 06:34:18 - INFO - elasticsearch - PUT http://elasticsearch:9200/document/_mapping [status:200 request:0.022s]
haystack-api_1 | 08/23/2021 06:34:18 - INFO - elasticsearch - HEAD http://elasticsearch:9200/label [status:200 request:0.003s]
haystack-api_1 | 08/23/2021 06:34:18 - INFO - elasticsearch - HEAD http://elasticsearch:9200/ [status:200 request:0.004s]
haystack-api_1 | 08/23/2021 06:34:18 - INFO - elasticsearch - HEAD http://elasticsearch:9200/document [status:200 request:0.003s]
haystack-api_1 | 08/23/2021 06:34:18 - INFO - elasticsearch - GET http://elasticsearch:9200/document [status:200 request:0.002s]
haystack-api_1 | 08/23/2021 06:34:18 - INFO - elasticsearch - PUT http://elasticsearch:9200/document/_mapping [status:200 request:0.013s]
haystack-api_1 | 08/23/2021 06:34:18 - INFO - elasticsearch - HEAD http://elasticsearch:9200/label [status:200 request:0.004s]
haystack-api_1 | 08/23/2021 06:34:18 - INFO - farm.utils - Using device: CPU
haystack-api_1 | 08/23/2021 06:34:18 - INFO - farm.utils - Number of GPUs: 0
haystack-api_1 | 08/23/2021 06:34:18 - INFO - farm.utils - Distributed Training: False
haystack-api_1 | 08/23/2021 06:34:18 - INFO - farm.utils - Automatic Mixed Precision: None
haystack-api_1 | [2021-08-23 06:34:25 +0000] [10] [ERROR] Exception in worker process
haystack-api_1 | Traceback (most recent call last):
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/transformers/modeling_utils.py", line 1205, in from_pretrained
haystack-api_1 | state_dict = torch.load(resolved_archive_file, map_location="cpu")
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/torch/serialization.py", line 585, in load
haystack-api_1 | with _open_zipfile_reader(opened_file) as opened_zipfile:
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/torch/serialization.py", line 242, in init
haystack-api_1 | super(_open_zipfile_reader, self).init(torch._C.PyTorchFileReader(name_or_buffer))
haystack-api_1 | RuntimeError: [enforce fail at inline_container.cc:145] . PytorchStreamReader failed reading zip archive: failed finding central directory
haystack-api_1 |
haystack-api_1 | During handling of the above exception, another exception occurred:
haystack-api_1 |
haystack-api_1 | Traceback (most recent call last):
haystack-api_1 | File "/home/user/haystack/pipeline.py", line 400, in _load_or_get_component
haystack-api_1 | instance = BaseComponent.load_from_args(component_type=component_type, component_params)
haystack-api_1 | File "/home/user/haystack/schema.py", line 284, in load_from_args
haystack-api_1 | instance = subclass(kwargs)
haystack-api_1 | File "/home/user/haystack/reader/farm.py", line 113, in init
haystack-api_1 | strict=False)
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/farm/infer.py", line 268, in load
haystack-api_1 | task_type=task_type)
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/farm/modeling/adaptive_model.py", line 548, in convert_from_transformers
haystack-api_1 | processor=processor)
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/farm/conversion/transformers.py", line 91, in convert_from_transformers
haystack-api_1 | lm = LanguageModel.load(model_name_or_path, revision=revision)
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/farm/modeling/language_model.py", line 150, in load
haystack-api_1 | language_model = cls.subclasses[language_model_class].load(pretrained_model_name_or_path, kwargs)
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/farm/modeling/language_model.py", line 654, in load
haystack-api_1 | roberta.model = RobertaModel.from_pretrained(str(pretrained_model_name_or_path), kwargs)
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/transformers/modeling_utils.py", line 1208, in from_pretrained
haystack-api_1 | f"Unable to load weights from pytorch checkpoint file for '{pretrained_model_name_or_path}' "
haystack-api_1 | OSError: Unable to load weights from pytorch checkpoint file for 'deepset/roberta-base-squad2' at '/root/.cache/huggingface/transformers/eac3273a8097dda671e3bea1db32c616e74f36a306c65b4858171c98d6db83e9.084aa7284f3a51fa1c8f0641aa04c47d366fbd18711f29d0a995693cfdbc9c9e'If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
haystack-api_1 |
haystack-api_1 | During handling of the above exception, another exception occurred:
haystack-api_1 |
haystack-api_1 | Traceback (most recent call last):
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
haystack-api_1 | worker.init_process()
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/uvicorn/workers.py", line 66, in init_process
haystack-api_1 | super(UvicornWorker, self).init_process()
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 134, in init_process
haystack-api_1 | self.load_wsgi()
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
haystack-api_1 | self.wsgi = self.app.wsgi()
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
haystack-api_1 | self.callable = self.load()
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
haystack-api_1 | return self.load_wsgiapp()
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
haystack-api_1 | return util.import_app(self.app_uri)
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 359, in import_app
haystack-api_1 | mod = importlib.import_module(module)
haystack-api_1 | File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module
haystack-api_1 | return _bootstrap._gcd_import(name[level:], package, level)
haystack-api_1 | File "pip install 'ray[default]'
. Please update your install command.
haystack-api_1 | "update your install command.", FutureWarning)
haystack-api_1 | pdftotext version 4.03 [www.xpdfreader.com]
haystack-api_1 | Copyright 1996-2021 Glyph & Cog, LLCdocker stats log is following: CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS 61f306700043 haystack_haystack-api_1 0.05% 282MiB / 12.45GiB 2.21% 2.59MB / 95.3kB 0B / 0B 2 5cd1972a99f4 haystack_elasticsearch_1 0.26% 1.298GiB / 12.45GiB 10.43% 5.84kB / 3.71kB 0B / 0B 61 d7934023abd3 haystack_ui_1 2.57% 101.8MiB / 12.45GiB 0.80% 142kB / 203kB 0B / 0B 7
Hi @NeekHua , there are two things that catch my eye in your logs
streamlit.caching.CacheKeyNotFoundError: Key not found in mem cache
Exception: Failed loading pipeline component 'Reader': Unable to load weights from pytorch checkpoint file for 'deepset/roberta-base-squad2' at '/root/.cache/huggingface/transformers/eac3273a8097dda671e3bea1db32c616e74f36a306c65b4858171c98d6db83e9.084aa7284f3a51fa1c8f0641aa04c47d366fbd18711f29d0a995693cfdbc9c9e'If you tried to load a PyTorch model from a TF 2.0 checkpoint, please set from_tf=True.
Is it possible that the problem lies in your cache? Perhaps something around permissions?
One way to test this would be to run a script that loads a huggingface model from cache. In Haystack, you could try running a script like this twice
reader = FARMReader(model_name_or_path="deepset/roberta-base-squad2")
I've encountered the same issue. Have you figured out a solution? @NeekHua
@julian-risch i encountered the same /similar issue when running docker-compose up. is it possible you seperate the components into several docker image so that we can run them one by one? Thanks,
I am not sure whether I correctly understand your idea. In https://github.com/deepset-ai/haystack/blob/master/docker-compose.yml we already have separate components with three images: "deepset/haystack-cpu:latest", "deepset/elasticsearch-game-of-thrones", and "deepset/haystack-streamlit-ui:latest"
maybe you can ignore my comments. @julian-risch however, I did encounter the following error message when run with sudo docker-compose up, please kindly advise how to handle it. Thanks a lot!
haystack-api_1 | During handling of the above exception, another exception occurred:
haystack-api_1 |
haystack-api_1 | Traceback (most recent call last):
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
haystack-api_1 | worker.init_process()
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/uvicorn/workers.py", line 66, in init_process
haystack-api_1 | super(UvicornWorker, self).init_process()
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 134, in init_process
haystack-api_1 | self.load_wsgi()
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
haystack-api_1 | self.wsgi = self.app.wsgi()
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
haystack-api_1 | self.callable = self.load()
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
haystack-api_1 | return self.load_wsgiapp()
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
haystack-api_1 | return util.import_app(self.app_uri)
haystack-api_1 | File "/usr/local/lib/python3.7/site-packages/gunicorn/util.py", line 359, in import_app
haystack-api_1 | mod = importlib.import_module(module)
haystack-api_1 | File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module
haystack-api_1 | return _bootstrap._gcd_import(name[level:], package, level)
haystack-api_1 | File "
Hi @XingYiBao , I can't replicate your issue with the information you provided. What I can suggest is to run docker without sudo
, and if it still doesn't work, to give us some more information about your setup, like:
docker-compose up
?docker-compose.yml
file in any way?and any other information that might help.
Note: the root of the issue (Unable to load weights from pytorch checkpoint file for 'deepset/roberta-base-squad2' at '/root/.cache/huggingface/transformers
) seems to come from transformers
(https://github.com/huggingface/transformers), and it's an odd one: https://github.com/huggingface/transformers/blob/51ee20fc26381ca8aba4d4da9b410379302ee1d1/src/transformers/modeling_utils.py#L1361. If somebody can provide a way to reproduce this issue reliably I will definitely investigate.
@ZanSara seems it is the default docker-compose.yml issue. Made some change and now it works. anyway, thanks a lot!
Glad to hear! If you could share the changes you've made to the docker-compose.yml
we can fix the default one, so that it works for everybody :slightly_smiling_face:
@ZanSara no problem. Below are some changes we made to the docker-compose.yml file. To use the network_mode:bridge, otherwise the default ip created by docker MAY conflict with your internal network ip addresses. The sample file after changing is as below:
version: "3"
services:
haystack-api:
build:
context: .
dockerfile: Dockerfile
image: "/deepset/haystack-cpu:latest"
# Mount custom Pipeline YAML and custom Components.
# volumes:
# - ./rest_api/pipeline:/home/user/rest_api/pipeline
ports:
- 8000:8000
environment:
# See rest_api/pipelines.yaml for configurations of Search & Indexing Pipeline.
#- ELASTICSEARCHDOCUMENTSTORE_PARAMS_HOST=elasticsearch
#- DOCUMENTSTORE_PARAMS_HOST=elasticsearch
- DOCUMENTSTORE_PARAMS_HOST={ip address of elasticsearch host}
restart: always
#depends_on:
# - elasticsearch
command: "/bin/bash -c 'sleep 15 && gunicorn rest_api.application:app -b 0.0.0.0 -k uvicorn.workers.UvicornWorker --workers 1 --timeout 180'"
network_mode: "bridge"
elasticsearch:
# This will start an empty elasticsearch instance (so you have to add your documents yourself)
#image: "elasticsearch:7.9.2"
# If you want a demo image instead that is "ready-to-query" with some indexed Game of Thrones articles:
image: "/deepset/elasticsearch-game-of-thrones"
ports:
- 9200:9200
environment:
- discovery.type=single-node
network_mode: "bridge"
ui:
build:
context: ui
dockerfile: Dockerfile
image: "/deepset/haystack-streamlit-ui:latest"
ports:
- 8501:8501
environment:
- API_ENDPOINT=http://{your ip address}:8000
- EVAL_FILE=eval_labels_example.csv
network_mode: "bridge"
BTW, another SEPERATE issue: I strongly recommend that you specify the version for each docker image so that it won't use the latest one, because the latest one may result in unexpected problem. For example, this is the docker-compose-gpu.yml file after I changed your original one:
version: "3"
services:
haystack-api:
build:
context: .
dockerfile: Dockerfile
image: "/deepset/haystack-gpu:0.10.0"
while the docker-all.repo.ebaotech.com/deepset/haystack-gpu:latest does NOT work.
Fantastic, thank you! (I took the liberty of adding a code block around the YAML for readability, I hope you don't mind).
Yes, the latest image might break sometimes, so pinning it to the latest release it's a good idea. I'm going to discuss it with the rest of the team.
Closing for now. Is somebody else have the same issue, feel free to re-open or to just open a new issue :slightly_smiling_face:
Describe the bug I am trying to replicate the docker (demo) with the webapp (streamlit) version of the code. When i run docker compose up i am getting the below error
Error message Error : raise ConnectionError(e, request=request) ui_1 | requests.exceptions.ConnectionError: HTTPConnectionPool(host='haystack-api', port=8000): Max retries exceeded with url: /query (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5cce1a2350>: Failed to establish a new connection: [Errno 111] Connection refused'))
System: