From bf947cc1d1cc7ab194e43c66d45ac0459a404d1f Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sat, 1 May 2021 14:11:55 +0530 Subject: [PATCH 01/13] added all --- .github/workflows/translation.yml | 23 +++++++++++ .gitignore | 2 + translation/Dockerfile | 29 ++++++++++++++ translation/README.MD | 2 + translation/lambda/__init__.py | 0 translation/lambda/main.py | 8 ++++ translation/requirements.txt | 1 + translation/src/__init__.py | 0 translation/src/easy_nmt.py | 57 +++++++++++++++++++++++++++ translation/tests/__init__.py | 0 translation/tests/test_translation.py | 40 +++++++++++++++++++ 11 files changed, 162 insertions(+) create mode 100644 .github/workflows/translation.yml create mode 100644 translation/Dockerfile create mode 100644 translation/README.MD create mode 100644 translation/lambda/__init__.py create mode 100644 translation/lambda/main.py create mode 100644 translation/requirements.txt create mode 100644 translation/src/__init__.py create mode 100644 translation/src/easy_nmt.py create mode 100644 translation/tests/__init__.py create mode 100644 translation/tests/test_translation.py diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml new file mode 100644 index 0000000..99deff5 --- /dev/null +++ b/.github/workflows/translation.yml @@ -0,0 +1,23 @@ +name: Translation + +on: + pull_request: + branches: + - main + paths: + - "translation/**" + +jobs: + translation: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./translation + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: ${{ github.ref }} + - name: Build container + run: | + docker build --tag translation:latest . \ No newline at end of file diff --git a/.gitignore b/.gitignore index b6e4761..1774af1 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,5 @@ dmypy.json # Pyre type checker .pyre/ + +.DS_Store \ No newline at end of file diff --git a/translation/Dockerfile b/translation/Dockerfile new file mode 100644 index 0000000..63b8c0c --- /dev/null +++ b/translation/Dockerfile @@ -0,0 +1,29 @@ +FROM amazon/aws-lambda-python + +RUN mkdir /cache +RUN mkdir /cache/easynmt +RUN mkdir /cache/transformers +RUN mkdir /cache/torch + +ENV EASYNMT_CACHE=/cache/easynmt +ENV TRANSFORMERS_CACHE=/cache/transformers +ENV TRANSFORMERS_VERBOSITY=error +ENV TORCH_CACHE=/cache/torch + +RUN yum -y install gcc-c++ + +COPY requirements.txt requirements.txt +RUN pip install torch==1.8+cpu -f https://download.pytorch.org/whl/torch_stable.html --no-cache-dir +RUN pip install -r requirements.txt --no-cache-dir\ + && python -m nltk.downloader 'punkt' + +COPY ./ ./ + +# Run test cases and this saves the transformer model in the container +RUN pip install pytest --no-cache-dir && pytest tests -s -vv + +RUN chmod -R 0755 /cache/easynmt +RUN chmod -R 0755 /cache/transformers +RUN chmod -R 0755 /cache/torch + +CMD [ "lambda/main.lambda_handler"] \ No newline at end of file diff --git a/translation/README.MD b/translation/README.MD new file mode 100644 index 0000000..86f6e91 --- /dev/null +++ b/translation/README.MD @@ -0,0 +1,2 @@ +## Translation service +Serverless translation using AWS Lambda & EasyNMT & Transformers & Helsinki OPUS models \ No newline at end of file diff --git a/translation/lambda/__init__.py b/translation/lambda/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/translation/lambda/main.py b/translation/lambda/main.py new file mode 100644 index 0000000..06c3286 --- /dev/null +++ b/translation/lambda/main.py @@ -0,0 +1,8 @@ +from src.easy_nmt import translate_records + + +def lambda_handler(event, context): + try: + return translate_records(event) + except Exception as e: + raise diff --git a/translation/requirements.txt b/translation/requirements.txt new file mode 100644 index 0000000..2dd14b3 --- /dev/null +++ b/translation/requirements.txt @@ -0,0 +1 @@ +easynmt==2.0.1 \ No newline at end of file diff --git a/translation/src/__init__.py b/translation/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/translation/src/easy_nmt.py b/translation/src/easy_nmt.py new file mode 100644 index 0000000..f289058 --- /dev/null +++ b/translation/src/easy_nmt.py @@ -0,0 +1,57 @@ +import json +import os +import time +from typing import List, Optional + +from easynmt import EasyNMT + +model_name = os.getenv('EASYNMT_MODEL', 'opus-mt') +model_args = json.loads(os.getenv('EASYNMT_MODEL_ARGS', '{}')) +print("Load model: "+ model_name) +model = EasyNMT(model_name, load_translator=True, **model_args) + + +def translate_records(target_lang: str, records: List[dict], source_lang: Optional[str] = '', beam_size: Optional[int] = 5, perform_sentence_splitting: Optional[bool] = True): + """ + Translates the records to the given target language. + :param records: Record that should be translated + :param target_lang: Target language + :param source_lang: Language of text. Optional, if empty: Automatic language detection + :param beam_size: Beam size. Optional + :param perform_sentence_splitting: Split longer documents into individual sentences for translation. Optional + :return: Returns a json with the translated records + """ + + + # if 'EASYNMT_MAX_TEXT_LEN' in os.environ and len(text) > int(os.getenv('EASYNMT_MAX_TEXT_LEN')): + # raise ValueError("Text was too long. Only texts up to {} characters are allowed".format(os.getenv('EASYNMT_MAX_TEXT_LEN'))) + + # if beam_size < 1 or ('EASYNMT_MAX_BEAM_SIZE' in os.environ and beam_size > int(os.getenv('EASYNMT_MAX_BEAM_SIZE'))): + # raise ValueError("Illegal beam size") + + if len(source_lang.strip()) == 0: + source_lang = None + + + start_time = time.time() + output = {"target_lang": target_lang} + + texts = [record["text"] for record in records] + + if source_lang is None: + detected_langs = model.language_detection(texts) + output['detected_langs'] = detected_langs + + translations = model.translate(texts, target_lang=target_lang, source_lang=source_lang, beam_size=beam_size, perform_sentence_splitting=perform_sentence_splitting, batch_size=int(os.getenv('EASYNMT_BATCH_SIZE', 16))) + for translation, detected_lang, record in zip(translations, detected_langs, records): + record["translated"] = translation + if translation == record["text"]: + record["source_lang"] = target_lang + record["translated"] = "" + else: + record["source_lang"] = detected_lang + del record["text"] + + output["records"] = records + output['translation_time'] = time.time()-start_time + return output diff --git a/translation/tests/__init__.py b/translation/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/translation/tests/test_translation.py b/translation/tests/test_translation.py new file mode 100644 index 0000000..8ce5e11 --- /dev/null +++ b/translation/tests/test_translation.py @@ -0,0 +1,40 @@ +from src.easy_nmt import translate_records + +requests = { + "records": [ + { + "id": "11", + "text": "Nunca volveré a bajar su app se roba tu información bancaria y se autoriza una suscripción que nunca solicitas", + }, + { + "id": "12", + "text": "I will never download your app will steal your bank information and authorizes a subscription you never request", + }, +], + "target_lang": "en" +} + +expected_response = { + + "records": [ + { + "id": "11", + "translated": "I'll never download your app again. It steals your bank information and authorizes a subscription that you never request.", + "source_lang": "es", + }, + { + "id": "12", + "translated": "", + "source_lang": "en", + }, + ] +} + + + +def test_response(): + global expected_response + response = translate_records(**requests) + assert expected_response == response + + From 059fd535b442d71f50b2f7ae02adfcc4688d3fc4 Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sat, 1 May 2021 15:01:23 +0530 Subject: [PATCH 02/13] push to lambda --- .github/workflows/translation.yml | 18 +++++++++++++++++- translation/Dockerfile | 2 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml index 99deff5..209ff06 100644 --- a/.github/workflows/translation.yml +++ b/.github/workflows/translation.yml @@ -20,4 +20,20 @@ jobs: ref: ${{ github.ref }} - name: Build container run: | - docker build --tag translation:latest . \ No newline at end of file + docker build --tag translation:latest . + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + - name: Push2ECR + id: ecr + uses: jwalton/gh-ecr-push@v1 + with: + access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + region: us-east-2 + image: translation:latest + - name: Update lambda with image + run: aws lambda update-function-code --function-name translation --image-uri 968911158010.dkr.ecr.us-east-1.amazonaws.com/translation:latest \ No newline at end of file diff --git a/translation/Dockerfile b/translation/Dockerfile index 63b8c0c..e6c74bc 100644 --- a/translation/Dockerfile +++ b/translation/Dockerfile @@ -20,7 +20,7 @@ RUN pip install -r requirements.txt --no-cache-dir\ COPY ./ ./ # Run test cases and this saves the transformer model in the container -RUN pip install pytest --no-cache-dir && pytest tests -s -vv +# RUN pip install pytest --no-cache-dir && pytest tests -s -vv RUN chmod -R 0755 /cache/easynmt RUN chmod -R 0755 /cache/transformers From f92beb9421563cdc90d94d9061e12c21c20731da Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sat, 1 May 2021 15:22:00 +0530 Subject: [PATCH 03/13] Update translation.yml --- .github/workflows/translation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml index 209ff06..d19fb81 100644 --- a/.github/workflows/translation.yml +++ b/.github/workflows/translation.yml @@ -33,7 +33,7 @@ jobs: with: access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - region: us-east-2 + region: us-east-1 image: translation:latest - name: Update lambda with image run: aws lambda update-function-code --function-name translation --image-uri 968911158010.dkr.ecr.us-east-1.amazonaws.com/translation:latest \ No newline at end of file From 70ce77ea1421f3fe52340a4210d07b57bb88e2d5 Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sat, 1 May 2021 16:56:12 +0530 Subject: [PATCH 04/13] Update Dockerfile --- translation/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/translation/Dockerfile b/translation/Dockerfile index e6c74bc..8dfae46 100644 --- a/translation/Dockerfile +++ b/translation/Dockerfile @@ -2,6 +2,7 @@ FROM amazon/aws-lambda-python RUN mkdir /cache RUN mkdir /cache/easynmt +RUN mkdir /cache/easynmt/opus-mt_part RUN mkdir /cache/transformers RUN mkdir /cache/torch @@ -23,6 +24,7 @@ COPY ./ ./ # RUN pip install pytest --no-cache-dir && pytest tests -s -vv RUN chmod -R 0755 /cache/easynmt +RUN chmod -R 0755 /cache/easynmt/opus-mt_part RUN chmod -R 0755 /cache/transformers RUN chmod -R 0755 /cache/torch From 4414d727bc060f33962d2fd3f58f58184c934532 Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sat, 1 May 2021 18:05:54 +0530 Subject: [PATCH 05/13] Update Dockerfile --- translation/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/translation/Dockerfile b/translation/Dockerfile index 8dfae46..c23b7fe 100644 --- a/translation/Dockerfile +++ b/translation/Dockerfile @@ -23,9 +23,9 @@ COPY ./ ./ # Run test cases and this saves the transformer model in the container # RUN pip install pytest --no-cache-dir && pytest tests -s -vv -RUN chmod -R 0755 /cache/easynmt -RUN chmod -R 0755 /cache/easynmt/opus-mt_part -RUN chmod -R 0755 /cache/transformers -RUN chmod -R 0755 /cache/torch +RUN chmod -R 0777 /cache/easynmt +RUN chmod -R 0777 /cache/easynmt/opus-mt_part +RUN chmod -R 0777 /cache/transformers +RUN chmod -R 0777 /cache/torch CMD [ "lambda/main.lambda_handler"] \ No newline at end of file From 250a132843ed09d2f46c6011ea519df74d9184f8 Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sat, 1 May 2021 18:19:19 +0530 Subject: [PATCH 06/13] Update Dockerfile --- translation/Dockerfile | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/translation/Dockerfile b/translation/Dockerfile index c23b7fe..e379134 100644 --- a/translation/Dockerfile +++ b/translation/Dockerfile @@ -1,15 +1,16 @@ FROM amazon/aws-lambda-python -RUN mkdir /cache -RUN mkdir /cache/easynmt -RUN mkdir /cache/easynmt/opus-mt_part -RUN mkdir /cache/transformers -RUN mkdir /cache/torch - -ENV EASYNMT_CACHE=/cache/easynmt -ENV TRANSFORMERS_CACHE=/cache/transformers +RUN mkdir /tmp/cache +RUN mkdir /tmp/cache/easynmt +RUN mkdir /tmp/cache/easynmt/opus-mt_part +RUN mkdir /tmp/cache/transformers +RUN mkdir /tmp/cache/torch + +ENV EASYNMT_CACHE=/tmp/cache/easynmt +ENV TRANSFORMERS_CACHE=/tmp/cache/transformers ENV TRANSFORMERS_VERBOSITY=error -ENV TORCH_CACHE=/cache/torch +ENV TORCH_CACHE=/tmp/cache/torch +ENV NLTK_DATA=/tmp RUN yum -y install gcc-c++ @@ -23,9 +24,9 @@ COPY ./ ./ # Run test cases and this saves the transformer model in the container # RUN pip install pytest --no-cache-dir && pytest tests -s -vv -RUN chmod -R 0777 /cache/easynmt -RUN chmod -R 0777 /cache/easynmt/opus-mt_part -RUN chmod -R 0777 /cache/transformers -RUN chmod -R 0777 /cache/torch +# RUN chmod -R 0777 /cache/easynmt +# RUN chmod -R 0777 /cache/easynmt/opus-mt_part +# RUN chmod -R 0777 /cache/transformers +# RUN chmod -R 0777 /cache/torch CMD [ "lambda/main.lambda_handler"] \ No newline at end of file From a3259ba4d1dfb1e1dd10041c755c8b5032faf51a Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sat, 1 May 2021 18:26:17 +0530 Subject: [PATCH 07/13] Update main.py --- translation/lambda/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translation/lambda/main.py b/translation/lambda/main.py index 06c3286..f946208 100644 --- a/translation/lambda/main.py +++ b/translation/lambda/main.py @@ -3,6 +3,6 @@ def lambda_handler(event, context): try: - return translate_records(event) + return translate_records(**event) except Exception as e: raise From 27cf5b3cb4af9dec365a2fa55f0ff5d510a6626c Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sat, 1 May 2021 19:01:33 +0530 Subject: [PATCH 08/13] remove tmp --- translation/Dockerfile | 26 +++++++++++++------------- translation/src/easy_nmt.py | 2 ++ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/translation/Dockerfile b/translation/Dockerfile index e379134..3b5fd96 100644 --- a/translation/Dockerfile +++ b/translation/Dockerfile @@ -1,15 +1,15 @@ FROM amazon/aws-lambda-python -RUN mkdir /tmp/cache -RUN mkdir /tmp/cache/easynmt -RUN mkdir /tmp/cache/easynmt/opus-mt_part -RUN mkdir /tmp/cache/transformers -RUN mkdir /tmp/cache/torch - -ENV EASYNMT_CACHE=/tmp/cache/easynmt -ENV TRANSFORMERS_CACHE=/tmp/cache/transformers +RUN mkdir /cache +RUN mkdir /cache/easynmt +RUN mkdir /cache/easynmt/opus-mt_part +RUN mkdir /cache/transformers +RUN mkdir /cache/torch + +ENV EASYNMT_CACHE=/cache/easynmt +ENV TRANSFORMERS_CACHE=/cache/transformers ENV TRANSFORMERS_VERBOSITY=error -ENV TORCH_CACHE=/tmp/cache/torch +ENV TORCH_CACHE=/cache/torch ENV NLTK_DATA=/tmp RUN yum -y install gcc-c++ @@ -24,9 +24,9 @@ COPY ./ ./ # Run test cases and this saves the transformer model in the container # RUN pip install pytest --no-cache-dir && pytest tests -s -vv -# RUN chmod -R 0777 /cache/easynmt -# RUN chmod -R 0777 /cache/easynmt/opus-mt_part -# RUN chmod -R 0777 /cache/transformers -# RUN chmod -R 0777 /cache/torch +RUN chmod -R 0777 /cache/easynmt +RUN chmod -R 0777 /cache/easynmt/opus-mt_part +RUN chmod -R 0777 /cache/transformers +RUN chmod -R 0777 /cache/torch CMD [ "lambda/main.lambda_handler"] \ No newline at end of file diff --git a/translation/src/easy_nmt.py b/translation/src/easy_nmt.py index f289058..268415c 100644 --- a/translation/src/easy_nmt.py +++ b/translation/src/easy_nmt.py @@ -41,6 +41,8 @@ def translate_records(target_lang: str, records: List[dict], source_lang: Option if source_lang is None: detected_langs = model.language_detection(texts) output['detected_langs'] = detected_langs + else: + detected_langs = [source_lang]*len(texts) translations = model.translate(texts, target_lang=target_lang, source_lang=source_lang, beam_size=beam_size, perform_sentence_splitting=perform_sentence_splitting, batch_size=int(os.getenv('EASYNMT_BATCH_SIZE', 16))) for translation, detected_lang, record in zip(translations, detected_langs, records): From 05920ee68ee4b2a4514554e0ad7a85e15c2183ef Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sat, 1 May 2021 19:21:21 +0530 Subject: [PATCH 09/13] small changes --- translation/Dockerfile | 2 +- translation/src/easy_nmt.py | 6 +----- translation/tests/test_translation.py | 3 ++- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/translation/Dockerfile b/translation/Dockerfile index 3b5fd96..3c6e994 100644 --- a/translation/Dockerfile +++ b/translation/Dockerfile @@ -22,7 +22,7 @@ RUN pip install -r requirements.txt --no-cache-dir\ COPY ./ ./ # Run test cases and this saves the transformer model in the container -# RUN pip install pytest --no-cache-dir && pytest tests -s -vv +RUN pip install pytest --no-cache-dir && pytest tests -s -vv RUN chmod -R 0777 /cache/easynmt RUN chmod -R 0777 /cache/easynmt/opus-mt_part diff --git a/translation/src/easy_nmt.py b/translation/src/easy_nmt.py index 268415c..4727909 100644 --- a/translation/src/easy_nmt.py +++ b/translation/src/easy_nmt.py @@ -38,11 +38,7 @@ def translate_records(target_lang: str, records: List[dict], source_lang: Option texts = [record["text"] for record in records] - if source_lang is None: - detected_langs = model.language_detection(texts) - output['detected_langs'] = detected_langs - else: - detected_langs = [source_lang]*len(texts) + detected_langs = model.language_detection(texts) translations = model.translate(texts, target_lang=target_lang, source_lang=source_lang, beam_size=beam_size, perform_sentence_splitting=perform_sentence_splitting, batch_size=int(os.getenv('EASYNMT_BATCH_SIZE', 16))) for translation, detected_lang, record in zip(translations, detected_langs, records): diff --git a/translation/tests/test_translation.py b/translation/tests/test_translation.py index 8ce5e11..0277546 100644 --- a/translation/tests/test_translation.py +++ b/translation/tests/test_translation.py @@ -11,7 +11,8 @@ "text": "I will never download your app will steal your bank information and authorizes a subscription you never request", }, ], - "target_lang": "en" + "target_lang": "en", + "source_lang": "ROMANCE" } expected_response = { From bf3d3fab9de458a8545ebb90b1536bbcefff2191 Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sat, 1 May 2021 19:34:40 +0530 Subject: [PATCH 10/13] Update test_translation.py --- translation/tests/test_translation.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/translation/tests/test_translation.py b/translation/tests/test_translation.py index 0277546..8ee9af8 100644 --- a/translation/tests/test_translation.py +++ b/translation/tests/test_translation.py @@ -10,32 +10,28 @@ "id": "12", "text": "I will never download your app will steal your bank information and authorizes a subscription you never request", }, + { + "id": "13", + "text": "Je ne téléchargerai jamais votre application volera" + } ], "target_lang": "en", "source_lang": "ROMANCE" } -expected_response = { - - "records": [ - { - "id": "11", - "translated": "I'll never download your app again. It steals your bank information and authorizes a subscription that you never request.", - "source_lang": "es", - }, - { - "id": "12", - "translated": "", - "source_lang": "en", - }, - ] -} +expected_response = {'target_lang': 'en', + 'records': [ + {'id': '11', 'translated': "I'll never download your app again, steal your bank information and authorize a subscription that you never ask for.", 'source_lang': 'es'}, + {'id': '12', 'translated': '', 'source_lang': 'en'}, + {'id': '13', 'translated': 'I will never download your app will fly', 'source_lang': 'fr'}] + } def test_response(): global expected_response response = translate_records(**requests) + del response["translation_time"] assert expected_response == response From 8c2f327dd170f68ae405d369a66bb55490172464 Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sat, 1 May 2021 19:43:51 +0530 Subject: [PATCH 11/13] Update Dockerfile --- translation/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translation/Dockerfile b/translation/Dockerfile index 3c6e994..fad6ac1 100644 --- a/translation/Dockerfile +++ b/translation/Dockerfile @@ -25,7 +25,7 @@ COPY ./ ./ RUN pip install pytest --no-cache-dir && pytest tests -s -vv RUN chmod -R 0777 /cache/easynmt -RUN chmod -R 0777 /cache/easynmt/opus-mt_part +# RUN chmod -R 0777 /cache/easynmt/opus-mt_part RUN chmod -R 0777 /cache/transformers RUN chmod -R 0777 /cache/torch From d955d4b4190c6fcf4cbefbd0fe8fd4711365c061 Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sun, 11 Jul 2021 17:18:32 +0530 Subject: [PATCH 12/13] filtered warnings --- translation/src/easy_nmt.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/translation/src/easy_nmt.py b/translation/src/easy_nmt.py index 4727909..a3cec48 100644 --- a/translation/src/easy_nmt.py +++ b/translation/src/easy_nmt.py @@ -1,8 +1,11 @@ import json import os import time +import warnings from typing import List, Optional +warnings.filterwarnings("ignore") + from easynmt import EasyNMT model_name = os.getenv('EASYNMT_MODEL', 'opus-mt') From f296f2dd9d97740281722b1eb9eb3b7c6abf1555 Mon Sep 17 00:00:00 2001 From: Pratik Bhavsar Date: Sun, 11 Jul 2021 17:22:20 +0530 Subject: [PATCH 13/13] Update translation.yml --- .github/workflows/translation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/translation.yml b/.github/workflows/translation.yml index d19fb81..a5978f5 100644 --- a/.github/workflows/translation.yml +++ b/.github/workflows/translation.yml @@ -3,7 +3,7 @@ name: Translation on: pull_request: branches: - - main + - master # this can be main paths: - "translation/**"