Giter VIP home page Giter VIP logo

Comments (4)

summmeer avatar summmeer commented on June 21, 2024

Usually the code won't get NaN, but it's ok to add this line.

from diffuseq.

zkzhou126 avatar zkzhou126 commented on June 21, 2024

Hello!I met the same error, and I use your method. But It makes the sum of p is not 1, there is another error, because of np.random.choice . so I change the code to:

        p = w / np.sum(w)
        if np.sum(np.isnan(p)) > 0:
            p[np.isnan(p)] = 0
            p = p / np.sum(p)
        indices_np = np.random.choice(len(p), size=(batch_size,), p=p)
        indices = th.from_numpy(indices_np).long().to(device)

But I got the NAN error again.
image

This is my train.sh, I just use my dataset and change the dim
image
Hope you can give me some advice

from diffuseq.

xiaotingxuan avatar xiaotingxuan commented on June 21, 2024

Hello, I also meet Nan error when using my own dataset.
One advice is to set you batch size smaller, I set --bsz 64.(It works for me)
Another advice is to change the code,

        if hasNan:
            print("has Nan prob p=",p)
            size = len(p)
            p = np.ones(p.shape) * (1/size)
            print("new p =",p)

from diffuseq.

zkzhou126 avatar zkzhou126 commented on June 21, 2024

Ok, I'll try your method, thank you!!!!

commented

from diffuseq.

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.