Passing a custom stopping_criteria list to model.generate() yields a multiple value error for that keyword arg
---
name: "\U0001F41B Bug Report"
about: Submit a bug report to help us improve transformers
title: ''
labels: ''
assignees: ''

---


## Environment info
<!-- You can run the command `transformers-cli env` and copy-and-paste its output below.
     Don't forget to fill out the missing fields in that output! -->

- `transformers` version: 4.6.1
- Platform: macOS-10.15.5-x86_64-i386-64bit
- Python version: 3.8.8
- PyTorch version (GPU?): 1.18.1 (no)
- Tensorflow version (GPU?): N/A
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: no

### Who can help
<!-- Your issue will be replied to more quickly if you can figure out the right person to tag with @
 If you know how to use git blame, that is the easiest way, otherwise, here is a rough guide of **who to tag**.
 Please tag fewer than 3 people.

Models:

- albert, bert, xlm: @LysandreJik
- blenderbot, bart, marian, pegasus, encoderdecoder,  t5: @patrickvonplaten, @patil-suraj
- longformer, reformer, transfoxl, xlnet: @patrickvonplaten
- fsmt: @stas00
- funnel: @sgugger
- gpt2: @patrickvonplaten, @LysandreJik
- rag: @patrickvonplaten, @lhoestq
- tensorflow: @Rocketknight1

Library:

- benchmarks: @patrickvonplaten
- deepspeed: @stas00
- ray/raytune: @richardliaw, @amogkam
- text generation: @patrickvonplaten
- tokenizers: @LysandreJik
- trainer: @sgugger
- pipelines: @LysandreJik

Documentation: @sgugger

Model hub:

- for issues with a model report at https://discuss.huggingface.co/ and tag the model's creator.

HF projects:

- datasets: [different repo](https://github.com/huggingface/datasets)
- rust tokenizers: [different repo](https://github.com/huggingface/tokenizers)

Examples:

- maintained examples (not research project or legacy): @sgugger, @patil-suraj
- research_projects/bert-loses-patience: @JetRunner
- research_projects/distillation: @VictorSanh

 -->

- set model_kwargs programmatically: @patrickvonplaten
- set stopping_criteria programmatically: @Narsil

## Information

Model I am using (Bert, XLNet ...): GPT2DoubleHeadsModel (pretrained model: distilgpt2)

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [x] my own modified scripts: (give details below): Any script I write that passes a custom StoppingCriteriaList via the stopping_criteria keyword arg of generation_utils.GenerationMixin.generate() seems to reproduce this issue.

The tasks I am working on is:
* [ ] an official GLUE/SQUaD task: (give the name)
* [x] my own task or dataset: (give details below): a simple personal chatbot harness with a custom newline stopping criterion

## To reproduce

Steps to reproduce the behavior:

1. Load a trained model using transformer.generation_utils.GenerationMixin
2. Define a custom StoppingCriteria and StoppingCriteriaList
3. Pass the custom StoppingCriteriaList as a keyword arg to model.generate(), e.g. model.generate(...stopping_criteria=my_custom_list...)

The above steps will yield a "got multiple values for keyword argument 'stopping_criteria'" error message.

<!-- If you have code snippets, error messages, stack traces please provide them here as well.
     Important! Use code tags to correctly format your code. See https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks#syntax-highlighting
     Do not use screenshots, as they are hard to read and (more importantly) don't allow others to copy-and-paste your code.-->

## Expected behavior

<!-- A clear and concise description of what you would expect to happen. -->

Ideally, there would be no error message, and the stopping_criteria kwarg would be passed through normally.