Can `BartForConditionalGeneration` use the `sample()` method ?
Hi .

I have a question about `BartForConditionalGeneration`. I wonder if the `BartForConditionalGeneration` can use the `sample()` method in the `generation_utils.py`?  The Code is:
```python
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
from transformers import (
   LogitsProcessorList,
   MinLengthLogitsProcessor,
    TopKLogitsWarper,
   TemperatureLogitsWarper,
)
tokenizer = AutoTokenizer.from_pretrained('facebook/bart-base')
model = AutoModelForSeq2SeqLM.from_pretrained('facebook/bart-base')

input_prompt = "Today is a beautiful day, and"
input_ids = tokenizer(input_prompt, return_tensors="pt").input_ids

logits_processor = LogitsProcessorList([
    MinLengthLogitsProcessor(15, eos_token_id=model.config.eos_token_id),
])

logits_warper = LogitsProcessorList([
    TopKLogitsWarper(50),
    TemperatureLogitsWarper(0.7),
])

outputs = model.sample(input_ids=test_input_ids, logits_processor=logits_processor, logits_warper=logits_warper)
print('Generated:', tokenizer.batch_decode(outputs, skip_special_tokens=True))
```
and get:

```python
ValueError                                Traceback (most recent call last)
<ipython-input-26-6384a499566d> in <module>
      1 print(input_ids)
----> 2 outputs = model.sample(input_ids=test_input_ids, logits_processor=logits_processor, logits_warper=logits_warper)
      3 print('Generated:', tokenizer.batch_decode(outputs, skip_special_tokens=True))

/data/yuf/transformers/src/transformers/generation_utils.py in sample(self, input_ids, logits_processor, stopping_criteria, logits_warper, max_length, pad_token_id, eos_token_id, output_attentions, output_hidden_states, output_scores, return_dict_in_generate, synced_gpus, **model_kwargs)
   1533                 return_dict=True,
   1534                 output_attentions=output_attentions,
-> 1535                 output_hidden_states=output_hidden_states,
   1536             )
   1537 

~/anaconda3/envs/irl/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
    887             result = self._slow_forward(*input, **kwargs)
    888         else:
--> 889             result = self.forward(*input, **kwargs)
    890         for hook in itertools.chain(
    891                 _global_forward_hooks.values(),

/data/yuf/transformers/src/transformers/models/bart/modeling_bart.py in forward(self, input_ids, attention_mask, decoder_input_ids, decoder_attention_mask, head_mask, decoder_head_mask, cross_attn_head_mask, encoder_outputs, past_key_values, inputs_embeds, decoder_inputs_embeds, labels, use_cache, output_attentions, output_hidden_states, return_dict)
   1306             output_attentions=output_attentions,
   1307             output_hidden_states=output_hidden_states,
-> 1308             return_dict=return_dict,
   1309         )
   1310         lm_logits = self.lm_head(outputs[0]) + self.final_logits_bias

~/anaconda3/envs/irl/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
    887             result = self._slow_forward(*input, **kwargs)
    888         else:
--> 889             result = self.forward(*input, **kwargs)
    890         for hook in itertools.chain(
    891                 _global_forward_hooks.values(),

/data/yuf/transformers/src/transformers/models/bart/modeling_bart.py in forward(self, input_ids, attention_mask, decoder_input_ids, decoder_attention_mask, head_mask, decoder_head_mask, cross_attn_head_mask, encoder_outputs, past_key_values, inputs_embeds, decoder_inputs_embeds, use_cache, output_attentions, output_hidden_states, return_dict)
   1171                 output_attentions=output_attentions,
   1172                 output_hidden_states=output_hidden_states,
-> 1173                 return_dict=return_dict,
   1174             )
   1175         # If the user passed a tuple for encoder_outputs, we wrap it in a BaseModelOutput when return_dict=True

~/anaconda3/envs/irl/lib/python3.7/site-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
    887             result = self._slow_forward(*input, **kwargs)
    888         else:
--> 889             result = self.forward(*input, **kwargs)
    890         for hook in itertools.chain(
    891                 _global_forward_hooks.values(),

/data/yuf/transformers/src/transformers/models/bart/modeling_bart.py in forward(self, input_ids, attention_mask, head_mask, inputs_embeds, output_attentions, output_hidden_states, return_dict)
    751             input_shape = inputs_embeds.size()[:-1]
    752         else:
--> 753             raise ValueError("You have to specify either input_ids or inputs_embeds")
    754 
    755         if inputs_embeds is None:

ValueError: You have to specify either input_ids or inputs_embeds
```

To implement the REINFORCE algorithm on summarization, it might be a good way to use the `sample()` method and get the output `score`. But it cannot work well.  
I guess it might because of the `prepare_inputs_for_generation` in the `BartForConditionalGeneration`. In the Line 1528 of  `sample()` method , it call the `prepare_inputs_for_generation` function and only give the `input_ids`, but for `BartForConditionalGeneration`, it might  use the `input_ids` as the `decoder_input_ids`, and set the `encoder_outputs` None.  
I try to find an example about REINFORCE algorithms in the repository, but failed. Could you please give me an example? 

@patrickvonplaten
Hey @FYYFU,

Yes `BartForConditionalGeneration` can use `sample(...)`. Could you please make use of the forum: https://discuss.huggingface.co/ for questions on how to use it?<|||||>Thank you!<|||||>> Hey @FYYFU,
> 
> Yes `BartForConditionalGeneration` can use `sample(...)`. Could you please make use of the forum: https://discuss.huggingface.co/ for questions on how to use it?

ok.. Thanks for you reply! :>