-
Notifications
You must be signed in to change notification settings - Fork 501
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
Support training in no-std #2830
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2830 +/- ##
=======================================
Coverage 82.22% 82.23%
=======================================
Files 853 853
Lines 113444 113503 +59
=======================================
+ Hits 93275 93334 +59
Misses 20169 20169 ☔ 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.
Will take a look at this tomorrow! But just a preliminary comment: I think we can just replace most types with their alloc types in all cases. That would probably just leave the collections stuff which is only used in a couple modules, so maybe we don't need to have a crate-level module to re-export compatible types.
d81c851
to
9507624
Compare
Updates:
|
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.
Thanks for extending the portability!
Looks good so far, just a some comments below.
Mark all of the tests in optim std only as they require TestAutodiffBackend.
Now that you've made burn-autodiff no-std compatible this should be good to go (on 64-bit platforms, that is), no? Some tests save or load a state from a record file so these will need to be marked for std, but I think the rest should be fine 🤔
Also, NO_STD_64BIT_ONLY_CRATES
with burn-autodiff is only due to the atomics at his point, unless I am forgetting something else... If that's the case, we could use portable-atomic
to add the support. But that can be left for the future, mostly thinking out loud here 😄
/edit: oh and also the issue in formatting CI
9507624
to
bf13a4a
Compare
Updates:
|
checking on the failed build of target |
bf13a4a
to
3be6f23
Compare
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.
Awesome! Thanks for the changes
After consideration, I believe we should leave this as is and skip building burn-autodiff for the thumbv6m-none-eabi target.
Makes sense, this PR already makes it much closer to full no-std.
Will come back to this on Monday but should be good to go 🙂
Support training in no-std
Checklist
run-checks all
script has been executed.Related Issues/PRs
#2829
Changes
1. burn-core
Make
optim
module support no-std:alloc::vec::Vec
andalloc::boxed::Box
whenno-std
num_traits::float::Float
to supportsqrt
function inno-std
optim
std only
as they require TestAutodiffBackend.2. burn-autodiff
Fix
no-std
feature and provide a facadecrate::libs
for clean codes:std
tocore
oralloc
.std::collections::{HashMap, HashSet}
withhashbrown::{HashMap, HashSet}
whenno-std
num_traits::float::Float
to support some math functions inno-std
burn-autodiff
NO_STD inxtask
3. burn
Fix dependency of
burn-autodiff
: adddefault-features = false
on dependency ofburn-autodiff
Testing
Successfully compile a TA(trusted application) and run with it.
PS: I tried
run-checks.sh all
but it always failed by network reason(cannot reach huggingface.co).