Skip to content

Commit

Permalink
2023-11-22: rasa-transformers with pretrained sbert-large
Browse files Browse the repository at this point in the history
  • Loading branch information
mrodina committed Nov 22, 2023
1 parent ad9e8b7 commit 6b2b94a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,13 @@ build-docker-spacy-ru:
docker buildx bake -f docker/docker-bake.hcl base-builder && \
docker buildx bake -f docker/docker-bake.hcl spacy-ru

build-docker-full-ru:
build-docker-sbert-l:
export IMAGE_NAME=rasa && \
docker buildx use default && \
docker buildx bake -f docker/docker-bake.hcl base && \
docker buildx bake -f docker/docker-bake.hcl base-poetry && \
docker buildx bake -f docker/docker-bake.hcl base-builder && \
docker buildx bake -f docker/docker-bake.hcl full-ru
docker buildx bake -f docker/docker-bake.hcl sbert-l

build-docker-spacy-ru-gpu:
export IMAGE_NAME=rasa && \
Expand All @@ -317,8 +317,8 @@ stop-integration-containers: ## Stop the integration test containers.
build-e8: build-docker
docker tag rasa:localdev ghcr.io/epoch8/rasa/rasa:$(shell cat version)

build-e8-full-ru: build-docker-full-ru
docker tag rasa:localdev-full-ru ghcr.io/epoch8/rasa/rasa-full-ru:$(shell cat version)
build-e8-sbert-l: build-docker-sbert-l
docker tag rasa:localdev-sbert-l ghcr.io/epoch8/rasa/rasa-sbert-l:$(shell cat version)

build-e8-spacy-ru: build-docker-spacy-ru
docker tag rasa:localdev-spacy-ru ghcr.io/epoch8/rasa/rasa-spacy-ru:$(shell cat version)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ FROM ${IMAGE_BASE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH} as builder

# copy files
COPY . /build/
COPY docker/configs/config_pretrained_embeddings_full_ru.yml /build/config.yml
COPY docker/configs/config_pretrained_embeddings_sbert_large.yml /build/config.yml

# change working directory
WORKDIR /build

# install dependencies
RUN python -m venv /opt/venv && \
. /opt/venv/bin/activate && pip install --no-cache-dir -U "pip==22.*" -U "wheel>0.38.0"
RUN . /opt/venv/bin/activate && poetry install --extras full --no-dev --no-root --no-interaction
RUN . /opt/venv/bin/activate && poetry install --extras transformers --no-dev --no-root --no-interaction
RUN . /opt/venv/bin/activate && poetry build -f wheel -n && \
pip install --no-deps dist/*.whl && \
rm -rf dist *.egg-info
Expand All @@ -37,6 +37,10 @@ ENV HOME=/app

# update permissions & change user to not run as root
WORKDIR /app

RUN pip install huggingface_hub
RUN python -c "from huggingface_hub import snapshot_download; snapshot_download(repo_id='ai-forever/sbert_large_mt_nlu_ru', ignore_patterns=['*.msgpack', '*.bin'], local_dir='./weighs', local_dir_use_symlinks=True);"

RUN chgrp -R 0 /app && chmod -R g=u /app && chmod o+wr /app
USER 1001

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pipeline:

- name: LanguageModelFeaturizer
model_name: "bert"
model_weights: "ai-forever/sbert_large_mt_nlu_ru"
model_weights: "weighs"

- name: DIETClassifier
epochs: 50
Expand Down
8 changes: 4 additions & 4 deletions docker/docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ target "spacy-en" {
]
}

target "full-ru" {
dockerfile = "docker/Dockerfile.pretrained_embeddings_full_ru"
tags = ["${IMAGE_NAME}:${IMAGE_TAG}-full-ru"]
target "sbert-l" {

Check warning on line 197 in docker/docker-bake.hcl

View workflow job for this annotation

GitHub Actions / Typo CI

sbert

"sbert" is a typo. Did you mean "Osbert"?

Check warning on line 197 in docker/docker-bake.hcl

View workflow job for this annotation

GitHub Actions / Typo CI

sbert-l

"sbert-l" is a typo. Did you mean "Osbert-l"?
dockerfile = "docker/Dockerfile.pretrained_embeddings_sbert_large"
tags = ["${IMAGE_NAME}:${IMAGE_TAG}-sbert-l"]

Check warning on line 199 in docker/docker-bake.hcl

View workflow job for this annotation

GitHub Actions / Typo CI

sbert

"sbert" is a typo. Did you mean "Osbert"?

Check warning on line 199 in docker/docker-bake.hcl

View workflow job for this annotation

GitHub Actions / Typo CI

sbert-l

"sbert-l" is a typo. Did you mean "Osbert-l"?

args = {
IMAGE_BASE_NAME = "${IMAGE_NAME}"
Expand All @@ -209,7 +209,7 @@ target "full-ru" {
cache-from = [
"type=registry,ref=${IMAGE_NAME}:base-${BASE_IMAGE_HASH}",
"type=registry,ref=${IMAGE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH}",
"type=registry,ref=${IMAGE_NAME}:${IMAGE_TAG}-full-ru",
"type=registry,ref=${IMAGE_NAME}:${IMAGE_TAG}-sbert-l",

Check warning on line 212 in docker/docker-bake.hcl

View workflow job for this annotation

GitHub Actions / Typo CI

sbert

"sbert" is a typo. Did you mean "Osbert"?

Check warning on line 212 in docker/docker-bake.hcl

View workflow job for this annotation

GitHub Actions / Typo CI

sbert-l

"sbert-l" is a typo. Did you mean "Osbert-l"?
]
}

Expand Down

0 comments on commit 6b2b94a

Please sign in to comment.