Giter VIP home page Giter VIP logo

Comments (6)

Yevgnen avatar Yevgnen commented on July 25, 2024 1

Thanks for the explanation!

from batched-fn.

epwalsh avatar epwalsh commented on July 25, 2024

Hi, you might want to start by putting timing code in the handler closure, e.g. right here:

let output = model.predict(batch.clone());
println!("Processed batch {:?} -> {:?}", batch, output);
output

That will tell you how it takes to process each batch at a given batch size.

In general (for deep learning models, at least) I would set max_batch_size as large as you can without running out of memory, and max_delay small relative to the time it takes to process a batch.

from batched-fn.

Yevgnen avatar Yevgnen commented on July 25, 2024

Hi, thanks for the suggestion. That helps! I have one more question, how about channel_cap?

from batched-fn.

epwalsh avatar epwalsh commented on July 25, 2024

When you set channel_cap, batched_fn! will internally use a bounded flume channel instead of an unbounded one. As a result, calls to your batched fn might return Error::Full.

One reason you might want to use this feature is to return 503 errors when your server is getting too many requests at once. In particular, set channel_cap to some number greater than max_batch_size and then catch Error::Full in your server code, and return a 503 error when that happens.

from batched-fn.

epwalsh avatar epwalsh commented on July 25, 2024

I realize the documentation about channel_cap has been lacking, so here's this: #19

from batched-fn.

epwalsh avatar epwalsh commented on July 25, 2024

You're welcome!

from batched-fn.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.