-
Notifications
You must be signed in to change notification settings - Fork 223
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
tensor for argument #1 #30
Comments
need to change |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
RuntimeError Traceback (most recent call last)
in
21 args.weight_decay,
22 args.device,
---> 23 args.save_dir)
in main(dataset_name, dataset_path, model_name, epoch, learning_rate, batch_size, weight_decay, device, save_dir)
23 early_stopper = EarlyStopper(num_trials=2, save_path=f'{save_dir}/{model_name}.pt')
24 for epoch_i in range(epoch):
---> 25 train(model, optimizer, train_data_loader, criterion, device)
26 auc = test(model, valid_data_loader, device)
27 print('epoch:', epoch_i, 'validation: auc:', auc)
in train(model, optimizer, data_loader, criterion, device, log_interval)
5 for i, (fields, target) in enumerate(tk0):
6 fields, target = fields.to(device), target.to(device)
----> 7 y = model(fields)
8 loss = criterion(y, target.float())
9 model.zero_grad()
H:\Anaconda\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, *input, **kwargs)
720 result = self._slow_forward(*input, **kwargs)
721 else:
--> 722 result = self.forward(*input, **kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),
~\Desktop\量化炒股\pytorch-fm-master\torchfm\model\fm.py in forward(self, x)
22 :param x: Long tensor of size
(batch_size, num_fields)
23 """
---> 24 x = self.linear(x) + self.fm(self.embedding(x))
25 return torch.sigmoid(x.squeeze(1))
H:\Anaconda\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, *input, **kwargs)
720 result = self._slow_forward(*input, **kwargs)
721 else:
--> 722 result = self.forward(*input, **kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),
~\Desktop\量化炒股\pytorch-fm-master\torchfm\layer.py in forward(self, x)
17 """
18 x = x + x.new_tensor(self.offsets).unsqueeze(0)
---> 19 return torch.sum(self.fc(x), dim=1) + self.bias
20
21
H:\Anaconda\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, *input, **kwargs)
720 result = self._slow_forward(*input, **kwargs)
721 else:
--> 722 result = self.forward(*input, **kwargs)
723 for hook in itertools.chain(
724 _global_forward_hooks.values(),
H:\Anaconda\lib\site-packages\torch\nn\modules\sparse.py in forward(self, input)
124 return F.embedding(
125 input, self.weight, self.padding_idx, self.max_norm,
--> 126 self.norm_type, self.scale_grad_by_freq, self.sparse)
127
128 def extra_repr(self) -> str:
H:\Anaconda\lib\site-packages\torch\nn\functional.py in embedding(input, weight, padding_idx, max_norm, norm_type, scale_grad_by_freq, sparse)
1812 # remove once script supports set_grad_enabled
1813 no_grad_embedding_renorm(weight, input, max_norm, norm_type)
-> 1814 return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
1815
1816
RuntimeError: Expected tensor for argument #1 'indices' to have scalar type Long; but got torch.IntTensor instead (while checking arguments for embedding)
The text was updated successfully, but these errors were encountered: