DNABERT_2 icon indicating copy to clipboard operation
DNABERT_2 copied to clipboard

RuntimeError with Shared Tensors in DNABERT-2-117M Configuration Using run_mlm.py

Open RobinLi7 opened this issue 1 year ago • 3 comments

RuntimeError: The weights trying to be saved contained shared tensors [{'cls.predictions.decoder.weight', 'bert.embeddings.word_embeddings.weight'}] that are mismatching the transformers base configuration. Try saving using safe_serialization=False or remove this tensor sharing.

When I run run_mlm.py, the following error occurs during train_result = trainer.train(resume_from_checkpoint=checkpoint): I’m using the configuration zhihan1996/DNABERT-2-117M and the BertForMaskedLM model from bert_layers.py.

RobinLi7 avatar Dec 22 '24 06:12 RobinLi7

Did you ever figure this out? I'm running into the same issue.

mrevsine avatar Jan 30 '25 21:01 mrevsine

I'm also hitting the same error. Anyone find a solution?

dmacguigan avatar Aug 13 '25 13:08 dmacguigan

I seem to have found a workaround by including the --save_safetensors False argument for the run_mlm-mod.py script

dmacguigan avatar Aug 13 '25 14:08 dmacguigan