speechbrain/speechbrain

Math Domain Error in Pretraining tutorial.

thedragoncoder opened this issue · 1 comments

Describe the bug

I have been getting math domain error. When I tried to fine tune the existing model using the sb.Brain class, if my modules has any classifiers or models with parameters, I have noticed that this error comes up.
image
I have been referring the pretraining tutorial provided by speechbrain to fine tune my model. When I tried running the same tutorial, the exact error pops up.
image
The only change I have created is
image
as the name of the hparams file was wrong.

Expected behaviour

I think, the error pops up because of exceptions that are not handled properly.

To Reproduce

This is the pretraining notebook
https://colab.research.google.com/drive/1PK3S1_hgKH0H7Eio1HUxa6XLykUfAlnV?usp=sharing#scrollTo=bf1rDbYBeh-7
To make it easier to locate the error, I have created a notebook which only consists of cells that I have executed.
https://colab.research.google.com/drive/1h5kd64eV4b0qnL6hHR35pW71INT5s0Bq?usp=sharing

Environment Details

No response

Relevant Log Output

---------------------------------------------------------------------------

ValueError                                Traceback (most recent call last)

<ipython-input-84-fe2297a0da3e> in <cell line: 1>()
----> 1 brain = EncDecFineTune(modules, hparams=hparams)
      2 # brain.tokenizer = language_id.tokenizer

2 frames

/usr/local/lib/python3.10/dist-packages/speechbrain/utils/logger.py in format_order_of_magnitude(number, abbreviate)
    137     style = ORDERS_ABBREV if abbreviate else ORDERS_WORDS
    138     precision = "{num:3.1f}"
--> 139     order = 3 * math.floor(math.log(math.fabs(number), 1000))
    140     # Fallback for very large numbers:
    141     while order not in style and order != 0:

ValueError: math domain error

Additional Context

No response

Hello, I fixed this issue with PR #2537. Thanks a lot for reporting this bug!