Giter Club home page Giter Club logo

Comments (5)

maxjcohen avatar maxjcohen commented on July 28, 2024

Hi, having a constant loss throughout the training can be a real headache, let's try a couple of things:

  • What is the exact shape of a batch returned by your dataloader ?
  • Have you properly normalized your data ?
  • Could you try using one of the LSTM/GRU in the benchmark to see if the problem persists ?

You should keep the MSELoss for now, the OZELoss is proper to my use case and may not fit your problem anyway.

from transformer.

LightingFx avatar LightingFx commented on July 28, 2024

Hi, having a constant loss throughout the training can be a real headache, let's try a couple of things:

  • What is the exact shape of a batch returned by your dataloader ?
  • Have you properly normalized your data ?
  • Could you try using one of the LSTM/GRU in the benchmark to see if the problem persists ?

You should keep the MSELoss for now, the OZELoss is proper to my use case and may not fit your problem anyway.

Thanks for your reply.
Firstly, i used LSTM which was same with LSTM in benchmark,and the results were good.So i want to know the results
with Transformer,
Secondly, i have used MinMax and log normalization,and the log normalization worked better on LSTM,so i used it.
Thirdly, shape returned by dataloader is [batch_size, time_step, input_size]
So should I adjust the other parameters,or the transformer is just not fit with my data?

from transformer.

maxjcohen avatar maxjcohen commented on July 28, 2024
  • LSTM working properly is not a good sign at all
  • Either should be fine
  • Which is the correct shape.

One thing you could try is reducing the number of layers of the Transformer. Firstly, because smaller models are usually easier to converge, secondly so it's easier to pinpoint at which point does the gradient vanishes, or explodes (if that is indeed the reason for the model being stuck).

from transformer.

LightingFx avatar LightingFx commented on July 28, 2024
  • LSTM working properly is not a good sign at all
  • Either should be fine
  • Which is the correct shape.

One thing you could try is reducing the number of layers of the Transformer. Firstly, because smaller models are usually easier to converge, secondly so it's easier to pinpoint at which point does the gradient vanishes, or explodes (if that is indeed the reason for the model being stuck).

Thanks,
I deleted part of layernorms and residual connections in sub-layer, and then the loss decreased normally.Besides,the performance in Transformer is a bit better than LSTM on my data.

from transformer.

maxjcohen avatar maxjcohen commented on July 28, 2024

It's funny how these layers you removed supposedly improved convergence on all networks. I guess the transformer architecture still isn't that well understood in that regard.

If you want to get to the bottom of this convergence issue, you could now try plotting attention maps. You could also add these layers back, one at a time, to isolate the problem.

from transformer.

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.