<blockquote>
<p dir="auto">For translation and summarization training, decoder_input_ids should be provided. If no decoder_input_ids is provided, the model will create this tensor by shifting the input_ids to the right for denoising pre-training following the paper.<br>
<a href="https://huggingface.co/docs/transformers/v4.16.2/en/model_doc/bart#transformers.BartForConditionalGeneration.forward.decoder_input_ids" rel="nofollow">https://huggingface.co/docs/transformers/v4.16.2/en/model_doc/bart#transformers.BartForConditionalGeneration.forward.decoder_input_ids</a></p>
</blockquote>
<p dir="auto">This is inappropriate. If <code class="notranslate">labels</code> is provided, the model will create this tensor by shifting the <code class="notranslate">labels</code>:<br>
</p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/huggingface/transformers/blob/db7d6a80e82d66127b2a44b6e3382969fdc8b207/src/transformers/models/bart/modeling_bart.py#L1320-L1324">transformers/src/transformers/models/bart/modeling_bart.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 1320 to 1324
      in
      <a data-pjax="true" class="commit-tease-sha" href="/huggingface/transformers/commit/db7d6a80e82d66127b2a44b6e3382969fdc8b207">db7d6a8</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L1320" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1320"></td>
          <td id="LC1320" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">if</span> <span class="pl-s1">labels</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-c1">None</span>: </td>
        </tr>

        <tr class="border-0">
          <td id="L1321" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1321"></td>
          <td id="LC1321" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">     <span class="pl-k">if</span> <span class="pl-s1">decoder_input_ids</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span> <span class="pl-c1">and</span> <span class="pl-s1">decoder_inputs_embeds</span> <span class="pl-c1">is</span> <span class="pl-c1">None</span>: </td>
        </tr>

        <tr class="border-0">
          <td id="L1322" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1322"></td>
          <td id="LC1322" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         <span class="pl-s1">decoder_input_ids</span> <span class="pl-c1">=</span> <span class="pl-en">shift_tokens_right</span>( </td>
        </tr>

        <tr class="border-0">
          <td id="L1323" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1323"></td>
          <td id="LC1323" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">             <span class="pl-s1">labels</span>, <span class="pl-s1">self</span>.<span class="pl-s1">config</span>.<span class="pl-s1">pad_token_id</span>, <span class="pl-s1">self</span>.<span class="pl-s1">config</span>.<span class="pl-s1">decoder_start_token_id</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L1324" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="1324"></td>
          <td id="LC1324" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">         ) </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">Here<br>
<a href="https://huggingface.co/transformers/model_doc/bart.html" rel="nofollow">https://huggingface.co/transformers/model_doc/bart.html</a></p>
<p dir="auto">It says that for both BartForConditionalGeneration and BartModel, decoder_input_ids will be generated by shifting input_ids if not given.</p>
<p dir="auto">However, from the source codes, forward function of BartForConditionalGeneration has these lines:</p>
<p dir="auto">if labels is not None:<br>
if decoder_input_ids is None and decoder_inputs_embeds is None:<br>
decoder_input_ids = shift_tokens_right(<br>
labels, self.config.pad_token_id, self.config.decoder_start_token_id<br>
)</p>
<p dir="auto">which suggests it is shifted from labels, instead of input_ids.</p>
<p dir="auto">Can someone confirm what is the decoder_input_ids and labels for text summarization for</p>
<ol dir="auto">
<li>
<p dir="auto">training</p>
</li>
<li>
<p dir="auto">generation</p>
</li>
</ol>
<p dir="auto">Thanks.</p>