-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: burn-train in the browser #938
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #938 +/- ##
==========================================
+ Coverage 84.45% 85.55% +1.09%
==========================================
Files 546 509 -37
Lines 61507 53925 -7582
==========================================
- Hits 51946 46133 -5813
+ Misses 9561 7792 -1769 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add the instruction to install cargo-watch
, otherwise there is an error.
I think an important step is have a way to import datasets easily, at least for the example to work.
@AlexErrant Thanks a lot for the video, it helps reviewing the PR. See my comments bollow:
trait AsyncTask {
fn join(self: Box<Self>) -> Result<(), AsyncTaskError>;
}
pub type AsyncTaskBoxed = Box<dyn AsyncTask>; You can then use
While I appreciate your efforts on the CI, since I discovered several small issues, such as not adding In conclusion, please avoid updating the CI for this PR. Just incorporate the example and the new way of launching threads. |
Sorry it's been a while - I had to take care of some things in real life. I believe this PR requires changes to the CI because it adds the
This is impossible to do because it's on I tried adding |
How to build on this branch? I run this command: RUSTFLAGS='-C target-feature=+atomics,+bulk-memory,+mutable-globals' cargo +nightly build --target wasm32-unknown-unknown -Z build-std=panic_abort,std But I get these errors:
and
|
Is it possible to use Trunk to build this project? It might simplify the building phase and CI |
@L-M-Sherlock are you sure you're building @Luni-4 Trunk looks interesting. It has a library mode, which I think is more relevant for my purposes. Since I'm not building a Rust WASM application (it's JS), I'm not entirely sure if Trunk provides significant advantages for my example project. It has two features: dev server and change detection. My example project currently uses Vite (since I'm (sigh) a boring webdev) which provides a dev server and change detection in JS. For Rust change detection, I'm using cargo-watch. An advantage of cargo-watch is that it can be used for non-wasm targets. It's also entirely optional. Vite serves as the build tool, and I don't think Trunk will simplify the CI process since the vast majority of the complexity is going to come from adding nightly. |
@AlexErrant I think you were writing something similar to this example for what concerns the |
It works in building |
@Luni-4 I'm not sure I understand. Let me see if I can try to re-address your concerns.
I don't think Trunk will (significantly) simplify the building phase as that's handled by Vite. Trunk is meant for Rust web apps, and my web app is JS. CI requires nightly, which is where the majority of the complexity will come from. As far as I can tell the only thing Trunk will do for me is automatically download and install
That example is a Rust web app, while my example project is JS. @L-M-Sherlock ah yeah, this PR currently fails CI (as evidenced by the many ❌s). I was working on getting CI passing, primarily by splitting up the build so feature unification doesn't occur, but ended up discarding all those changes when @nathanielsimard said "please avoid updating the CI for this PR". However, due to "this PR requires changes to the CI because it adds the |
My concerns were born from the fact that you are building |
This pull request has expanded to the extent that I am not comfortable merging it. It interacts with numerous parts of the framework, and I am concerned that merging it might introduce excessive technical debt and slow down the development of other areas of the framework. I appreciate @AlexErrant for exploring the training of models on wasm, but I believe the scope is somewhat extensive for a single pull request. There is still valuable insight to be gained from this experiment, so I have created issues to track progress on better supporting wasm (#1256). Ultimately, I believe we need to establish a robust web worker implementation that functions effectively with Rust stable before attempting to support complex workflows on wasm, aside from inference. This is the primary issue to address in enhancing our wasm support (#1250). Thank you once again for your hard work. Not all pull requests are meant to be merged to add value to the project, and this one is a perfect example. Gaining knowledge and exploring new use cases is highly valuable, and I appreciate your contributions in that regard. |
Hi - to confirm the current state of this, is Thank you! |
No, |
Just to make sure we're on the same page - this PR demoed As a closing thought, since we probably want atomics for communication between web workers, I don't think that'll be landing in stable for quite some time. Relevant issue: rust-lang/rust#77839 |
FYI I more or less finished a proof-of-concept of getting the non-trivial project https://github.com/open-spaced-repetition/fsrs-rs training in the browser https://github.com/AlexErrant/fsrs-browser I git submoduled burn to get the above working https://github.com/AlexErrant/burn/tree/fsrs-browser I've no intention of maintaining it for anyone else's use; this message simply serves as an FYI so other people can copy me if they wish. In particular, fsrs-rs uses burn v0.11.1, and I don't intend to update that project unless fsrs-rs also updates. Notably for me, training with ndarray is viable. |
Pull Request Template
Checklist
run-checks
script has been executed.This has never worked on my machine. Gonna lean on CICD for this.
Related Issues/PRs
Closes #921
Changes
Here's part 1, where I replace a
spawn
inEventStoreClient
with a webworker implementation pretty much copied straight from here. The total files changed is pretty large, but most of it is just a new example project I made calledexamples/train-web
. That project uses PNPM and Vite, which stylistically diverges from the minimalisticexamples/mnist-inference-web
. I do so to more accurately reflect the usage in a real-world project that uses Typescript and NPM packages.To make this PR easier to review, I'm following the atomic commit style and will refrain from force-pushing this branch.
Testing
I have a branch here that demos
sender.send
working. Console output as follows:Next step
Either getting data loading of mnist working or exploring what it'll take to write to the filesystem.