Skip to content

Adds translation pipeline#3419

Merged
thomwolf merged 30 commits intohuggingface:masterfrom
patrickvonplaten:add_translation_pipeline
Mar 26, 2020
Merged

Adds translation pipeline#3419
thomwolf merged 30 commits intohuggingface:masterfrom
patrickvonplaten:add_translation_pipeline

Conversation

@patrickvonplaten
Copy link
Copy Markdown
Contributor

@patrickvonplaten patrickvonplaten commented Mar 24, 2020

The API for translation is as follows:

en_fr_translation = pipeline("translation_en_to_fr")
en_fr_translation("How old are you?")

for English to French translation.

PR adds tests and gives an example in the docstring.
PR builds on #3413 and should be merged after this one.

Example:
Screenshot from 2020-03-26 11-10-52

Comment thread src/transformers/configuration_t5.py Outdated
Copy link
Copy Markdown
Member

@thomwolf thomwolf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this PR is to considered after we agree on #3413 (see my comments)

Comment thread src/transformers/configuration_t5.py Outdated
Comment thread src/transformers/pipelines.py Outdated
@patrickvonplaten patrickvonplaten force-pushed the add_translation_pipeline branch from 2a256ca to c0c840c Compare March 26, 2020 10:27
Comment thread src/transformers/pipelines.py Outdated
Translates from one language to another.

Usage::
en_fr_translator = pipeline("translation", from_lng="English", to_lng="French")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can yo update this doc string?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@codecov-io
Copy link
Copy Markdown

codecov-io commented Mar 26, 2020

Codecov Report

Merging #3419 into master will increase coverage by 0.03%.
The diff coverage is 94.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3419      +/-   ##
==========================================
+ Coverage   77.76%   77.80%   +0.03%     
==========================================
  Files         100      100              
  Lines       16995    17025      +30     
==========================================
+ Hits        13216    13246      +30     
  Misses       3779     3779              
Impacted Files Coverage Δ
src/transformers/__init__.py 98.92% <ø> (ø)
src/transformers/pipelines.py 74.78% <94.44%> (+1.51%) ⬆️
src/transformers/modeling_utils.py 91.86% <0.00%> (+0.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9c683ef...a5160a6. Read the comment docs.

@thomwolf thomwolf merged commit 022e8fa into huggingface:master Mar 26, 2020
Copy link
Copy Markdown
Member

@LysandreJik LysandreJik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

):
r"""
Args:
*texts: (list of strings) articles to be summarized
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

texts to be translated instead of summarized?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants