Code Monkey home page Code Monkey logo

Comments (7)

Luodian avatar Luodian commented on May 22, 2024 1

Yep, and I also found an issue when using cosine projector.

It seems that in cosine_top.py line 31, there should be an .cuda() or .to(device) flag to make sure the tensor in same device.

logit_scale = torch.clamp(self.temperature, max=torch.log(torch.tensor(1. / 0.01)).cuda()).exp()

from tutel.

ghostplant avatar ghostplant commented on May 22, 2024

@zeliu98

from tutel.

Luodian avatar Luodian commented on May 22, 2024

Hi I think this happens because the default gate_noise value in load_importance_loss is 0.0.

And if we do

normal = Normal(0, 0.0)

it's weird, why we have a normal distribution with zero variance? and it returns

*** ValueError: Expected parameter scale (Tensor of shape ()) of distribution Normal(loc: 0.0, scale: 0.0) to satisfy the constraint GreaterThan(lower_bound=0.0), but found invalid values:
0.0

from tutel.

Luodian avatar Luodian commented on May 22, 2024

If I preset gate_noise to 1.0, I think the code run without problems but I am not sure if it's numerically correct?

gate_type={'type': 'top', 'k': 2, 'fp32_gate': False, 'gate_noise': 1.0, },

from tutel.

zeliu98 avatar zeliu98 commented on May 22, 2024

Hi @Luodian, yes, you need to set gate_noise>0 for load_importance_loss. You can find the reasons in APPENDICES A: LOAD-BALANCING LOSS in the original paper (https://arxiv.org/pdf/1701.06538.pdf).

from tutel.

ghostplant avatar ghostplant commented on May 22, 2024

@zeliu98 We need to add assertion reason to avoid unknowns error like this.

And thanks for your information! @Luodian

from tutel.

ghostplant avatar ghostplant commented on May 22, 2024

We have added gate_noise assertion and device cast in latest commit. Thanks for pointing out this bug.

from tutel.

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.