You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I was getting a couple of errors when I tried finetuning (on CP tokens).
After running this: python3 finetune.py --task=melody --name=default --ckpt='pretrain_model.ckpt'
It trains for one epoch and then when it tries to save a checkpoint I get this error:
torch.nn.modules.module.ModuleAttributeError: 'TokenClassification' object has no attribute 'module'
I was also getting a separate error when finetuning on sequence classification tasks.
After running this: python3 finetune.py --task=composer --name=default --ckpt='pretrain_model.ckpt'
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
I was able to fix this one by changing line 92 of finetune_trainer.py to explicitly push the attention on the GPU:
attn = (y != 0).float().to(self.device)
But I can’t figure out how to fix the first error.
The text was updated successfully, but these errors were encountered:
Hi @mridenour7,
For the melody task you mentioned, I just clone the repo and run python3 finetune.py --task=melody --name=default --ckpt='pretrain_model.ckpt', it works fine here for me.
And the state_dict of saved checkpoint has keys like 'midibert.bert.embeddings.position_ids', 'midibert.in_linear.bias', 'classifier.1.weight'.
A quick fix would be to change the following line to 'state_dict': self.model.state_dict(),
But I suppose the state_dict of the saved checkpoint would have keys like 'module.midibert.bert***' then, and you'd have to be careful when loading the model for evaluation or your specific task.
Something like the following,
Hello, I was getting a couple of errors when I tried finetuning (on CP tokens).
After running this: python3 finetune.py --task=melody --name=default --ckpt='pretrain_model.ckpt'
It trains for one epoch and then when it tries to save a checkpoint I get this error:
torch.nn.modules.module.ModuleAttributeError: 'TokenClassification' object has no attribute 'module'
I was also getting a separate error when finetuning on sequence classification tasks.
After running this: python3 finetune.py --task=composer --name=default --ckpt='pretrain_model.ckpt'
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!
I was able to fix this one by changing line 92 of finetune_trainer.py to explicitly push the attention on the GPU:
attn = (y != 0).float().to(self.device)
But I can’t figure out how to fix the first error.
The text was updated successfully, but these errors were encountered: