Comments (4)
Ok, so to understand this part you need a bit to read the advanced docs here.
The way KFAC works is in two stages:
It first marks/labels certain computations with specific "layer_tags" and then separately to each tag it assigns a block class.
The generic_tag is only compatible with NaiveDiagonal
and NaiveFull
curvature blocks, while the Dense blocks are compatible only with the dense_tag currently.
So what needs to happen, is you need to correctly have a dense tag computation in your model in order to be able to use the DenseTwoKroneckerFactored block. If this is not picked up automatically, you can in your code use manually kfac_jax.register_dense
to manually register your computation as dense.
I can't comment why it is not picked up automatically, without seeing your model code.
from kfac-jax.
PS: If you resolve your problem please do close the issue tracker.
from kfac-jax.
Ok, so to understand this part you need a bit to read the advanced docs here.
The way KFAC works is in two stages: It first marks/labels certain computations with specific "layer_tags" and then separately to each tag it assigns a block class. The generic_tag is only compatible with
NaiveDiagonal
andNaiveFull
curvature blocks, while the Dense blocks are compatible only with the dense_tag currently.So what needs to happen, is you need to correctly have a dense tag computation in your model in order to be able to use the DenseTwoKroneckerFactored block. If this is not picked up automatically, you can in your code use manually
kfac_jax.register_dense
to manually register your computation as dense. I can't comment why it is not picked up automatically, without seeing your model code.
Right, I see. I was using my own defined Dense layers using hk.Module
and I assumed that the optimizer would recognize this automatically. My implementation is a bit different from hk.Linear
as I was writing my own implementation for KFAC
, and variants thereof, and I concatenated the bias vector into the weight matrix. Could this be the cause?
Anyways, I can indeed get it working when I switch out my implementation for the hk.Linear
modules. Your comment clears up my confusion! Thanks!
from kfac-jax.
Yes, if as inputs they are separate parameters, but then you concatenate them and use them in that way, KFAC would not automatically recognize it as it does not have the notion that it is a dense layer computation.
from kfac-jax.
Related Issues (12)
- TypeError: 'ShapedArray' object is not iterable HOT 4
- Using kfac inside jitted function HOT 2
- Quickstart example with different NN libraries does not tag correctly HOT 7
- Value functions returning state objects not supported HOT 4
- division by zero error for scalar params HOT 1
- KFAC Norm Constraint HOT 2
- Using K-FAC with physics-based losses HOT 3
- Add Support for KFAC Optimization in LSTM and GRU Layers HOT 4
- Can this be used for Laplace approximation?
- How to use kfac to train two probabilistic models jointly? HOT 3
- Quick question on "layer_tag_vjp" HOT 2
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 kfac-jax.