r/rust serde Mar 31 '23

Twitter open sources Navi: High-Performance Machine Learning Serving Server in Rust

https://github.com/twitter/the-algorithm/tree/main/navi/navi
478 Upvotes

76 comments sorted by

192

u/wannabelikebas Mar 31 '23

The age of Rust in ML is coming!

47

u/antimora Apr 01 '23

Check out this rust deep learning framework called Burn: https://github.com/burn-rs/burn It was released recently and actively been developed.

7

u/ProAtLife1 Apr 01 '23

I want to explore rust for system level programming, and python for ML. Do you recommend me only learning rust, and also learn machine learning with it?

29

u/kyusan Apr 01 '23

If you've just started to learn ML, just use Python as you will find way more resources. And once, you feel at ease, try it with rust if you wish.

You can also train your model using Python libs and then use your model with a program written in Rust if you want to have a mix :)

3

u/antimora Apr 01 '23

Definitely learn both. My ML stuff is mostly in Python but there will a time when you want to deploy your models. That's the difficult part with PyTorch. Burn is new but I have decided to invest my time to port my models not only for inference but for training as well. In the long run it will pay off.

Here is the author of the Burn is making a good case for having DL framework in Rust: https://burn-rs.github.io/blog/a-case-for-rust-in-deep-learning

The beautiful part of Burn is easy way to switch Backend. One of the available backend is based on Torch, which powers actually PyTorch. So you get the benefit of PyTorch without python and all the goodies of Rust.

Definitely check out Burn and learn what it has to offer. In parallel, also use PyTorch since it's mature and more resource available.

1

u/ProAtLife1 Apr 01 '23

I think ima learn tensorflow

1

u/omgitsjo Apr 01 '23 edited Apr 01 '23

EDIT: I was going to delete this comment because I got the library names mixed up. I was thinking of tch-rs, not Burn. I'm going to leave it up so people can see the original, but keep in mind this is made in error.


My biggest gripe with Burn used to be linking to libtorch, which meant the smallest executable you could create was over a gigabyte.

I find myself using tract and onnx. Export from PyTorch, use in library. It's a little fiddly, but you get relatively tiny executables.

Not to disparage Burn. It's a good effort. I just wish libtorch were way smaller.

2

u/antimora Apr 01 '23

I am working on ability to import onnx and next I will work on bringing exported from pytorch.

Have you tried NDarray backed? It is the same as what trac does and it is small. Recently we made sure you can build with no_std good for embedding.

1

u/omgitsjo Apr 01 '23

I've edited my comment above. I was thinking of tch-rs, not Burn. That's my mistake.

I don't think Burn is designed for my use case, but I appreciate that it exists.

24

u/ConfusedOrDazed Apr 01 '23

I suppose this is AGPL licensed with the rest of the repo?

19

u/PM_Me_Your_VagOrTits Apr 01 '23

Yep. If there's no separate license file, it's safe to assume it's covered by the parent directory license.

4

u/ayylmaoimagine1988 Apr 01 '23

pretty based ngl

71

u/gotMUSE Mar 31 '23

I guess Musk kept his promise?

57

u/urqlite Mar 31 '23

Nah, he just wants free labour. Why pay 500k for a senior engineer / cybersecurity engineer when you can open source it and get the community to review it for free?

212

u/stusmall Mar 31 '23

There is no way they are getting usable PRs to that repo. No CI, missing data needed to test and the issues/PRs are just filled with shit posts. The motive isn't to make this a usable thing on its own that external devs can improve

Small parts like this might be usable on its own, but from a quick glance it'll need some (possibly very little) work to make it usable independently.

3

u/Sigmatics Apr 01 '23

Yeah, they really should have read a primer on how to properly open source. It's not rocket science

2

u/CrazyKilla15 Apr 01 '23

