axa-group / nlp.js

An NLP library for building bots, with entity extraction, sentiment analysis, automatic language identify, and so more

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extremely verbose logging with "Epoch 1 loss 0.132985497437162 time 0ms"

wickedest opened this issue · comments

Describe the bug

When using the nlu, the library emits 418 log messages of the form:

Epoch 1 loss 0.132985497437162 time 0ms
Epoch 418 loss 0.00014440620801799714 time 0ms

There is no way to disable it from configuration that I could find. I created MR #1363 that shows how to disable it permanently. From the MR:

The nlu was configured to log by default. I am pretty sure that it cannot be disabled programmatically because there are no settings passed into it from the nlu. It is also extremely annoying to have these log messages output by default. All I did was disable it, but imo, it should probably be using the configured logger, instead of a console.log. I'd also expect that maybe some settings should be passed into the train().

It is extremely annoying. Please fix.

To Reproduce

		const dock = await dockStart({
			settings: {
				log: false,
				nlp: {
					forceNER: true,
					log: false,
					languages: ['en'],
					corpora: [
						path.join(corpus_root, 'en', 'corpus-en-music.json'),
						path.join(corpus_root, 'en', 'corpus-en.json')
					]
				},
				nlu: {
					log: false
				}
			},
			use: [
				'Basic',
				'Nlp',
			]
		});

		const manager = dock.get('nlp');

		const ner = dock.get('ner');
		const builtin = new BuiltinMicrosoft();
		ner.container.register('extract-builtin-??', builtin);
		await manager.train();

Expected behavior
Verbose logging should not be enabled by default.
Logging should be configurable.

Desktop (please complete the following information):

  • Node version 20

I found this way to deactivate it:

import { containerBootstrap } from "@nlpjs/core";
import { Nlp } from "@nlpjs/nlp";

const container = await containerBootstrap();
const nlp = new Nlp({ 
  languages: ["de"], 
  forceNER: true,

  nlu: { log: false }}, //  is doing the trick
  container);

// then use container as desired 
container.use(LangDe);

Works for me