Oh yeah I had that problem too. A solution is to use ast.literal_eval. It let’s you turn strings into their appropriate Python objects.
See also my notebook here, where I used it to turn strings into tuples before fine-tuning TAPAS on SQA: Transformers-Tutorials/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb at master · NielsRogge/Transformers-Tutorials · GitHub 25