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
for _ in train_iterator:
local_steps = 0 # update step
tr_loss = 0.0
epoch_iterator = tqdm(train_dataloader, desc="Iteration", disable=False)
step = 0 # backward step
total_log_loss = 0
model.train()
for step, batch in enumerate(epoch_iterator):
batch=batch.to(args.device)
-------> loss = model(batch)
step += 1
# loss=model(batch)
total_log_loss += loss.mean().item()
if args.gradient_accumulation_steps > 1:
loss = loss / args.gradient_accumulation_steps
loss.mean().backward()
tr_loss += loss.mean().item()
bug-detail:
File "prompt.py", line 9, in
main.main()
File "/home/jnu/zf/dstc11-track5/prompt/main.py", line 573, in main
loss = model(batch)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 171, in forward
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 181, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 89, in parallel_apply
output.reraise()
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/_utils.py", line 644, in reraise
raise exception
TypeError: Caught TypeError in replica 0 on device 0.
Original Traceback (most recent call last):
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 64, in _worker
output = module(*input, **kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/openprompt/pipeline_base.py", line 449, in forward
return self._forward(*args, **kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/openprompt/pipeline_base.py", line 465, in _forward
outputs = self.prompt_model(batch)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/openprompt/pipeline_base.py", line 210, in forward
batch = self.template.process_batch(batch)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/openprompt/prompts/soft_template.py", line 94, in process_batch
inputs_embeds = self.raw_embedding(batch['input_ids'])
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/modules/sparse.py", line 162, in forward
return F.embedding(
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/functional.py", line 2210, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
TypeError: embedding(): argument 'indices' (position 2) must be Tensor, not tuple
how to solve it thanks
The text was updated successfully, but these errors were encountered:
File "prompt.py", line 9, in
main.main()
File "/home/jnu/zf/dstc11-track5/prompt/main.py", line 573, in main
loss = model(batch)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 171, in forward
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 181, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 89, in parallel_apply
output.reraise()
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/_utils.py", line 644, in reraise
raise exception
TypeError: Caught TypeError in replica 0 on device 0.
Original Traceback (most recent call last):
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/parallel/parallel_apply.py", line 64, in _worker
output = module(*input, **kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/openprompt/pipeline_base.py", line 449, in forward
return self._forward(*args, **kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/openprompt/pipeline_base.py", line 465, in _forward
outputs = self.prompt_model(batch)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/openprompt/pipeline_base.py", line 210, in forward
batch = self.template.process_batch(batch)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/openprompt/prompts/soft_template.py", line 94, in process_batch
inputs_embeds = self.raw_embedding(batch['input_ids'])
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/modules/sparse.py", line 162, in forward
return F.embedding(
File "/home/jnu/anaconda3/envs/zf/lib/python3.8/site-packages/torch/nn/functional.py", line 2210, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
TypeError: embedding(): argument 'indices' (position 2) must be Tensor, not tuple
how to solve it thanks
The text was updated successfully, but these errors were encountered: