~/talk

How to Deploy Machine Learning Inference Code to Production

Talkat PyData NYC 2024 · 2024-11-06..11-08· [machine-learning, devops-and-delivery]
links:none on file
slides:none on file

Code profiling with cProfile finds repeated S3 downloads and 96 per‑sentence model loads, and the pipeline uses torch, SentenceTransformers/E5‑base embeddings and sklearn logistic regression; fixing by pre-download models and caching, offloading writes with FastAPI background task, and batching embeddings so torch and numpy handle matrix ops reduces end‑to‑end latency from ~60s to about 2–3s (≈94–100% speedup). Embedding the whole paragraph is even faster (~2.3s) but hits the model token limit (~512) and changes per‑sentence vs paragraph semantics.

AI-written summary · about

  1. 0:00Optimizing ML inference code
  2. 2:25Fast ML inference motivation
  3. 5:19System design and infrastructure
  4. 7:53Production deployment problems
  5. 10:44Bottlenecks with CProfile
  6. 14:16Model loading and caching
  7. 16:24Removing S3 operations
  8. 18:30Optimizing embedding process
  9. 23:48Parallel processing in PyTorch
  10. 27:05Prediction with vectorized ops
  11. 32:25Memory optimization with NumPy
  12. 33:08Paragraph-level embedding speed
  13. 37:37Key takeaways and strategy
  14. 39:21Requirements and final thoughts
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.