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
I think it's due to the DataLoader object, which seems to be instantiated, but empty.
Have you set the correct path for your own environment and downloaded the data correctly in advance?
PATH_TO_ESC50 = Path.cwd() / 'esc50' # you might have to adjust this line, if your image directory is not '.../current_working_dir/esc50/'
train_esc50 = ESC50(PATH_TO_ESC50 / "train")
train_loader = torch.utils.data.DataLoader(train_esc50, batch_size = bs, shuffle = True)
Hi,
That is so funny. I was doing that:
print(PATH_TO_ESC50)
print(train_esc50)
delivers
C:\Users\patri\Deep_Learning\I_pytorch_deep_learning\chapter6\esc50\audio
<main.ESC50 object at 0x000002820FBEFC10>
I took the original file and adaped the path an now it is running.
Hi,
I do not find the solution, why len(train_loader.dataset) is 0 and leads to this error.
Thank you for help.
Brds,
Patrick
[9] train(audionet, optimizer, torch.nn.CrossEntropyLoss(), train_loader, valid_loader, epochs=20, device=device)
ZeroDivisionError Traceback (most recent call last)
in
----> 1 train(audionet, optimizer, torch.nn.CrossEntropyLoss(), train_loader, valid_loader, epochs=20, device=device)
in train(model, optimizer, loss_fn, train_loader, val_loader, epochs, device)
14 optimizer.step()
15 training_loss += loss.data.item() * inputs.size(0)
---> 16 training_loss /= len(train_loader.dataset)
17
18 model.eval()
ZeroDivisionError: float division by zero
The text was updated successfully, but these errors were encountered: