timeseriesAI / tsai

Time series Timeseries Deep Learning Machine Learning Python Pytorch fastai | State-of-the-art Deep Learning library for Time Series and Sequences in Pytorch / fastai
https://timeseriesai.github.io/tsai/
Apache License 2.0
5.15k stars 643 forks source link

`get_best_dls_params` function still prints output when the verbose parameter is set to false #737

Closed leiyue closed 1 year ago

leiyue commented 1 year ago

get_best_dls_params function still prints output when the verbose parameter is set to false. I made a little tweak, hope that helps.

def get_best_dls_params(dls, n_iters=10, num_workers=[0, 1, 2, 4, 8], pin_memory=[True, False], prefetch_factor=[2, 4, 8], return_best=True, verbose=True):

    for i in range(len(dls.loaders)):
        try:
            if verbose:
                print(f'\nDataloader {i}\n')
            dls.loaders[i] = get_best_dl_params(dls.loaders[i], n_iters=n_iters, num_workers=num_workers, pin_memory=pin_memory, prefetch_factor=prefetch_factor, return_best=return_best, verbose=verbose)
        except KeyboardInterrupt: pass
    return dls
oguiza commented 1 year ago

Hi @leiyue, You are right. I verbose is set to False, nothing should be printed. That was a miss. Would you like to create a PR to fix this issue?

oguiza commented 1 year ago

This issue is fixed now.