# TypeError while finetuning DialoGPT

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftypeerror-while-finetuning-dialogpt%2F8524%3E%5C
**Category:** Beginners\
**Created:** [July 20, 2021, 4:15pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftypeerror-while-finetuning-dialogpt%2F8524 "2021-07-20T16:15:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aspect11](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/aspect11/32/2338_2.png) [@Aspect11](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FAspect11)%5C
**Post date:** [July 20, 2021, 4:15pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftypeerror-while-finetuning-dialogpt%2F8524%2F1 "2021-07-20T16:15:56Z")

</div>

So I’m trying to follow an online guide and have used this notebook: [Google Colaboratory](https://colab.research.google.com/drive/1dXj-hRUqukVQsLGJiv39fv0X8oNE-cqj?usp=sharing) and here is the csv file I’m using to finetune it: [final.csv - Google Drive](https://drive.google.com/file/d/1-Ji_j5xRzg5gwP32cOQd7y0NxVrw4D09/view?usp=sharing)

However, I get this traceback when executing the training:

```auto
Traceback (most recent call last)
<ipython-input-24-523c0d2a27d3> in <module>()
----> 1 main(trn_df, val_df)

10 frames
<ipython-input-18-aa20b6fc78bc> in main(df_trn, df_val)
     61 # Training
     62 if args.do_train:
---> 63 train_dataset = load_and_cache_examples(args, tokenizer, df_trn, df_val, evaluate=False)
     64 
     65 global_step, tr_loss = train(args, train_dataset, model, tokenizer)

<ipython-input-16-67f62bb60333> in load_and_cache_examples(args, tokenizer, df_trn, df_val, evaluate)
      2 
      3 def load_and_cache_examples(args, tokenizer, df_trn, df_val, evaluate=False):
----> 4 return ConversationDataset(tokenizer, args, df_val if evaluate else df_trn)
      5 
      6 

<ipython-input-23-87cf4adc3093> in __init__ (self, tokenizer, args, df, block_size)
     29 self.examples = []
     30 for _, row in df.iterrows():
---> 31 conv = construct_conv(row, tokenizer)
     32 self.examples.append(conv)
     33 

<ipython-input-23-87cf4adc3093> in construct_conv(row, tokenizer, eos)
      6 print(row.tolist())
      7 print(type((row.tolist())))
----> 8 conv = [tokenizer.encode(x) + [tokenizer.eos_token_id] for x in row.tolist()]
      9 conv.reverse()
     10 return flatten(list(conv))

<ipython-input-23-87cf4adc3093> in <listcomp>(.0)
      6 print(row.tolist())
      7 print(type((row.tolist())))
----> 8 conv = [tokenizer.encode(x) + [tokenizer.eos_token_id] for x in row.tolist()]
      9 conv.reverse()
     10 return flatten(list(conv))

TypeError: TextEncodeInput must be Union[TextInputSequence, Tuple[InputSequence, InputSequence]]

```

Does anyone know why?
