Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Reuse executor for repeated prediction with different checkpoints

Open
#84 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
julia

Research direction

Start with the mx.predict path and the arch.pred_exec lifecycle shown in the issue. Trace how the executor is created and finalized when arch.arg_params and arch.aux_params change; done means repeated checkpoint predictions reuse the executor without the explicit finalization workaround or the reported memory growth.

Written by the indexing model from the issue text.

Description

Testing the different checkpoints of a training run requires loading checkpoints and predictions runs in a tight loop.

net = mx.load(archfile, mx.SymbolicNode)
arch = mx.FeedForward(net, context=mx.gpu())

data = ...

for wfile in weights
  saved_dict = mx.load(wfile, mx.NDArray)
  arg_params = Dict{Base.Symbol, mx.NDArray}()
  aux_params = Dict{Base.Symbol, mx.NDArray}()
  for (k,v) in saved_dict
    tp, name = split(string(k), ':')
    name = symbol(name)
    if tp == "arg"
      arg_params[name] = v
    else
      aux_params[name] = v
    end
  end

  arch.arg_params = arg_params
  arch.aux_params = aux_params

  pred = mx.predict(arch, data)
  # For memory reclaim, eagerly finalize self.pred_exec.handle
  finalize(arch.pred_exec.handle)
  arch.pred_exec=nothing
end

Without these final two lines this easily runs out of memory for big models/batch_sizes, because the executor is not gc'd yet and we are creating a new one asking for more memory.

If we could reuse the previous executor that problem would be alleviated.

Dominant language
No language data
Stars
370
Forks
63
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dmlc/MXNet.jl

All issues in dmlc/MXNet.jl

Similar issues

More Machine Learning issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.