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

The training information was not printed #725

Closed Loccret closed 1 year ago

Loccret commented 1 year ago

Description

I am trying to run the 01_Intro_to_Time_Series_Classification.ipynb notebook in VS Code. The training process seems to be fine, but no training information is being printed.

Environment

os : Linux-5.4.0-100-generic-x86_64-with-glibc2.31 python : 3.10.9 tsai : 0.3.4 fastai : 2.7.10 fastcore : 1.5.28 torch : 1.13.1 device : 2 gpus (['NVIDIA A100-PCIE-40GB', 'NVIDIA A100-PCIE-40GB']) cpu cores : 48 threads per cpu : 2 RAM : 93.76 GB GPU memory : [40.0, 40.0] GB VSCODE : 1.76.2

Steps to reproduce

from tsai.all import *
import sklearn.metrics as skm

dsid = 'NATOPS' 
X, y, splits = get_UCR_data(dsid, return_split=False)
X_train, y_train, X_test, y_test  = get_UCR_data(dsid, return_split=True)
X, y, splits = combine_split_data([X_train, X_test], [y_train, y_test])
tfms  = [None, [Categorize()]]
dsets = TSDatasets(X, y, tfms=tfms, splits=splits, inplace=True)
dls = TSDataLoaders.from_dsets(dsets.train, dsets.valid, 
                        bs=[64, 128], batch_tfms=[TSStandardize()], num_workers=0)

model = InceptionTime(dls.vars, dls.c)
learn = Learner(dls, model, metrics=accuracy)
learn.fit_one_cycle(25, lr_max=1e-3)

There is nothing printed. image

Additional context

The expected result is: image

oguiza commented 1 year ago

Hi @Loccret , There is a related open issue logged for fastai: fit_one_cycle output not visible in PyCharm Could you please run this fastai code and check if the issue persists?

from fastai.vision.all import *
path = untar_data(URLs.PETS)/'images'
def is_cat(x): return x[0].isupper() 
dls = ImageDataLoaders.from_name_func('.',
    get_image_files(path), valid_pct=0.2, seed=42,
    label_func=is_cat,
    item_tfms=Resize(192))
learn = vision_learner(dls, resnet18, metrics=error_rate)

If it doesn't we should log an issue with fastai. If it does run please, let me know. It might then be a tsai issue (I don't think it is).

In the meantime, I'd propose you pass cbs=ShowGraph() to the Learner so you can at least see a chart plotted. That seems to print correctly.

Loccret commented 1 year ago

Hi, @oguiza, Thank you for your great work.

  1. This issue still persists when I run this fastai code. image

  2. I suspect that this issue may be related to VS Code, as I did not encounter this problem when running the code in browser.

    from tsai.all import *
    import sklearn.metrics as skm
    my_setup()

    os : Windows-10-10.0.19044-SP0 python : 3.10.8 tsai : 0.3.4 fastai : 2.7.10 fastcore : 1.5.27 torch : 1.13.1 device : 1 gpu (['NVIDIA GeForce GTX 980 Ti']) cpu cores : 4 threads per cpu : 2 RAM : 31.94 GB GPU memory : [6.0] GB

image

But it appeared when I used VS Code. image

oguiza commented 1 year ago

I'm sorry, there was a line missing in the fastai code snippet I sent you before:

from fastai.vision.all import *
path = untar_data(URLs.PETS)/'images'
def is_cat(x): return x[0].isupper() 
dls = ImageDataLoaders.from_name_func('.',
    get_image_files(path), valid_pct=0.2, seed=42,
    label_func=is_cat,
    item_tfms=Resize(192))
learn = vision_learner(dls, resnet18, metrics=error_rate)
learn.fit_one_cycle(1, 1e-3) # <-- this line was missing!!

It'd be good to retry it again to check if the issue is in the fastai/ VSCode or tsai/VSCode integration. If the former, there's nothing I can do (but it'd be good to log a new issue with fastai).

Loccret commented 1 year ago

This issue still persists. image Thank you @oguiza. I will log a new issue with fastai.