Code Monkey home page Code Monkey logo

Comments (10)

arrufat avatar arrufat commented on September 25, 2024 1

Yes, I will try to figure out. I will check what test the test_layer is doing to see why is not passing... The CPU version passes, but not the GPU version. But then when the test for equality in CPU and GPU passes, too, which is really odd.
Maybe rewriting the whole thing from scratch is easier than trying to figure out the typo, haha.

from dlib.

davisking avatar davisking commented on September 25, 2024

Yeah I noticed this a bit ago but didn't figure it out when I looked. Need to look again though and figure it out. Although maybe you will figure it out first :) Must just be some subtle typo somewhere.

from dlib.

davisking avatar davisking commented on September 25, 2024

Yeah hard to say, bugs can be anywhere and you never know until after the fact 🤷 :D

from dlib.

arrufat avatar arrufat commented on September 25, 2024

It's really weird. If I change this line:

resizable_tensor x(2, 3, 4, 5);

to the size that test_layer tests

resizable_tensor x(4, 2, 2, 4);

Then, this one fails: the values are entirely different. But with the previous size, the values are the same.

DLIB_TEST(max(abs(mat(gamma_grad_cpu) - mat(gamma_grad_cuda))) < 1e-5);

from dlib.

arrufat avatar arrufat commented on September 25, 2024

I will tackle this again at some point. Sometimes, when things like this happen and I have absolutely no idea why, I question myself a lot...

from dlib.

davisking avatar davisking commented on September 25, 2024

Na everyone thinks that from time to time. Don't sweat it :)

from dlib.

pfeatherstone avatar pfeatherstone commented on September 25, 2024

I could be naive here, is there a reason why Layernorm isn't using CUDNN ?
Will cudnnNormalizationForwardInference, cudnnNormalizationForwardTraining and cudnnNormalizationBackward work ?
It looks like those functions can be used for batchnorm, layernorm and groupnorm.

from dlib.

arrufat avatar arrufat commented on September 25, 2024

Oh, I wasn't aware it was possible to do Layer Normalization with cuDNN.
This link says that: https://docs.nvidia.com/deeplearning/cudnn/api/cudnn-ops-library.html#cudnnnormalizationforwardtraining is deprecated in v9.
Could you please show me how to use it for LayerNorm? I can't see any mention in the API.

It seems weird that this layer, now used in most Transformer-Based networks, has no cuDNN implementation…

from dlib.

pfeatherstone avatar pfeatherstone commented on September 25, 2024

Somewhere in the docs I read it could be used for multiple types of normalization...
I agree, it's hard to believe cudnn doesn't have first class support for it. Maybe libraries like Pytorch, GGML etc have moved away from cudnn and just use vanilla CUDA or https://github.com/NVIDIA/cccl to write their kernels from scratch. Don't know.
Also a lot of Transformers use different normalization functions now, like RMSNorm for example.

from dlib.

arrufat avatar arrufat commented on September 25, 2024

Ah, maybe you're referring to this? This is for FC or Conv mode in Batch Norm, which dlib already uses.
https://docs.nvidia.com/deeplearning/cudnn/api/cudnn-ops-library.html#cudnnnormmode-t

from dlib.

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.