Git Product home page Git Product logo

Comments (5)

wuzhiyang2016 avatar wuzhiyang2016 commented on August 29, 2024 28

你是不是没显卡。。。

from pytorch-pruning.

oscarriddle avatar oscarriddle commented on August 29, 2024 1

Someones say that is because the number of output nodes of my model was not equal to the number of labels of the data.
reference0
reference1

from pytorch-pruning.

oscarriddle avatar oscarriddle commented on August 29, 2024 1

Solved. Need to rearrange the training dataset.

from pytorch-pruning.

chiba1sonny avatar chiba1sonny commented on August 29, 2024 1

Hey, I have got the same error. Could you teach me how to rearrange the training dataset?

from pytorch-pruning.

oscarriddle avatar oscarriddle commented on August 29, 2024

After setting the operations and model to .cpu()
I got below error:

$ python finetune_cpu.py --train --train_path=. --test_path=.
True
/home/web_server/dlpy72/dlpy/lib/python2.7/site-packages/torchvision/transforms/transforms.py:188: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead.
  "please use transforms.Resize instead.")
/home/web_server/dlpy72/dlpy/lib/python2.7/site-packages/torchvision/transforms/transforms.py:563: UserWarning: The use of the transforms.RandomSizedCrop transform is deprecated, please use transforms.RandomResizedCrop instead.
  "please use transforms.RandomResizedCrop instead.")
train data loading finished
start train
training
Epoch:  0
Traceback (most recent call last):
  File "finetune_cpu.py", line 269, in <module>
    fine_tuner.train(epoches = 20)
  File "finetune_cpu.py", line 163, in train
    self.train_epoch(optimizer)
  File "finetune_cpu.py", line 181, in train_epoch
    self.train_batch(optimizer, batch.cpu(), label.cpu(), rank_filters)
  File "finetune_cpu.py", line 176, in train_batch
    self.criterion(self.model(input), Variable(label)).backward()
  File "/home/web_server/dlpy72/dlpy/lib/python2.7/site-packages/torch/nn/modules/module.py", line 491, in __call__
    result = self.forward(*input, **kwargs)
  File "/home/web_server/dlpy72/dlpy/lib/python2.7/site-packages/torch/nn/modules/loss.py", line 759, in forward
    self.ignore_index, self.reduce)
  File "/home/web_server/dlpy72/dlpy/lib/python2.7/site-packages/torch/nn/functional.py", line 1442, in cross_entropy
    return nll_loss(log_softmax(input, 1), target, weight, size_average, ignore_index, reduce)
  File "/home/web_server/dlpy72/dlpy/lib/python2.7/site-packages/torch/nn/functional.py", line 1332, in nll_loss
    return torch._C._nn.nll_loss(input, target, weight, size_average, ignore_index, reduce)
RuntimeError: Assertion `cur_target >= 0 && cur_target < n_classes' failed.  at /pytorch/aten/src/THNN/generic/ClassNLLCriterion.c:97

from pytorch-pruning.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.