Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Commit

Permalink
Dump training options with DEBUG level
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumekln committed Apr 5, 2017
1 parent 4a7ed02 commit 45ccbef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions onmt/utils/ExtendedCmdLine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,26 @@ function ExtendedCmdLine:loadConfig(filename, opt)
return opt
end

function ExtendedCmdLine:logConfig(opt)
local keys = {}
for key in pairs(opt) do
table.insert(keys, key)
end

table.sort(keys)
_G.logger:debug('Options:')

for _, key in ipairs(keys) do
if key:sub(1, 1) ~= '_' then
local val = opt[key]
if type(val) == 'string' then
val = '\'' .. val .. '\''
end
_G.logger:debug(' * ' .. key .. ' = ' .. tostring(val))
end
end
end

function ExtendedCmdLine:dumpConfig(opt, filename)
local file = assert(io.open(filename, 'w'))

Expand Down
2 changes: 2 additions & 0 deletions train.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ local function main()
local checkpoint, paramChanges
checkpoint, opt, paramChanges = onmt.train.Checkpoint.loadFromCheckpoint(opt)

cmd:logConfig(opt)

_G.logger:info('Training '..modelClass.modelName()..' model')

-- Create the data loader class.
Expand Down

0 comments on commit 45ccbef

Please sign in to comment.