Git Product home page Git Product logo

Comments (3)

seanmor5 avatar seanmor5 commented on August 23, 2024

There is definitely something strange going on here. So when you initialize a model, you need to provide all of the inputs and their shape. So if you remove your logic:

template = %{
  "sample" => Nx.template({12, 32, 32, 3}, :f32),
  "timestep" => Nx.template({}, :f32)
}

It actually should just blow up because you're giving it 1 input. I think the issue though is that if you pass a tensor it will just assume that input should be used for every input in the model, and so it doesn't raise. So that is 1 Axon bug.

As for the issues with templates, you should use a tensor there instead. I know it's confusing, but the issue is basically that you are using templates inside of a numerical definition. They are only meant to be used as placeholder parameters outside of numerical definitions. So I can use:

  template = %{
    "sample" => template,
    "timestep" => Nx.tensor(1, type: :f32)
  }

To initialize the model and it works

from axon.

bartekupartek avatar bartekupartek commented on August 23, 2024

oh this is it! I can wrap more inputs in init_fn and the original template has only batch from the training dataset šŸ‘ yeah it definitely clarified it, thank you!

from axon.

bartekupartek avatar bartekupartek commented on August 23, 2024

it looks like the first forward pass is in the init_fn where I though I should rather pass a template inputs without passing real data trough, this way I need to add noise to batched images in init_fn where I wanted to specify just a raw parameters.
At least, this is the way in PyTorch that Iā€™m trying to reproduce, where time samples and noise are added at each epoch (step) and the timestamp tensor template is in the constructor once. Leaving it as an open question

from axon.

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.