TensorBoard with BERT

I am trying to use add_graph method of tensorboard to display my bert layers in a graphical manner. However, I am getting the folowing error when i am trying to do that :

'NoneType' object is not iterable

My statement goes like :

writer = SummaryWriter()
model = XLMRobertaModel.from_pretrained(config.BASE_MODEL,output_attentions = False, output_hidden_states = False)
writer.add_graph(model)
writer.close()

Can anyone tell if i am missing anything ? The model is already a nn.Module .

I guess the error is raised as input_to_model is set to Noneby default and might be expected to create the graph.
Try to provide a model input and see if this solves the error.

1 Like