News for hackers. Stuff that matters.
Re:Llama.cpp 30B runs with only 6GB of RAM now by MontyCarloHall on Friday March 31, 2023 @07:24PM (#35395145)
>how much Python spaghetti probably tanks OpenAI's and other "big ML" shops' infra when they should've trusted in zero copy solutions

Probably not all that much. All of the Python numeric computing frameworks (Numpy, PyTorch, TensorFlow, etc.) are basically just wrappers for lower level C++/C/Fortran code. Unless you’re doing something boneheaded and converting framework-native tensors to Python objects, passing tensors around within a framework essentially just passes a pointer around, which has marginal overhead even when encapsulated in a bloated Python object.

Indeed, a huge number of PyTorch operations are explicitly zero copy: https://pytorch.org/docs/stable/tensor_view.html

Re:Llama.cpp 30B runs with only 6GB of RAM now by oceanplexian on Saturday April 01, 2023 @12:02AM (#35396982)
It’s not that the performance is the issue, it’s that it’s unmaintainable and prone to break. Exceptions aren’t handled right, dependencies are a disaster (Proprietary NVIDIA drivers+CUDA+PyTorch+ the various versions of stuff are a complete disaster)

This leads to all sorts of bugs and breaking changes that are cool in an academic or hobbyist setting but a total headache on a large production system.

Re:Llama.cpp 30B runs with only 6GB of RAM now by rfoo on Saturday April 01, 2023 @01:48AM (#35397515)
The stack is very volatile and unmaintainable because it doesn't need to be maintainable. Exactly why we have unmaintainable software in other domains. During the last 10 years there are ALWAYS totally new model architecture with new operations (or in case of CV new bizarre uses of Conv). By the time you get your performant perfectly maintainable masterpiece ready it's not needed anymore. The stack optimizes for flexibility and iteration speed naturally, just like why people use Rails.

In fact I'd love to see that Transformer really dominates. We can then start to converge on software. And compute-wise transformers are really simple, too!

Re:Llama.cpp 30B runs with only 6GB of RAM now by nunobrito on Saturday April 01, 2023 @08:41AM (#35399833)
Still a poor excuse. Had they written this in Java and things wouldn't be so difficult both on performance and maintainability.

Never understood why people think that indented languages are any simpler when in fact they bring all kinds of trouble for getting things done.

Re:Llama.cpp 30B runs with only 6GB of RAM now by revelio on Saturday April 01, 2023 @10:50AM (#35400733)
There's a Java ML library called Tribuo that might be worth looking at.
Re:Llama.cpp 30B runs with only 6GB of RAM now by dopidopHN on Saturday April 01, 2023 @11:06AM (#35400868)
Thanks, the boring aspect of Java is appealing here.
Re:Llama.cpp 30B runs with only 6GB of RAM now by rfoo on Saturday April 01, 2023 @03:26PM (#35403267)
There's deeplearning4j (from Theano days!), go figure why it didn't take off.
Re:Llama.cpp 30B runs with only 6GB of RAM now by wootland on Saturday April 01, 2023 @11:27AM (#35401019)
Does this mean it would be easy to move off Python all together? It seems like the problem stems from everyone using pytorch at the base layer. How realistic is it recreate those apis in another, more modern language. Coding in Rust, Go... then distributing a single binary vs. pip hell seems like it would be worth it.
Re:Llama.cpp 30B runs with only 6GB of RAM now by sroussey on Saturday April 01, 2023 @12:11PM (#35401402)
Go would be interesting for the reason you could send an executable.

I’d love for JS/TS to dominate as well. Use ‘bun bun’ to send an executable if need be, but also use in in web backends.

Re:Llama.cpp 30B runs with only 6GB of RAM now by rfoo on Saturday April 01, 2023 @03:19PM (#35403195)
Check https://pytorch.org/tutorials/advanced/cpp_frontend.html

You can easily build a standalone binary (well, it would be GiB+ if you use CUDA... but that's the cost of statically linking cu*), had you coded your model and training loop in C++.

It then happily runs everywhere as long as a NVIDIA GPU driver is available (don't need to install CUDA).

Protip: Your AI research team REALLY DON'T WANT TO DO THIS BECAUSE THEY LOVE PYTHON. Having Python, even with the dependency management shit, is a feature, not a bug.

(if you want Rust / Go and don't want to wrapping libtorch/tf then you have a lot of work to do but yeah it's possible. also there are model compiler guys [1] where the promise is model.py in model.o out you just link it with your code)

[1] https://mlc.ai

Re:Llama.cpp 30B runs with only 6GB of RAM now by colinsane on Saturday April 01, 2023 @01:07PM (#35401942)
> The stack optimizes for flexibility and iteration speed naturally

“unmaintainable” (as in “i’m spending an hour each day sorting out which dep update broke my project”) usually gets in the way of the former point.

Re:Llama.cpp 30B runs with only 6GB of RAM now by CurrentB on Saturday April 01, 2023 @01:59AM (#35397551)
Yeah, I've been using python for the first time in a while to try out some of the llm stuff and I can't believe how bad the dependency hell is. It's probably particularly bad due to the pace of change in this field. But I spend an hour getting dependencies fixed every time I touch anything. 80% of the Google Collabs I find are just outright broken. I wish there were other viable non python options to try out these things.
Re:Llama.cpp 30B runs with only 6GB of RAM now by bboygravity on Saturday April 01, 2023 @03:37AM (#35398107)
No idea what a Google Collab is, but does the code come with an environment or at least a specifications of which packages and versions to use (requirements.txt)?

It sounds unnecessarily weird to me that people would share Python code that simply doesn't work out at all out of the box.

Re:Llama.cpp 30B runs with only 6GB of RAM now by version_five on Saturday April 01, 2023 @04:02AM (#35398243)
Its rarely as easy as sharing a requirements.txt. There are lots of things that can still break - for examples you get weird situations where different modules require different versions of a third module. Or all the Cuda toolkit version issues thsy seem to come up with gpu stuff. When we share python, we tend to share a docker image, and even this isn't foolproof. A big problem I think is that it doesn't incentivize building something portable. And it's very hard to test across different machines. Add to that all the different practices re virtual environments, venv, conda, etc, everyone tries to install the dependencies differently or is starting from some nonstandard state. It's a mess.
Re:Llama.cpp 30B runs with only 6GB of RAM now by pablo1107 on Saturday April 01, 2023 @09:11AM (#35400039)
Maybe using Nix it's a better experience for creating such an environment where you depending also on system utilities.
Re:Llama.cpp 30B runs with only 6GB of RAM now by superkuh on Saturday April 01, 2023 @11:54AM (#35401252)
Everyone is using llama.cpp because we reject the idea of giving up on system libraries like nix does. That kind of tomfoolery (at least in the desktop context) is only required when you use software projects that use libraries/languages which break forwards compatibility every 3 years.

If you just write straight c++ (without c++xx, or anything like it) you can compile the code on machines from decades ago if you want.

Re:Llama.cpp 30B runs with only 6GB of RAM now by jart on Saturday April 01, 2023 @02:09PM (#35402510)
Docker. Don't forget Docker. I pretty much checked out the day using it became a requirement just to talk to a GPU and didn't do much with machine learning until llama.cpp came along.
Re:Llama.cpp 30B runs with only 6GB of RAM now by remexre on Saturday April 01, 2023 @07:19PM (#35405209)
What's c++xx?
Re:Llama.cpp 30B runs with only 6GB of RAM now by opless on Sunday April 02, 2023 @02:06AM (#35407666)
C++11, and greater.
Re:Llama.cpp 30B runs with only 6GB of RAM now by remexre on Sunday April 02, 2023 @07:26PM (#35416499)
Huh, I was proficient in Rust before "properly" learning C++, so maybe that accounts for it, but I didn't realize C++11 was controversial. Is it just move semantics, or are there some library things that are hard to implement?
Re:Llama.cpp 30B runs with only 6GB of RAM now by int_19h on Monday April 03, 2023 @05:30PM (#35431561)
I think what OP is saying is that decades-old systems wouldn't have C++11-compatible compilers on them.
Re:Llama.cpp 30B runs with only 6GB of RAM now by bboygravity on Tuesday April 04, 2023 @11:49AM (#35441542)
And maybe that "C++" is now basically a bunch of different incompatible languages instead of just 1 language, depending on what "xx" is (11, 14, 17, 20, 23, etc).

It's like Python 2 vs Python 3 except even worse.

Re:Llama.cpp 30B runs with only 6GB of RAM now by int_19h on Tuesday April 04, 2023 @02:32PM (#35444029)
In my experience, C++03 code works just fine without changes on a C++11 and C++14 compilers, so no, it's not at all like Python 2/3. The few features that were ripped out were exactly the stuff that pretty much no-one was using for good reasons (e.g. throw-specifications).
Re:Llama.cpp 30B runs with only 6GB of RAM now by vkou on Saturday April 01, 2023 @02:00PM (#35402417)
> No idea what a Google Collab is

It's ~equivalent to a Jupyter notebook.

Re:Llama.cpp 30B runs with only 6GB of RAM now by hunta2097 on Saturday April 01, 2023 @06:25AM (#35399048)
You're using virtual environments, right?

ML libraries are particularly bad, most other stuff works well.

Friends don't let friends install pip into /usr/lib.

Re:Llama.cpp 30B runs with only 6GB of RAM now by AnthonyMouse on Saturday April 01, 2023 @09:12PM (#35406036)
This just goes to show what a mess this is.

Suppose you have a big piece of compute hardware (e.g. at a university) which is shared by multiple users. They all want to come in and play with these models. Each one is tens to hundreds of gigabytes. Is each user supposed to have their own copy in their home directory?

Re:Llama.cpp 30B runs with only 6GB of RAM now by Accujack on Saturday April 01, 2023 @10:35PM (#35406562)
This is not exactly a new problem.
Re:Llama.cpp 30B runs with only 6GB of RAM now by AnthonyMouse on Saturday April 01, 2023 @10:46PM (#35406640)
That's kind of the point. We solved this problem decades ago. You have a system package manager that installs a system-wide copy of the package that everybody can use.

But now we encounter this broken nonsense because solved problems get unsolved by bad software.

Re:Llama.cpp 30B runs with only 6GB of RAM now by nyarlathotep_ on Monday April 03, 2023 @10:51AM (#35424595)
IME the ML world with Python is a whole mess on top of the existing dependency issues.

I've been very _careful_ too (using pyenv/virtualenvs etc) for dependency management, but with Nvidia driver dependencies and "missing 'sqlite3/bz2' issues related to the underlying interpreter (not to mention issues with different Python3.x versions) I'm lucky to be able to even run a 'hello world' ML sample after an afternoon of fighting with it.

My Ubuntu install w/ Nvidia card only seems to recognize the GPU in some circumstances even when using the same `conda` env. Often this is remedied by rebooting the machine(?).

No idea how companies manage this stuff in production. Absolute minefield that seems to catastrophically break if you sneeze at it.

I'll admit I am not an expert in managing ML envs, but I've dealt with a lot of python environments for typical CRUD stuff, and while rough at times, it was never this bad.

Re:Llama.cpp 30B runs with only 6GB of RAM now by eastWestMath on Saturday April 01, 2023 @03:51AM (#35398182)
I was in a PLT group in grad school going into robotics. I could spend all day ranting about how Python is just completely unsuitable for professional software development. Even something like F# would be an enormous improvement.
Re:Llama.cpp 30B runs with only 6GB of RAM now by miraculixx on Sunday April 02, 2023 @03:42AM (#35408170)
What a bad take!

Python is not the cause of dependency hell. Deep dependency trees are. The only way to deal with this is to use seperate environments and to carefully specify the exact requirements.

Those who claim some language would be a magical fix clearly lack experience in multiple languages.

Re:Llama.cpp 30B runs with only 6GB of RAM now by wnoise on Sunday April 02, 2023 @03:04PM (#35413971)
It's true nothing forces or forbids this, but some languages/toolings/communities/ecosystems encourage that more than others though.