First, let me say I love Julia! It is a terrific new tool in my box for Machine Learning
I am an old time programmer who is used to type safety and static type checking, and with Julia, I am experiencing many of the same frustrations I have with Python-- namely when I try to use someone else’s code, it can be a bear.
For example, I am currently using Flux to do some NLP. I want to make a text classifier using a Conv layer. I feed it my word embeddings and get a mystery crash deep inside NNLib. Obviously I am not passing it the kind of input it expects. The Flux code has no argument types, and the comments do not mention types. I waste huge amounts of time trying to reverse engineer the stack dump and guess what I did wrong.
For reference, here is the code
Data should be stored in WHCN order. In other words, a 100×100 RGB image would
be a `100×100×3` array, and a batch of 50 would be a `100×100×3×50` array.
function (c::Conv)(x)
# TODO: breaks gpu broadcast :(
# ndims(x) == ndims(c.weight)-1 && return squeezebatch(c(reshape(x, size(x)..., 1)))
σ, b = c.σ, reshape(c.bias, map(_->1, c.stride)..., :, 1)
σ.(conv(x, c.weight, stride = c.stride, pad = c.pad, dilation = c.dilation) .+ b)
end
This is not a complaint about Flux (which I love). I have the the same problems with most libraries in Julia and Python
- Without something like Traits or Interfaces it is hard to know what one should pass as arguments
- You don’t find out your mistake until runtime, often after things have been running for a while
- The error is usually some stack dump that starts way down in a library called by a library called by… your code
I end up in the REPL trying different things to see what works
How can I be more productive?