Comments (3)
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.
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.
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)
- Compiled model will always result in `%Axon.None{}`
- Block with multiple inputs fails to compile HOT 2
- mixed precision policies cause bumblebee models to fail HOT 2
- Cannot return map from Axon.nx
- batch_norm states "mean" and "var" never updated HOT 1
- Optimize frozen parameter memory usage HOT 1
- Allow overriding layer metadata such as `:op` and `:op_name` for built-ins HOT 1
- XLA Slow operation alarms: "The operation took ..." HOT 1
- a
- Loss increasing with binary_cross_entropy above version 0.4.1 HOT 6
- Compile Error due to a type mismatch HOT 2
- Req usage in OTP 26 HOT 6
- Most `Axon.ModelState` functions should be `defn` or `deftransform`
- Merge model state updates into a single `Axon.ModelState` call
- Optionally return gradients / gradient state in train step
- Crash with mixed precision with new Nx
- Remove namespaces
- Ambiguous inputs should raise
- Tagged versions missing in the repo compared to the ones in hexdocs.pm HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from axon.