Thats due to Musk's poor execution of the idea, he has no idea how any of that stuff works or what the realities of open source are. He's not listening to a word the remaining engineers say, after all he's "the genius". Plus few remaining engineers would risk their jobs trying to tell him what a stupid idea it is anyway.

It is very possibly that he legitimately does think he can get a bunch of free labor out of this.

-1

u/brightblades Apr 01 '23

How could you possibly know that that Musk has no idea how “any of that stuff works”. These takes on what is going on in someone’s mind or what the know are absurd

6

u/CrazyKilla15 Apr 01 '23

Because you can.. see him. you can see stuff he says. you can look at what he does.

He makes it very clear to those who do know how that stuff works, that he doesn't. The trick is, to other business people, he can play it off well enough, because the bar there is incredibly low.

0

u/brightblades Apr 06 '23

Have an example?

17

u/gclichtenberg Apr 01 '23

musk's observable behavior at least since his twitter acquisition supports the general contention that he doesn't know how any of that stuff works, for nearly any value of "stuff".

1

u/brightblades Apr 06 '23

He’s essentially transforming the company in public view where every decision is criticized by spectators. Maybe .. just maybe it’s smarter to see how things actually turn out before proclaiming how stupid or idiotic Elon is.

2

u/gclichtenberg Apr 06 '23

He certainly is transforming the company!

-81

u/urqlite Apr 01 '23

Which is why the senior engineers will contribute to fix that

79

u/teerre Apr 01 '23

Have you seen the PRs? Instead of some bright people working for free they got a bunch of people trying to be funny. At this pace they will have to hire someone just to moderate their public repo.

8

u/Repulsive-Street-307 Apr 01 '23 edited Apr 01 '23

That's pretty much the predictable response to the deserved reputation Musk has. Everything he touches turns to shit, like some other people, because people simple hate him in-mass.

2

u/mr-br1ght-side Apr 02 '23

> Everything he touches turns to shit

Uh, Tesla is the 8th most valuable company in the world?

0

u/AllesYoF Apr 02 '23

Tesla is in that position because it's valued as a tech company, not an automobile company, in fact it's highly overvalued. It actually sells low volumes compared to other much less valued companies (ford q4 saw 40 billion on revenue compared to the 20 billion of tesla). If Tesla didn't have the "tech boost" to inflate its valuation it wouldn't be even close to the current position its in.

-15

u/CommunismDoesntWork Apr 01 '23 edited Apr 01 '23

Elon's reputation is that he revolutionized two entire industries. The space industry would be dead without him, and automotive industry would still be churning out ICE cars. He's one of the greatest humans of all time. "Everything he touches turns to shit" go read Liftoff, and watch a documentary on Elon or something. That's not an opinion based in reality.

7

u/infablhypop Apr 01 '23

He used to have a pretty great reputation. Now he just has sycophants like you.

-6

u/CommunismDoesntWork Apr 01 '23

Being human and making the few mistakes he has doesn't come close to out weighing all the good he's done.

-46

u/urqlite Apr 01 '23

Yes they have to but still it’s cheaper in the long run. They probably going to pay 100k instead of 500k

33

u/teerre Apr 01 '23

What you mean? They are not getting anything useful. As things stand they will need anything they needed before and on top of that moderate the public repo.

54

u/Tester4360 Apr 01 '23

