local lua_nn_models = {}
-if rspamd_config:has_torch() then
- torch = require "torch"
- torch.setnumthreads(1)
+local conf_section = rspamd_config:get_all_opt("nn_models")
+
+if conf_section then
+ if rspamd_config:has_torch() then
+ torch = require "torch"
+ torch.setnumthreads(1)
+ end
end
if torch then
end
end
end
- local section = rspamd_config:get_all_opt("nn_models")
- if section and type(section) == 'table' then
- for k,v in pairs(section) do
+ if conf_section and type(conf_section) == 'table' then
+ for k,v in pairs(conf_section) do
if not rspamd_config:add_map(v, "nn map " .. k, gen_process_callback(k)) then
rspamd_logger.warnx(rspamd_config, 'cannot load NN map %1', k)
end
end
local rspamd_nn = require "lua_nn"
-rspamd_nn.load_rspamd_nn() -- Load defined models
\ No newline at end of file
+rspamd_nn.load_rspamd_nn() -- Load defined models if any
\ No newline at end of file