return
end
-local torch = require "torch"
-local nn = require "nn"
local lua_util = require "lua_util"
local ucl = require "ucl"
local logger = require "rspamd_logger"
local argparse = require "argparse"
local rescore_utility = require "rescore_utility"
+-- Load these lazily
+local torch
+local nn
+
local opts
local ignore_symbols = {
['DATE_IN_PAST'] =true,
end
local function handler(args)
+ torch = require "torch"
+ nn = require "nn"
opts = parser:parse(args)
if not opts['log'] then
parser:error('no log specified')
if rspamd_config:has_torch() then
use_torch = true
- torch = require "torch"
- nn = require "nn"
end
-- Module vars
if opts.disable_torch then
use_torch = false
+ else
+ torch = require "torch"
+ nn = require "nn"
end
local id = rspamd_config:register_symbol({
if worker:is_primary_controller() then
-- We also want to train neural nets when they have enough data
rspamd_config:add_periodic(ev_base, 0.0,
- function(_, _)
- return maybe_train_anns(rule, cfg, ev_base, worker)
- end)
+ function(_, _)
+ return maybe_train_anns(rule, cfg, ev_base, worker)
+ end)
end
end)
end