Home › Forums › Fórum Processamento de Linguagem Natural com BERT e Python › Treinamento do modelo de BERT com embeddings
- This topic has 3 replies, 2 voices, and was last updated 4 years, 6 months ago by
Jones Granatyr.
Viewing 4 posts - 1 through 4 (of 4 total)
- AuthorPosts
- 12 de October de 2020 at 08:23 #21467
Olá,
ao rodar o código para fazer o treinamento, obtive o erro abaixo:
if NB_CLASSES == 2: Dcnn.compile(loss='binary_crossentropy', optimizer = 'adam', metrics=['accuracy']) else: Dcnn.compile(loss='sparse_categorical_crossentropy', optimizer = 'adam', metrics=['sparse_categorical_accuracy']) checkpoint_path = '/home/danilo/Área de Trabalho/mestrado/IA/projetofinal/datasets/chkpoints' ckpt = tf.train.Checkpoint(Dcnn=Dcnn) ckpt_manager = tf.train.CheckpointManager(ckpt, checkpoint_path, max_to_keep=1) if ckpt_manager.latest_checkpoint: ckpt.restore(ckpt_manager.latest_checkpoint) print('Último checkpoint restaurado.') class MyCustomCallBack(tf.keras.callbacks.Callback): def on_epoch_end(self, epoch, logs=None): ckpt_manager.save() print(f'Checkpoint salvo em {checkpoint_path}') history = Dcnn.fit(train_dataset, epochs=NB_EPOCHS, #steps_per_epoch = 100, callbacks=[MyCustomCallBack()])
ValueError: Tensor’s shape (2, 200, 100) is not compatible with supplied shape (2, 768, 100)
12 de October de 2020 at 09:42 #21469Olá Danilo,
A mensagem de erro indica tamanhos diferentes (200 e 768). Caso esteja rodando no Colab, algo que pode acontecer é executar a mesma célula mais de uma vez e trocar o formato das variáveis. Sugiro reiniciar o ambiente e tentar executar novamente. Chegou a tentar rodar o Colab disponível no curso?
Jones
12 de October de 2020 at 13:37 #21473oi Jones,
estou rodando no notebook local. Consegui arrumar isso apagando os arquivos de checkpoint.
obrigado
12 de October de 2020 at 16:28 #21476Ah talvez tenha ficado algo na memória
- AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.