transformers/tests
Lorenzo Ampil f16540fcba
Pipeline for Text Generation: GenerationPipeline (#3758)
* Add GenerationPipeline

* Fix parameter names

* Correct parameter __call__ parameters

* Add model type attribute and correct function calls for prepare_input

* Take out trailing commas from init attributes

* Remove unnecessary tokenization line

* Implement support for multiple text inputs

* Apply generation support for multiple input text prompts

* Take out tensor coersion

* Take out batch index

* Add text prompt to return sequence

* Squeeze token tensore before decoding

* Return only a single list of sequences if only one prompt was used

* Correct results variable name

* Add GenerationPipeline to SUPPORTED_TASKS with the alias , initalized w GPT2

* Registedred AutoModelWithLMHead for both pt and t

* Update docstring for GenerationPipeline

* Add kwargs parameter to mode.generate

* Take out kwargs parameter after all

* Add generation pipeline example in pipeline docstring

* Fix max length by squeezing tokens tensor

* Apply ensure_tensor_on_device to pytorch tensor

* Include generation step in torch.no_grad

* Take out input from prepare_xlm_input and set 'en' as default xlm_language

* Apply framework specific encoding during prepare_input

* Format w make style

* Move GenerationPipeline import to follow proper import sorting

* Take out training comma from generation dict

* Apply requested changes

* Change name to TextGenerationPipeline

* Apply TextGenerationPipeline rename to __init___

* Changing alias to

* Set input mapping as input to ensure_tensor_on_device

* Fix assertion placement

* Add test_text_generation

* Add TextGenerationPipeline to PipelineCommonTests

* Take out whitespace

* Format __init__ w black

* Fix __init__ style

* Forman __init___

* Add line to end of __init__

* Correct model tokenizer set for test_text_generation

* Ensure to return list of list, not list of string (to pass test)

* Limit test models to only 3 to limit runtime to address circleCI timeout error

* Update src/transformers/pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Update tests/test_pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Remove argument docstring, __init__, add additional __call__ arguments, and reformat results to list of dict

* Fix blank result list

* Add TextGenerationPipeline to pipelines.rst

* Update src/transformers/pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Fix typos from adding PADDING_TEXT_TOKEN_LENGTH

* Fix incorrectly moved result list

* Update src/transformers/pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Update src/transformers/pipelines.py

* Update src/transformers/pipelines.py

* Update src/transformers/pipelines.py

* Update src/transformers/pipelines.py

* Update src/transformers/pipelines.py

* Update src/transformers/pipelines.py

* Update src/transformers/pipelines.py

* Update src/transformers/pipelines.py

* Update src/transformers/pipelines.py

* Update src/transformers/pipelines.py

* Update src/transformers/pipelines.py

* Update src/transformers/pipelines.py

Co-Authored-By: Patrick von Platen <patrick.v.platen@gmail.com>

* Add back generation line and make style

* Take out blank whitespace

* Apply new alis, text-generation, to test_pipelines

* Fix text generation alias in test

* Update src/transformers/pipelines.py

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Co-authored-by: Julien Chaumond <chaumond@gmail.com>
2020-04-22 09:37:03 -04:00
..
fixtures AutoConfig + other Auto classes honor model_type 2020-01-11 02:46:17 +00:00
__init__.py GPU text generation: mMoved the encoded_prompt to correct device 2020-01-06 15:11:12 +01:00
test_activations.py get_activation('relu') provides a simple mapping from strings i… (#2807) 2020-02-13 08:28:33 -05:00
test_configuration_auto.py Map configs to models and tokenizers 2020-01-13 23:11:44 +00:00
test_configuration_common.py Pass kwargs to configuration (#3147) 2020-03-05 17:16:57 -05:00
test_doc_samples.py make style 2020-03-04 20:18:07 -05:00
test_hf_api.py [model upload] Support for organizations 2020-03-09 17:33:57 -04:00
test_hf_argparser.py Trainer (#3800) 2020-04-21 20:11:56 -04:00
test_model_card.py GPU text generation: mMoved the encoded_prompt to correct device 2020-01-06 15:11:12 +01:00
test_modeling_albert.py Added test for AlbertForTokenClassification 2020-02-27 12:24:20 +01:00
test_modeling_auto.py Add missing token classification for XLM (#3277) 2020-03-26 10:22:13 -04:00
test_modeling_bart.py Multilingual BART - (#3602) 2020-04-10 11:25:39 -04:00
test_modeling_bert.py BERT decoder: Fix causal mask dtype. 2020-02-11 15:19:22 -05:00
test_modeling_camembert.py Add camembert integration tests (#3375) 2020-03-24 10:18:37 +01:00
test_modeling_common.py [Config, Caching] Remove output_past everywhere and replace by use_cache argument (#3734) 2020-04-14 14:40:28 -04:00
test_modeling_ctrl.py test ctrl 2020-03-09 13:58:01 +00:00
test_modeling_distilbert.py GPU text generation: mMoved the encoded_prompt to correct device 2020-01-06 15:11:12 +01:00
test_modeling_electra.py ELECTRA (#3257) 2020-04-03 14:10:54 -04:00
test_modeling_flaubert.py Correct slow test 2020-02-04 18:05:35 -05:00
test_modeling_gpt2.py Clean special token init in modeling_....py (#3264) 2020-03-20 21:41:04 +01:00
test_modeling_openai.py updated all tests 2020-03-08 15:29:10 +01:00
test_modeling_roberta.py [ci] Re-run integration ground truth from fairseq 2020-03-03 15:31:40 -05:00
test_modeling_t5.py Higher tolerance for past testing in T5 (#3843) 2020-04-17 11:25:14 -04:00
test_modeling_tf_albert.py Question Answering support for Albert and Roberta in TF (#3812) 2020-04-17 10:45:30 -04:00
test_modeling_tf_auto.py Add AutoModelForPreTraining 2020-01-27 14:27:07 -05:00
test_modeling_tf_bert.py GPU text generation: mMoved the encoded_prompt to correct device 2020-01-06 15:11:12 +01:00
test_modeling_tf_camembert.py Add camembert integration tests (#3375) 2020-03-24 10:18:37 +01:00
test_modeling_tf_common.py [Config, Caching] Remove output_past everywhere and replace by use_cache argument (#3734) 2020-04-14 14:40:28 -04:00
test_modeling_tf_ctrl.py test ctrl 2020-03-09 13:58:01 +00:00
test_modeling_tf_distilbert.py Definitive HeisenDistilBug fix 2020-01-27 12:09:58 -05:00
test_modeling_tf_electra.py ELECTRA (#3257) 2020-04-03 14:10:54 -04:00
test_modeling_tf_gpt2.py [TFT5, Cache] Add cache to TFT5 (#3772) 2020-04-16 16:14:52 +02:00
test_modeling_tf_openai_gpt.py fixed all tests, still need to check ctrl tf and pt and xlm tf 2020-03-08 21:45:55 +01:00
test_modeling_tf_roberta.py Question Answering support for Albert and Roberta in TF (#3812) 2020-04-17 10:45:30 -04:00
test_modeling_tf_t5.py Higher tolerance for past testing in TF T5 (#3844) 2020-04-17 11:26:16 -04:00
test_modeling_tf_transfo_xl.py Clean special token init in modeling_....py (#3264) 2020-03-20 21:41:04 +01:00
test_modeling_tf_xlm.py fix typo in test xlm tf 2020-03-09 11:34:31 +01:00
test_modeling_tf_xlnet.py fixed all tests, still need to check ctrl tf and pt and xlm tf 2020-03-08 21:45:55 +01:00
test_modeling_transfo_xl.py Shift labels internally within TransfoXLLMHeadModel when called with labels (#3716) 2020-04-13 18:11:23 +02:00
test_modeling_xlm_roberta.py [ci] Re-run integration ground truth from fairseq 2020-03-03 15:31:40 -05:00
test_modeling_xlm.py Add missing token classification for XLM (#3277) 2020-03-26 10:22:13 -04:00
test_modeling_xlnet.py fix xlnet & transfotests 2020-03-08 16:25:03 +01:00
test_optimization_tf.py GPU text generation: mMoved the encoded_prompt to correct device 2020-01-06 15:11:12 +01:00
test_optimization.py GPU text generation: mMoved the encoded_prompt to correct device 2020-01-06 15:11:12 +01:00
test_pipelines.py Pipeline for Text Generation: GenerationPipeline (#3758) 2020-04-22 09:37:03 -04:00
test_tokenization_albert.py 💄 super 2020-01-15 18:33:50 -05:00
test_tokenization_auto.py Test correct tokenizers after default switch (#3003) 2020-02-24 18:45:53 -05:00
test_tokenization_bert_japanese.py BertJapaneseTokenizer accept options for mecab (#3566) 2020-04-03 11:12:19 -04:00
test_tokenization_bert.py Tokenizers v3.0.0 (#3185) 2020-04-07 00:29:15 +02:00
test_tokenization_common.py Update quotes 2020-04-09 09:09:00 -04:00
test_tokenization_ctrl.py 💄 super 2020-01-15 18:33:50 -05:00
test_tokenization_distilbert.py Updating the TensorFlow models to work as expected with tokenizers v3.0.0 (#3684) 2020-04-08 16:22:44 -04:00
test_tokenization_fast.py Cleanup fast tokenizers integration (#3706) 2020-04-18 13:43:57 +02:00
test_tokenization_gpt2.py Tokenizers v3.0.0 (#3185) 2020-04-07 00:29:15 +02:00
test_tokenization_openai.py 💄 super 2020-01-15 18:33:50 -05:00
test_tokenization_roberta.py Preserve spaces in GPT-2 tokenizers (#2778) 2020-02-13 13:29:43 -05:00
test_tokenization_t5.py 💄 super 2020-01-15 18:33:50 -05:00
test_tokenization_transfo_xl.py 💄 super 2020-01-15 18:33:50 -05:00
test_tokenization_utils.py GPU text generation: mMoved the encoded_prompt to correct device 2020-01-06 15:11:12 +01:00
test_tokenization_xlm_roberta.py XLM-R Tokenizer now passes common tests + Integration tests (#3198) 2020-03-18 09:52:49 -04:00
test_tokenization_xlm.py XLM tokenizer should encode with bos token (#3791) 2020-04-17 11:28:55 -04:00
test_tokenization_xlnet.py 💄 super 2020-01-15 18:33:50 -05:00
test_trainer.py Trainer (#3800) 2020-04-21 20:11:56 -04:00
utils.py TF GPU CI (#3085) 2020-03-02 15:45:25 -05:00