dmlc / MXNet.jl

MXNet Julia Package - flexible and efficient deep learning in Julia

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UndefVarError when providing KVStore object to mx.fit

holl- opened this issue · comments

commented

I'm trying to train one model by invoking mx.fit multiple times. To reduce overhead, I'm creating my KV store beforehand and passing it to the fit method.

    kvstore = mx.KVStore(:device)
    mx.fit(n.model, optimizer, train_provider,
           n_epoch=1,
           eval_metric=metric,
           callbacks=[training_curve],
           verbosity=0,
           kvstore=kvstore)

The fit method then throws an error saying:

UndefVarError: update_on_kvstore not defined

This seems to be a bug in mx.fit where the local variable update_on_kvstore is only created when a Symbol is passed, not a KVStore.

From model.jl

  # setup kvstore
  kvstore = opts.kvstore
  if isa(kvstore, Base.Symbol)
    opts.verbosity >= 2 && info("Creating KVStore...")
    kvstore, update_on_kvstore = _create_kvstore(kvstore, length(self.ctx), self.arg_params)
  end

Thanks for reporting the issue. I am bit short on time, would you mind opening a PR?

commented

I've created a pull request: #247