<commit_before>------------------------------------------------------------------------
--[[ NLL ]]--
-- Loss subclass
-- Adapter of nn.ClassNLLCriterion
-- Negative Log Likelihood 
------------------------------------------------------------------------
local NLL, parent = torch.class("dp.NLL", "dp.Loss")
NLL.isNLL = true

function NLL:__init(config)
   self._criterion = nn.ClassNLLCriterion()
   config = config or {}
   config.target_type = config.target_type or 'torch.IntTensor'
   config.target_view = 'b'
   config.input_view = 'bf'
   parent.__init(self, config)
end

function NLL:_type(type)
   if type == 'torch.FloatTensor' or type == 'torch.DoubleTensor' then
      self._input_type = type
      self._criterion:type(type)
   elseif type == 'torch.IntTensor' or type == 'torch.LongTensor' then
      self._output_type = type
   end
end
<commit_msg>NLL should set sizeAverage=false in nn.ClassNLLCriterion, to avoid reporting too small losses<commit_after>------------------------------------------------------------------------
--[[ NLL ]]--
-- Loss subclass
-- Adapter of nn.ClassNLLCriterion
-- Negative Log Likelihood
------------------------------------------------------------------------
local NLL, parent = torch.class("dp.NLL", "dp.Loss")
NLL.isNLL = true

function NLL:__init(config)
   self._criterion = nn.ClassNLLCriterion()
   self._criterion.sizeAverage = false
   config = config or {}
   config.target_type = config.target_type or 'torch.IntTensor'
   config.target_view = 'b'
   config.input_view = 'bf'
   parent.__init(self, config)
end

function NLL:_type(type)
   if type == 'torch.FloatTensor' or type == 'torch.DoubleTensor' then
      self._input_type = type
      self._criterion:type(type)
   elseif type == 'torch.IntTensor' or type == 'torch.LongTensor' then
      self._output_type = type
   end
end

{'fraction_non_alphanumeric': 0.2592190889370933, 'fraction_numerical': 0.0, 'mean_word_length': 1.9758064516129032, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6558044', 'n_tokens_mistral': 530, 'n_tokens_neox': 532, 'n_words': 129}