Comments (1)
I am realizing for the example I described, you wouldn't actually get any parallelism from the addition of threads since the copy (assuming its synchronous) and inference kernels will be interleaved on the same cuda stream.
Nevertheless it would be great if something like the following pseudo code was possible
fn inference_server(results: Sender<Tensor>) -> Sender<Request> {
let dev = dfdx::AutoDevice::default();
let model = dev.build_module::<ResNet, f32>();
let (tx, rx) = tokio::sync::mpsc::channel(256);
let inferencer = UnboundedReceiverStream(rx)
.map(|data| preprocess(data))
.ready_chunks(32)
.map(|batch_vec| dev.tensor(batch_vec))
.for_each(|tensor| tokio::spawn_blocking(|| {
results.send(model.forward(tensor))
}));
tokio::spawn(inferencer);
tx
}
from dfdx.
Related Issues (20)
- Consider helpers for accessing tensors from tuples and input wrappers HOT 1
- Question / clarification regarding heap allocations HOT 2
- Examples or resources for autodiff with 2 networks?
- Bug: `Sequential` macro provide `forward_mut` as `forward`
- Replace explicit features and paths on generated code
- Add `OUTPUT_PADDING` to `ConvTrans2D`
- Split `TryConcatAlong` into different traits
- Add `Prodigy` optimizer HOT 1
- Run tests with miri HOT 1
- Reduce test sizes HOT 1
- Unclear how to handle error type in `dfdx::nn::LoadFromNpz::load`
- Add `nn::AdaptiveAvgPool2D`
- How does one update one model from another model? HOT 1
- Unable to build with old CUDA version (`CUDA_COMPUTE_CAP = 52`)
- OpenXLA Support HOT 3
- CUDA kernels missing __hmin and __hmax HOT 1
- Non-trainable parameters? HOT 1
- can not perform tensor operations (add/sub/mul/...) on tensors with non float datatype
- Kernels written in rust-gpu
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dfdx.