Git Product home page Git Product logo

Comments (4)

Wann-Jiun avatar Wann-Jiun commented on August 20, 2024 18

It's a nice work+1
Just changed "loss.data[0]" to "loss.item()" in baselinetrain.py and it seems to work fine. I am using 1.0.1.post2 (pytorch version).

from closerlookfewshot.

apple2373 avatar apple2373 commented on August 20, 2024 2

I'm got the following error with 1.0.1.post2.

Traceback (most recent call last):
File "./train.py", line 177, in
model = train(base_loader, val_loader, model, optimization, start_epoch, stop_epoch, params)
File "./train.py", line 32, in train
model.train_loop(epoch, base_loader, optimizer ) #model are called by reference, no need to return
File "/nfs/tynamo/home/data/vision7/stsutsui/public_repos/CloserLookFewShot/methods/baselinetrain.py", line 44, in train_loop
avg_loss = avg_loss+loss.data[0]
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

Well, I was so lazy to fix "loss.dada[0]" to "loss.item()" by myself, and didn't want to change the code without the author's confirmation so I installed 0.3.1 using the following command, then it worked.

conda install pytorch==0.3.1 torchvision -c pytorch

from closerlookfewshot.

wyharveychen avatar wyharveychen commented on August 20, 2024

Hello,
My Pytorch version is 0.3.1, but I have also tested on 1.0 and it works.
What does your error message say?

from closerlookfewshot.

russell0 avatar russell0 commented on August 20, 2024

It's a nice work+1
Just changed "loss.dada[0]" to "loss.item()" in baselinetrain.py and it seems to work fine. I am using 1.0.1.post2 (pytorch version).

well... at least dada -> data.

from closerlookfewshot.

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.