charles-r-earp / autograph Goto Github PK
View Code? Open in Web Editor NEWA machine learning library for Rust.
License: Apache License 2.0
A machine learning library for Rust.
License: Apache License 2.0
Downloaded as zip file, ran cargo run --example mnist_dense --features "datasets" --release
:
CMake Error: The source directory "autograph-master/oneDNN" does not appear to contain CMakeLists.txt.
This was just a quick test, maybe I’m missing some obvious step.
Currently 64 bit operations are not fully supported on windows and macos. Additionally, 8 and 16 bit ops require extensions, and may not be fully supported as well.
For images, it is very beneficial to load data as u8 to the device and then convert it to floating point, as this increases bandwidth by a factor 4. What I did before was just pack the u8's into a u32, and then do bitwise operations to extract those into 4 u32's on the device. Not sure on the performance, but at least it's the most portable.
I would like to support bf16 eventually, even if 16 bit values are simply converted to f32s for operations. Potentially this may be faster due to 2x the bandwidth and memory.
The build script tells the compiler to look in lib/
, but in some platforms that’s called lib64/
.
From your examples (https://github.com/charles-r-earp/autograph/blob/master/examples/mnist_lenet5.rs) it seems that one has to write a lof of boilerplate code to do some actual learning. Is it possible to provide some kind of default Model struct with builder that would remove the need to write all this?
I think it could look the following way:
struct Model {
layers: Vec<Layer>
}
impl Model {
fn build() -> Self
fn fit(&mut self, ...)
...
}
Hi, I use the network defined in https://github.com/charles-r-earp/autograph/blob/main/examples/neural-network-mnist/src/main.rs
The output of the model in inference as_raw_slice() is F32(BufferBase { device: Device(0), len: 14190, elem: "f32" }).
Now I try to get a Vec<32> of it to interpret the results.
Can you help me to understand how to get the data?
Here is a peace of code:
autograph=v0.1.1
let prediction = self
.net
.clone()
.into_device(device)
.await
.unwrap()
.infer(&x)
.unwrap();
let prediction: FloatBuffer = prediction
.as_raw_slice()
.into_device(Device::host())
.await
.unwrap();
println!("{:?}", prediction);
// F32(BufferBase { device: Host, len: 14190, elem: "f32" })
Some examples show to "read" data back: let output = y.read().await?;
But FloatBuffer does not have the read() function.
It would be good to have candle
added to the benchmarks. It looks to have a mnist training example: https://github.com/huggingface/candle/blob/main/candle-examples/examples/mnist-training/main.rs. I'm happy to put up a PR, though I have never done any ML so will need a lot of mentoring.
Tests fail to finish on M1 Mac
$ cargo test device_new --features device_tests
running 1 test
test device::tests::device_new has been running for over 60 seconds
error: test failed, to rerun pass '--lib'
Caused by:
process didn't exit successfully: `/Users/rjzak/Downloads/autograph/target/debug/deps/autograph-868587c6365604da device_new` (signal: 9, SIGKILL: kill)
$ cargo test --features "full device_tests"
test device::buffer::tests::device_buffer_copy_from_slice has been running for over 60 seconds
test device::buffer::tests::device_buffer_serde has been running for over 60 seconds
test device::buffer::tests::fill_bf16 has been running for over 60 seconds
test device::buffer::tests::fill_f16 has been running for over 60 seconds
test device::buffer::tests::fill_f32 has been running for over 60 seconds
test device::buffer::tests::fill_f64 has been running for over 60 seconds
test device::buffer::tests::fill_i16 has been running for over 60 seconds
test device::buffer::tests::fill_i32 has been running for over 60 seconds
error: test failed, to rerun pass '--lib'
Caused by:
process didn't exit successfully: `/Users/rjzak/Downloads/autograph/target/debug/deps/autograph-aa9dbc5e89ab94bc` (signal: 9, SIGKILL: kill)
$ uname -a
Darwin macmini.local 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:24 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T8101 arm64
$ rustc --version
rustc 1.57.0 (f1edd0429 2021-11-29)
I was checking out cargo test
on metal and all non-f64 tests pass 🎉
Going forward, I think tests parametrized on dtype
and Device
(include/exclude via test params?) would make for a DRY yet granular foundation. I'm no expert in rust fixtures, but saw rstest and macro approaches.
Do you have any opinion on that?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.