Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Integrate machine translation to Darma chat #6

Open
wants to merge 1 commit into
base: darma
Choose a base branch
from

Conversation

thammegowda
Copy link
Member

@thammegowda thammegowda commented Jul 6, 2022

Patch description

  • Enables two-way machine translation for MT
  • Configurable MT backends: RTG, HF transformers with flexible argument support
  • Flexibility of translating human input, bot output, both, or None

Testing steps

cd parlai/crowdsourcing/tasks/darma_chat 
python run.py

Other information
requires installation of transformers lib


( docs copied from README)

Enabling MT

see translator.py for the code

Add this config block as mephisto.blueprint.translator

translator:
  activation: 'pre' # pre, post, pre+post, null
  preprocess: rtg_api
  preprocess_args:
    # TODO: change the URL to DARMA hosted service
    api_url: http://rtg.isi.edu/many-eng/v1/translate
  postprocess: huggingface
  postprocess_args:
    model: Helsinki-NLP/opus-mt-en-fr

The key activation takes the following values

  • pre - Only translate human input (via preprocess config)
  • post - Only translate bot output (via postprocess config)
  • pre+post - Enable both pre and post
  • null - Disable MT. Which has same effect as deleting the whole translator config block

preprocess and postprocess takes the MT backend name.
Whereas {pre,post}process_args take a dictionary of arguments to MT backend.

The following MT backends are supported

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant