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

feat: Bump transformers version to remove torch scatter dependency #3703

Merged
merged 4 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,6 @@ jobs:
- name: Setup Python
uses: ./.github/actions/python_cache/

- name: Install torch-scatter
run: pip install torch-scatter -f https://data.pyg.org/whl/torch-1.12.0+cpu.html

# TODO Let's try to remove this one from the unit tests
- name: Install pdftotext
run: wget --no-check-certificate https://dl.xpdfreader.com/xpdf-tools-linux-4.04.tar.gz && tar -xvf xpdf-tools-linux-4.04.tar.gz && sudo cp xpdf-tools-linux-4.04/bin64/pdftotext /usr/local/bin
Expand Down
2 changes: 0 additions & 2 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ FROM $build_image AS build-image

ARG haystack_version
ARG haystack_extras
ARG torch_scatter

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential gcc git curl \
Expand All @@ -28,7 +27,6 @@ ENV PATH="/opt/venv/bin:$PATH"
RUN pip install --upgrade pip && \
pip install --no-cache-dir .${haystack_extras} && \
pip install --no-cache-dir ./rest_api && \
pip install --no-cache-dir torch-scatter -f $torch_scatter

FROM $base_immage AS final

Expand Down
19 changes: 0 additions & 19 deletions haystack/nodes/reader/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,6 @@
from haystack.nodes.reader.base import BaseReader
from haystack.modeling.utils import initialize_device_settings

torch_scatter_installed = True
torch_scatter_wrong_version = False
try:
import torch_scatter # pylint: disable=unused-import
except ImportError:
torch_scatter_installed = False
except OSError:
torch_scatter_wrong_version = True


logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -122,15 +112,6 @@ def __init__(
[torch.device('cuda:0'), "mps", "cuda:1"]). When specifying `use_gpu=False` the devices
parameter is not used and a single cpu device is used for inference.
"""
if not torch_scatter_installed:
raise ImportError(
"Please install torch_scatter to use TableReader. You can follow the instructions here: https://github.com/rusty1s/pytorch_scatter"
)
if torch_scatter_wrong_version:
raise ImportError(
"torch_scatter could not be loaded. This could be caused by a mismatch between your cuda version and the one used by torch_scatter."
"Please try to reinstall torch-scatter. You can follow the instructions here: https://github.com/rusty1s/pytorch_scatter"
)
super().__init__()

self.devices, _ = initialize_device_settings(devices=devices, use_cuda=use_gpu, multi_gpu=False)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ dependencies = [
"torch>1.9,<1.13",
"requests",
"pydantic",
"transformers==4.21.2",
"transformers==4.25.1",
"nltk",
"pandas",
"rank_bm25",
Expand Down