Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transformer can not be trained on a new dataset! #27

Open
CeMarzie opened this issue Oct 16, 2022 · 2 comments
Open

Transformer can not be trained on a new dataset! #27

CeMarzie opened this issue Oct 16, 2022 · 2 comments

Comments

@CeMarzie
Copy link

Traceback (most recent call last):
File "/MWPToolkit/run_mwptoolkit.py", line 26, in
run_toolkit(args.model, args.dataset, args.task_type, config_dict)
File "/MWPToolkit/mwptoolkit/quick_start.py", line 215, in run_toolkit
train_with_train_valid_test_split(config)
File "/MWPToolkit/mwptoolkit/quick_start.py", line 103, in train_with_train_valid_test_split
trainer.fit()
File "/MWPToolkit/mwptoolkit/trainer/supervised_trainer.py", line 217, in fit
valid_equ_ac, valid_val_ac, valid_total, valid_time_cost = self.evaluate(DatasetType.Valid)
File "/MWPToolkit/mwptoolkit/trainer/supervised_trainer.py", line 271, in evaluate
batch_val_ac, batch_equ_ac = self._eval_batch(batch)
File "/MWPToolkit/mwptoolkit/trainer/supervised_trainer.py", line 148, in _eval_batch
test_out, target = self.model.model_test(batch)
File "/MWPToolkit/mwptoolkit/model/Seq2Seq/transformer.py", line 154, in model_test
_, symbol_outputs, _ = self.forward(src)
File "/MWPToolkit/mwptoolkit/model/Seq2Seq/transformer.py", line 100, in forward
source_embeddings = self.in_embedder(src).to(self.device) + self.pos_embedder(src).to(self.device)
File "/root/anaconda3/envs/toolkit/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/MWPToolkit/mwptoolkit/module/Embedder/basic_embedder.py", line 32, in forward
embedding_output = self.embedder(input_seq)
File "/root/anaconda3/envs/toolkit/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
File "/root/anaconda3/envs/toolkit/lib/python3.10/site-packages/torch/nn/modules/sparse.py", line 158, in forward
return F.embedding(
File "/root/anaconda3/envs/toolkit/lib/python3.10/site-packages/torch/nn/functional.py", line 2199, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu! (when checking argument for argument index in method wrapper__index_select)

@CeMarzie
Copy link
Author

I appreciate your help in advance.

@LYH-YF
Copy link
Owner

LYH-YF commented Oct 18, 2022

is it the newest version? @CeMarzie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants