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

getting-started.py failed! #13

Closed
feifeibear opened this issue Dec 6, 2021 · 2 comments
Closed

getting-started.py failed! #13

feifeibear opened this issue Dec 6, 2021 · 2 comments

Comments

@feifeibear
Copy link

feifeibear commented Dec 6, 2021

I run the following code and set the input batch size as 20. (pytorch 1.10.0)
python example/getting-started.py
The errros.
Traceback (most recent call last):
File "/home/user/codes/koila/examples/getting-started.py", line 97, in
lazy_loss.backward()
File "/home/user/anaconda3/envs/torch/lib/python3.9/site-packages/koila/tensors.py", line 439, in backward
mini_batch = self.run((total, total + mini_batch_size))
File "/home/user/anaconda3/envs/torch/lib/python3.9/site-packages/koila/tensors.py", line 187, in run
return data.run(partial)
File "/home/user/anaconda3/envs/torch/lib/python3.9/site-packages/koila/tensors.py", line 94, in _run
result = self.func(*real_args, **real_kwargs)
File "/home/user/anaconda3/envs/torch/lib/python3.9/site-packages/torch/nn/functional.py", line 2846, in cross_entropy
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)
ValueError: Expected input batch_size (16) to match target batch_size (20).

@feifeibear
Copy link
Author

See this MR for more information #14

@rentruewang
Copy link
Owner

Hi, thanks for taking the time to fix it!

Iit seems like I haven't tested cross entropy losses thoroughly enough.

However, by commenting out that line in your MR #14, you simply tell the toolkit to ignore this type of loss, which isn't the goal here. It seems the issue here is that I've forgotten to update getting-started.py after I've updated the API.

Really appreciate your effort, but apologies that I can't merge #14 .

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