| Crates.io | ai-dataloader |
| lib.rs | ai-dataloader |
| version | 0.6.2 |
| created_at | 2022-09-27 21:13:12.64095+00 |
| updated_at | 2024-09-14 15:19:49.148589+00 |
| description | Rust implementation to the PyTorch DataLoader |
| homepage | |
| repository | https://github.com/Tudyx/ai-dataloader |
| max_upload_size | |
| id | 675216 |
| size | 180,008 |
A rust port of pytorch dataloader library.
DataLoader.Sampler, BatchSampler and collate_fn.rayon for indexable dataloader (experimental).ndarray and tch-rs, CPU and GPU support.DataLoader.More info in the documentation.
Examples can be found in the examples folder but here there is a simple one
use ai_dataloader::DataLoader;
let loader = DataLoader::builder(vec![(0, "hola"), (1, "hello"), (2, "hallo"), (3, "bonjour")]).batch_size(2).shuffle().build();
for (label, text) in &loader {
println!("Label {label:?}");
println!("Text {text:?}");
}
tch-rs integrationIn order to collate your data into torch tensor that can run on the GPU, you must activate the tch feature.
This feature relies on the tch crate for bindings to the C++ libTorch API. The libtorch library is required can be downloaded either automatically or manually. The following provides a reference on how to set up your environment to use these bindings, please refer to the tch for detailed information or support.
This features could be added in the future:
RandomSampler with replacement
parallel dataloader for iterable dataset
distributed dataloader
The current MSRV is 1.63.