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

Code Error for Training (Stage 1) #31

Closed
BehzadBozorgtabar opened this issue Aug 18, 2019 · 2 comments
Closed

Code Error for Training (Stage 1) #31

BehzadBozorgtabar opened this issue Aug 18, 2019 · 2 comments

Comments

@BehzadBozorgtabar
Copy link

Hello,
When I run python main.py --config ./config/ImageNet_LT/stage_1.py, there is an error.

Loading Dot Product Classifier.
Traceback (most recent call last):
File "/media/Elements/OLTR/OpenLongTailRecognition-OLTR/main.py", line 55, in
training_model = model(config, data, test=False)
File "/media/Elements/OLTR/OpenLongTailRecognition-OLTR/run_networks.py", line 26, in init
self.init_models()
File "/media/Elements/OLTR/OpenLongTailRecognition-OLTR/run_networks.py", line 69, in init_models
self.networks[key] = source_import(def_file).create_model(*model_args)
File "./models/DotProductClassifier.py", line 16, in create_model
clf = DotProduct_Classifier(num_classes, feat_dim)
File "./models/DotProductClassifier.py", line 8, in init
self.fc = nn.Linear(feat_dim, num_classes)
File "/home/.local/lib/python3.5/site-packages/torch/nn/modules/linear.py", line 81, in init
self.reset_parameters()
File "/home/.local/lib/python3.5/site-packages/torch/nn/modules/linear.py", line 84, in reset_parameters
init.kaiming_uniform_(self.weight, a=math.sqrt(5))
File "/home/.local/lib/python3.5/site-packages/torch/nn/init.py", line 325, in kaiming_uniform_
std = gain / math.sqrt(fan)
ZeroDivisionError: float division by zero

Could you give some advice to solve this problem?

@zhmiao
Copy link
Owner

zhmiao commented Aug 26, 2019

Hello @BehzadBozorgtabar , thanks for asking. Could you please print out feat_dim and num_classes in this case? We are not able to reproduce this error, but suspecting there might be some problem of reading the parameters. Maybe because of the versions of python, reading configuration numbers from files can have some order issue. Thanks again.

@zhmiao zhmiao closed this as completed Dec 19, 2019
@iwzy7071
Copy link

I've met the same error.
net = GraphSAGE(dataset.num_features, dataset.num_classes)
where dataset.num_features equals zero, the problem happens

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

3 participants