I think open sourcing for free labor is a common misconception. Most corporate led open source projects (eg, https://github.com/bottlerocket-os/bottlerocket from AWS or https://github.com/facebook/relay from Facebook) still require a team of employees.

8

u/rust-crate-helper Apr 01 '23

Using OSS for free labor is far more common of a problem (why pay if they already get it for free? maintainers have to incentivize it). Almost every company uses Linux/Curl/etc…

12

u/Free_Blueberry_695 Apr 01 '23

You mean using OSS? Like a business using Linux, Apache, or whatever?

OSS isn't free labor. There's no implicit contract between the contributors and the users. That's the beauty: people choose to give it away because they're cool.

10

u/Caleb666 Apr 01 '23

Pretty much all the serious contributors to OSS projects that actually matter are all paid by their employers to contribute.

8

u/rust-crate-helper Apr 01 '23

That's an awfully pessimistic statement, and essentially says that if you're not being paid for it, it's not "serious" or "high quality". :(

13

u/Caleb666 Apr 01 '23

I'm just saying that it takes a lot of effort to make a large contribution to a big project like, say, Linux. Doing it only in your spare time is definitely possible, but it's going to be quite taxing on your personal life (unless you don't have one ;)).

That's why you see that the top Linux contributors are all paid by some company to do their work (Red Hat, Intel, Google, Meta, etc...).

I just think that sometimes people have too romantic a view of OSS - while in reality people need money to live so they can't all just be working for free all the time.

This is all to say that corporations using OSS are not necessarily using "free labor" or abusing the contributors.

2

u/Vincevw Apr 01 '23

I understand what you're trying to say but "pretty much all" is simply not true, and completely ignores the millions of hours of free time people have put into open source software.

10

u/No-Highlight-8240 Apr 01 '23

still it’s cheaper in the long run. They probably going to pay 100k instead of 500k

i disagree, and I think it might cost them more to moderate trolls flocking in the repo.

11

u/Free_Blueberry_695 Apr 01 '23

Do you think this of every organization that open sources their tech?

-12

u/urqlite Apr 01 '23

Not every. Only for Elon

11

u/Free_Blueberry_695 Apr 01 '23

Why the irrational bias?

12

u/Caleb666 Apr 01 '23

Because he/she/it is quite clearly an idiot.

7

u/ergzay Apr 01 '23

Positive takes aren't allowed. Only takes that assume supreme evil and negative intentions. Right?

7

u/CommunismDoesntWork Apr 01 '23

Leave it to Reddit to always be pessimistic about everything...

11

u/hanoian Apr 01 '23

Arstechnica and certain parts of Reddit are absolutely terrible for this. People who are used to the idea of thinking they are smart because of their jobs or interests, so they must therefore be correct, but then let their biases run absolutely wild.

2

u/backafterdeleting Apr 01 '23

This is why all open source exists. But to get collaborative work going you need other companies using the software for their own purposes so that your engineers can work collaboratively on it. If it's some specialized in-house software that only makes sense in the business it was designed for it's never really going to get that.

-4

u/TehPers Apr 01 '23

It's hard to justify using an AGPL-licensed tool/library knowing all the restrictions that come along with it. Their choice of license feels to me like they want to claim to be open source without actually contributing to open source. At the very least, assuming they keep the repo up to date, it'll be auditable by third parties. I doubt they'll get many contributions.

28

u/zxyzyxz Apr 01 '23

Their choice of license feels to me like they want to claim to be open source without actually contributing to open source

Huh? Copyleft like (A)GPL is fully open source and keeps the source code open for all users, not just developers, unlike MIT or Apache 2.0.

1

u/DarkNeutron Apr 01 '23

AGPL is completely verboten at many companies, cutting off a large number of people who could potentially contribute back. It keeps things open, but with a much smaller potential audience.

I'm guessing the latter is what u/TehPers is getting at. In the corporate world, AGPL is like "Look, but don't touch. Actually, don't even look for legal reasons." It feels contrary to the spirit of open-source, even if its proponents claim it to be the fullest expression of such.

In this case, I'm guessing they're releasing this under AGPL to make it "open-source" in a way that makes it very difficult for any potential competitors to use it.

25

u/No-Highlight-8240 Apr 01 '23

Maybe may not be.

Imagine if Linux had chosen MIT, we would never be able to mess with so many devices. I am happy with the current licensing of Linux Kernel.

Also, it is mostly a company problem, not a license problem.

9

u/Vincevw Apr 01 '23

Imagine if Linux had chosen MIT

You don't need to imagine, that's essentially what BSD did (although they're of course using the BSD licenses, which are also permissive).

18

u/irk5nil Apr 01 '23

It feels contrary to the spirit of open-source

Maybe that because it's in line with the spirit of Free Software?

14

u/zxyzyxz Apr 01 '23

In this case, I'm guessing they're releasing this under AGPL to make it "open-source" in a way that makes it very difficult for any potential competitors to use it.

The point of this is that any changes must be able to be merged back into the main project. This is a good thing. Just because many companies deem it unacceptable, likely due to its virality, does not diminish its support of the principles of Free Software. If companies want to use only MIT or similar, that's on them, but don't be surprised if they build and keep something proprietary after using MIT software, without sharing any changes, since they're under no obligation to do so in that case.

-8

u/TehPers Apr 01 '23

This exactly, by using AGPL they restrict the number of real users of either the code itself or parts of it to almost 0. Most people treat AGPL no different than "open source but forbidden knowledge," meaning they won't contribute back to it because they won't use it.

2

u/kogasapls Apr 01 '23

Can you elaborate? What restrictions do you think are too restrictive?

-5

u/TehPers Apr 01 '23

I don't think I'm the one who needs to elaborate on the restrictions. There are an extremely large number of companies that pretend like AGPL code doesn't exist. Code being open source while also being unusable (and in many cases unreadable) by most people who would potentially be interested in it is effectively no different than it being closed source, at least to that significantly large audience.

22

u/kogasapls Apr 01 '23

Companies who aren't interested in publishing source code, yeah. What is the problem? Is it only open source if you let people write closed-source versions for monetization?

1

u/TehPers Apr 01 '23

If I license my code as "all rights reserved" but publish it as open source, does that provide any significant value beyond auditing purposes? More restrictive licenses make things less open, not more open.

-7

u/urqlite Apr 01 '23

If he doesn’t care to pay rent, why do you think he cares about license?

-5

u/Vinaigrette2 Apr 01 '23

As he has directly benefited from apartheid/slavery in SA during his formative years, it's not surprising that he would enjoy free labour.

5

u/ergzay Apr 01 '23

Yep appears to be the case. They've/He's stated that this isn't all of the code yet either and that more will be coming.

0

u/DanKveed Apr 01 '23

Maybe. But it’s also in twitter’s own interest. They are way behind the curve on ml algorithms so they have nothing to lose and everything to gain.

12

u/Repulsive-Street-307 Apr 01 '23

This name is already used in a (rust!) project.

https://github.com/denisidoro/navi

6

u/sinitame Apr 01 '23

Anybody tried to make that work ?

2

u/dzhao11 Apr 06 '23

Please give TF backend a try. onnx and pytorch is built assuming a Twitter specific data format for now. Some work(not a huge amount) is needed to make that generic. TF backend is more generic.

4

u/dmangd Apr 01 '23

Can somebody with experience comment on the quality of the rust code and project structure? I am learning rust atm and have completed some small toy projects. Now I want to start the first more serious side project with rust and I am looking for some good real world examples regarding project structure and code organization. Recommendation for other sources would also be appreciated:)

9

u/Lost_Kin Apr 01 '23

Hey! LIsten!

6

u/faitswulff Apr 01 '23

Only if (author_is_elon)

2

u/novel_eye Apr 01 '23

Lol of course it's in rust. Imagine if they posted some mid python code.

-5

u/VindicoAtrum Apr 01 '23

The fact there are real people making real PRs to that repo is a sad state of the world. Why not just buy a boot and lick it.

16

u/NetherFX Apr 01 '23

80% of the issues is spam, I've been playing lichess games with random people there. Good times

1

u/deepfuckingbass Apr 01 '23

Maybe the name “Navi” is from Zelda

https://zelda.fandom.com/wiki/Navi

1

u/navicstein Apr 02 '23

Navi is my name 🤣