Remix.run Logo
zserge 3 hours ago

I wish we used something else but Python as the default ML language, so that some advanced type system would work for us to ensure tensor shapes and compatibility.

ux266478 an hour ago | parent | next [-]

Haskell is actually really good for that. Hasktorch[1] is high quality, batteries included, and leverages Haskell's GADTs for some cute stuff like gradual tensor shape checking. There's also just a grain to Haskell that feels really good for the machine learning domain. It doesn't just alleviate whole classes of bugs and a lot of annoying background noise reasoning, but it's also a much more natural-feeling expression.

The "gotcha" is that Haskell is heavy duty machinery, and getting up to speed with it if your background lacks solid type-theory can be really daunting. For that reason alone, it could never be the default. Sometimes I like to think about how much of a disservice academia has done to itself by training mathematicians without giving them the foundational knowledge they need to utilize the nuclear-grade tooling they themselves have the most potential to benefit from. For a number theorist? Sure makes sense. But the fact that machine learning courses don't have rigorous undergraduate prerequisites in learning the foundation of computation is pure absurdity.

[1] - http://hasktorch.org/

bssrdf 2 hours ago | parent | prev | next [-]

I found [ggml] is really easy, educational and fun to use. It is written in C and the backbone for llama.cpp.

[ggml]https://github.com/ggml-org/ggml

churchsub1 2 hours ago | parent | prev | next [-]

Here's a Python library for static type checking of tensor shapes: https://pypie.dev/

srean 2 hours ago | parent [-]

Thanks. Did not know about it.

Looks a little FiShy. In a good way [0].

[0] https://link.springer.com/article/10.1007/s100090050037

srean 3 hours ago | parent | prev | next [-]

Honestly, I quite like Python most of the time. The times when I don't, argghh type errors.

The worst I have had in a while is when I was dealing with a sparse array data type and getting some processing done in a C function to speed things up.

Infuriatingly enough, the index type used to change after initialising the array. It would check if Int32 could accomodate the size of the array. If it could it would downgrade to Int32 at runtime. My C counterpart had no clue.

That was so not fun to debug because the errors were intermittent (depending on the fill factor of the sparse array)

weiserwx 2 hours ago | parent | prev [-]

[dead]