Skip to content

Commit a7819e7

Browse files
authored
Merge pull request #96 from sbintuitions/v2
v2: merge to MTEB's codebase
2 parents 51f760b + df894d8 commit a7819e7

File tree

80 files changed

+4643
-4928
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+4643
-4928
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
cache: "poetry"
3939

4040
- name: Install dependencies
41-
run: poetry install
41+
run: poetry install --all-extras
4242

4343
- name: Download unidic artifacts
4444
run: |

Dockerfile

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,58 @@
1-
FROM nvidia/cuda:11.2.2-cudnn8-runtime-ubuntu20.04 as base
2-
3-
### Install python 3.10 and set it as default python interpreter
4-
RUN apt update && apt install software-properties-common -y && \
5-
add-apt-repository ppa:deadsnakes/ppa -y && apt update && \
6-
apt install curl python3.10 build-essential vim -y && \
7-
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 && \
8-
update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1 && \
9-
apt install python3.10-venv python3.10-dev -y && \
10-
curl -Ss https://bootstrap.pypa.io/get-pip.py | python3.10 && \
11-
apt-get clean && rm -rf /var/lib/apt/lists/
12-
13-
FROM base as build
14-
15-
WORKDIR /tmp
16-
17-
RUN pip install poetry
18-
19-
COPY ./pyproject.toml ./poetry.lock* /tmp/
20-
21-
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes
22-
23-
FROM base as runtime
1+
# Use CUDA 12.1 for better compatibility with PyTorch 2.6+
2+
FROM nvidia/cuda:12.1.0-cudnn8-runtime-ubuntu22.04 AS base
3+
4+
# Prevent interactive prompts during package installation
5+
ENV DEBIAN_FRONTEND=noninteractive \
6+
PYTHONUNBUFFERED=1 \
7+
PYTHONDONTWRITEBYTECODE=1 \
8+
PIP_NO_CACHE_DIR=1 \
9+
PIP_DISABLE_PIP_VERSION_CHECK=1
10+
11+
# Install Python 3.11 and essential tools
12+
RUN apt-get update && apt-get install -y --no-install-recommends \
13+
python3.11 \
14+
python3.11-venv \
15+
python3.11-dev \
16+
python3-pip \
17+
build-essential \
18+
curl \
19+
git \
20+
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1 \
21+
&& update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1 \
22+
&& curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11 \
23+
&& pip install --no-cache-dir --upgrade pip setuptools wheel \
24+
&& apt-get clean \
25+
&& rm -rf /var/lib/apt/lists/*
26+
27+
# Build stage: export dependencies
28+
FROM base AS builder
29+
30+
WORKDIR /build
31+
32+
# Install poetry
33+
RUN pip install --no-cache-dir poetry==1.8.2
34+
35+
# Copy only dependency files first for better layer caching
36+
COPY pyproject.toml poetry.lock* ./
37+
38+
# Export dependencies to requirements.txt
39+
RUN poetry export -f requirements.txt --output requirements.txt --without-hashes --only main
40+
41+
# Runtime stage: install application
42+
FROM base AS runtime
2443

2544
WORKDIR /app
2645

27-
COPY --from=build /tmp/requirements.txt /code/requirements.txt
46+
# Copy application code and dependency files
47+
COPY src ./src
48+
COPY README.md pyproject.toml poetry.lock* ./
2849

29-
RUN pip install --no-cache-dir -r /code/requirements.txt
30-
RUN python -m unidic download
50+
# Install poetry temporarily to handle the installation
51+
RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
52+
&& pip install --no-cache-dir poetry==1.8.2 \
53+
&& poetry config virtualenvs.create false \
54+
&& poetry install --only main --no-interaction --no-ansi \
55+
&& pip uninstall -y poetry
3156

32-
# アプリケーションのコードをコピー
33-
COPY src /app/src
34-
COPY README.md /app/README.md
35-
COPY ./pyproject.toml /app/
36-
RUN pip install --no-cache-dir -e .
57+
# Set default command to run JMTEB
58+
CMD ["python", "-m", "jmteb.v2"]

0 commit comments

Comments
 (0)