Comments (5)
It's probably a side-effect (in your code or objax) stashing a JAX tracer. I requested access to the notebook!
from objax.
sorry about that, I should've checked to see if the link worked. https://colab.research.google.com/drive/1gG0naJz_JbFHQwNxL9jTKeifwzVne6KE?usp=sharing
from objax.
I got a different error when running the cells:
Could you double check that it's a repro of the bug you care about? Btw, minimizing it would increase our chance of making progress :)
from objax.
This is the right place where to ask. I've got the same error as @mattjj when trying to reproduce it.
Your code you use both objax.functional.loss.cross_entropy_logits
and objax.functional.loss.cross_entropy_logits_sparse
. In both cases, the way the API is called is the cause.
In short, the nicest way to do it would be for g_loss
is:
return objax.functional.loss.cross_entropy_logits_sparse(discriminator(fake_img, training=False), 1).mean()
And for d_loss
, you could change the code accordingly (just use an int
for the label).
Generally speaking, you could still use a tensor if you really wanted to, just make sure it has proper dimensionality, like this:
return objax.functional.loss.cross_entropy_logits(discriminator(fake_img, training=False), jnp.ones(x.shape[0])).mean()
More generally, one way I found to debug is to add print
statement in various place to make sure my variables are okay, and you can find the places to look closely at the stack trace:
File "dev/dcgan.py", line 137, in g_loss
return objax.functional.loss.cross_entropy_logits(discriminator(fake_img, training=False), jnp.ones_like(x)).mean()
Hope it helps!
from objax.
Thank you! the code runs now!
from objax.
Related Issues (20)
- Improve automatic variable tracing
- If user won't add random generator to VarCollection of jitted code then same number always return by random generator
- Model compiling twice when using jax==0.2.10 or later HOT 6
- Update Objax Basics tutorial to reflect .value change
- Accessing variable of a vectorized module HOT 2
- objax.Jit reports error when StateVar is added to the vc argument HOT 3
- Regression of JAX duck typing. HOT 2
- RecursionError when attempting to unpickle objax objects HOT 2
- How to compute Jacobian of outputs w.r.t. inputs HOT 3
- Activation functions like Swish and Mish are absent. HOT 1
- Error due to the deprecation of jax.api
- objax.Jacobian and objax.Hessian similar to objax.Grad HOT 4
- replacing jax.vmap with objax.Vectorize HOT 3
- Closure scoping for nested objax.Functions HOT 2
- ResNetV2 from model.zoo does not specify train arg for ResNetV2Block HOT 2
- pmean inside objax.parallel causes multithreading deadlock for more than 2 gpus HOT 3
- `objax.variable.VarCollection.update` fails when passing `Dict[str, Any]` HOT 1
- `objax.variable.VarCollection.update` not compliant with key-value assignment HOT 1
- TypeError during gradient computation: type <class 'objax.variable.TrainVar'> is not a valid JAX type
- Missing release 1.7.0 on GitHub 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 objax.