tsai
tsai copied to clipboard
Incompatible errors or missing functions in 'tutorial_nbs' notebooks, please fix.
Hi tsai Team,
I am trying tutorial_nbs notebooks, found some incompatible errors or missing functions from old versions. Could you please fix them? Thanks in advance.
os : Windows-10-10.0.22000-SP0 python : 3.7.1 tsai : 0.3.0 fastai : 2.5.5 fastcore : 1.4.0 torch : 1.10.2 n_cpus : 16 device : cuda (NVIDIA GeForce RTX 3070 Laptop GPU)
01_Intro_to_Time_Series_Classification.ipynb & 01a_MultiClass_MultiLabel_TSClassification.ipynb
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_24296/116737381.py in <module>
1 learn.load('stage0')
----> 2 learn.lr_find(suggestions=False)
TypeError: lr_find() got an unexpected keyword argument 'suggestions'
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_16800/3105422408.py in <module>
1 #import sklearn.metrics as skm
----> 2 print(f'accuracy: {skm.accuracy_score(test_targets, test_preds):10.6f}')
NameError: name 'skm' is not defined
02_ROCKET_a_new_SOTA_classifier.ipynb:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_20816/191400561.py in <module>
----> 1 kernels = generate_kernels(seq_len, 10000)
2 #Function not found
NameError: name 'generate_kernels' is not defined
04_Intro_to_Time_Series_Regression.ipynb:
_check_X() got an unexpected keyword argument 'coerce_to_numpy'
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_12204/4085362151.py in <module>
2 X, y, splits = get_regression_data(dsid, split_data=False, timeout=3000)
3 print(X, y)
----> 4 X.shape, y.shape, y[:10]
AttributeError: 'NoneType' object has no attribute 'shape'
05_TS_archs_comparison.ipynb:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_23896/3131484160.py in <module>
21 elapsed = time.time() - start
22 vals = learn.recorder.values[-1]
---> 23 results.loc[i] = [arch.__name__, k, total_params(model)[0], vals[0], vals[1], vals[2], int(elapsed)]
24 results.sort_values(by='accuracy', ascending=False, ignore_index=True, inplace=True)
25 clear_output()
NameError: name 'total_params' is not defined
06_TS_to_image_classification.ipynb:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_2800/3827028249.py in <module>
1 model = create_model(InceptionTime, dls=dls)
----> 2 learn = Learner(dls, model, metrics=accuracy, cbs=ShowGraphCallback())
3 start = time.time()
4 learn.fit_one_cycle(epochs, lr_max=1e-3)
5 print(f"\ntraining time: {time.strftime('%H:%M:%S', time.gmtime(time.time() - start))}")
NameError: name 'ShowGraphCallback' is not defined
08_Self_Supervised_TSBERT.ipynb:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_14364/776664521.py in <module>
4 _result = []
5 for i in range(n_tests):
----> 6 clear_output()
7 if i > 0: print(f'{i}/{n_tests} accuracy: {np.mean(_result):.3f} +/- {np.std(_result):.3f}')
8 else: print(f'{i}/{n_tests}')
NameError: name 'clear_output' is not defined
09_PredictionDynamics.ipynb:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_17188/2271105178.py in <module>
----> 1 X, y, splits = get_Monash_data('AppliancesEnergy', split_data=False)
2 tfms=[None, TSRegression()]
3 batch_tfms = TSStandardize(by_sample=True, by_var=True)
4 dls = get_ts_dls(X,y,splits=splits,tfms=tfms, batch_tfms=batch_tfms)
5 learn = ts_learner(dls, TSTPlus, n_heads=6, metrics=[mae, rmse], cbs=[ShowGraph(), PredictionDynamics(alpha=.5, size=75)])
NameError: name 'get_Monash_data' is not defined
10_Time_Series_Classification_and_Regression_with_MiniRocket.ipynb:
---------------------------------------------------------------------------
_RemoteTraceback Traceback (most recent call last)
_RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\joblib\externals\loky\process_executor.py", line 407, in _process_worker
call_item = call_queue.get(block=True, timeout=timeout)
File "C:\Anaconda3\lib\multiprocessing\queues.py", line 113, in get
return _ForkingPickler.loads(res)
File "C:\Anaconda3\lib\site-packages\tsai\models\MINIROCKET.py", line 18, in <module>
from ..imports import *
File "C:\Anaconda3\lib\site-packages\tsai\imports.py", line 20, in <module>
import torch
File "C:\Anaconda3\lib\site-packages\torch\__init__.py", line 124, in <module>
raise err
OSError: [WinError 1455] 页面文件太小,无法完成操作。 Error loading "C:\Anaconda3\lib\site-packages\torch\lib\caffe2_detectron_ops_gpu.dll" or one of its dependencies.
"""
The above exception was the direct cause of the following exception:
BrokenProcessPool Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_21584/1297924585.py in <module>
4 model = MiniRocketVotingClassifier(n_estimators=5)
5 timer.start(False)
----> 6 model.fit(X_train, y_train)
7 t = timer.stop()
8 print(f'valid accuracy : {model.score(X_valid, y_valid):.3%} time: {t}')
C:\Anaconda3\lib\site-packages\sklearn\ensemble\_voting.py in fit(self, X, y, sample_weight)
322 transformed_y = self.le_.transform(y)
323
--> 324 return super().fit(X, transformed_y, sample_weight)
325
326 def predict(self, X):
C:\Anaconda3\lib\site-packages\sklearn\ensemble\_voting.py in fit(self, X, y, sample_weight)
81 message=self._log_message(names[idx], idx + 1, len(clfs)),
82 )
---> 83 for idx, clf in enumerate(clfs)
84 if clf != "drop"
85 )
C:\Anaconda3\lib\site-packages\joblib\parallel.py in __call__(self, iterable)
1054
1055 with self._backend.retrieval_context():
-> 1056 self.retrieve()
1057 # Make sure that we get a last message telling us we are done
1058 elapsed_time = time.time() - self._start_time
C:\Anaconda3\lib\site-packages\joblib\parallel.py in retrieve(self)
933 try:
934 if getattr(self._backend, 'supports_timeout', False):
--> 935 self._output.extend(job.get(timeout=self.timeout))
936 else:
937 self._output.extend(job.get())
C:\Anaconda3\lib\site-packages\joblib\_parallel_backends.py in wrap_future_result(future, timeout)
540 AsyncResults.get from multiprocessing."""
541 try:
--> 542 return future.result(timeout=timeout)
543 except CfTimeoutError as e:
544 raise TimeoutError from e
C:\Anaconda3\lib\concurrent\futures\_base.py in result(self, timeout)
430 raise CancelledError()
431 elif self._state == FINISHED:
--> 432 return self.__get_result()
433 else:
434 raise TimeoutError()
C:\Anaconda3\lib\concurrent\futures\_base.py in __get_result(self)
382 def __get_result(self):
383 if self._exception:
--> 384 raise self._exception
385 else:
386 return self._result
BrokenProcessPool: A task has failed to un-serialize. Please ensure that the arguments of the function are all picklable.
12_Experiment_tracking_with_W&B.ipynb:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_1116/2777458463.py in <module>
1 from tsai.all import *
----> 2 from fastai.callback.wandb import *
3 import wandb
4 my_setup(wandb)
C:\Anaconda3\lib\site-packages\fastai\callback\wandb.py in <module>
6 from ..basics import *
7 from .progress import *
----> 8 from ..text.data import TensorText
9 from ..tabular.all import TabularDataLoaders, Tabular
10 from .hook import total_params
C:\Anaconda3\lib\site-packages\fastai\text\data.py in <module>
7 from ..torch_basics import *
8 from ..data.all import *
----> 9 from .core import *
10
11 # Cell
C:\Anaconda3\lib\site-packages\fastai\text\core.py in <module>
13
14 # Cell
---> 15 import spacy,html
16 from spacy.symbols import ORTH
17
C:\Anaconda3\lib\site-packages\spacy\__init__.py in <module>
12 from thinc.api import Config
13
---> 14 from . import pipeline # noqa: F401
15 from .cli.info import info # noqa: F401
16 from .glossary import explain # noqa: F401
C:\Anaconda3\lib\site-packages\spacy\pipeline\__init__.py in <module>
----> 1 from .attributeruler import AttributeRuler
2 from .dep_parser import DependencyParser
3 from .entity_linker import EntityLinker
4 from .ner import EntityRecognizer
5 from .entityruler import EntityRuler
C:\Anaconda3\lib\site-packages\spacy\pipeline\attributeruler.py in <module>
4 from pathlib import Path
5
----> 6 from .pipe import Pipe
7 from ..errors import Errors
8 from ..training import Example
C:\Anaconda3\lib\site-packages\spacy\pipeline\pipe.pyx in init spacy.pipeline.pipe()
C:\Anaconda3\lib\site-packages\spacy\strings.pyx in init spacy.strings()
C:\Anaconda3\lib\site-packages\spacy\util.py in <module>
1592 proc: "Pipe",
1593 name: str,
-> 1594 default_error_handler: Callable[[str, "Pipe", List["Doc"], Exception], NoReturn],
1595 kwargs: Mapping[str, Any],
1596 ) -> Iterator["Doc"]:
C:\Anaconda3\lib\typing.py in __getitem__(self, params)
753 f" Got {args}")
754 params = (tuple(args), result)
--> 755 return self.__getitem_inner__(params)
756
757 @_tp_cache
C:\Anaconda3\lib\typing.py in inner(*args, **kwds)
249 except TypeError:
250 pass # All real errors (not unhashable args) are raised below.
--> 251 return func(*args, **kwds)
252 return inner
253
C:\Anaconda3\lib\typing.py in __getitem_inner__(self, params)
772 args, result = params
773 msg = "Callable[args, result]: result must be a type."
--> 774 result = _type_check(result, msg)
775 if args is Ellipsis:
776 return self.copy_with((_TypingEllipsis, result))
C:\Anaconda3\lib\typing.py in _type_check(arg, msg, is_argument)
133 if (isinstance(arg, _SpecialForm) and arg is not Any or
134 arg in (Generic, _Protocol)):
--> 135 raise TypeError(f"Plain {arg} is not valid as type argument")
136 if isinstance(arg, (type, TypeVar, ForwardRef)):
137 return arg
TypeError: Plain typing.NoReturn is not valid as type argument
Thanks for taking the time to review the nbs and submit the bugs. I'll try to fix them within the next few days.
Great catches @forhonourlx , I was coming here to report a couple of these but you've captured way more than I did.
Yes thank you @forhonourlx for the great catches. I was also coming here to report some of the bugs. I haven't used tsai in 8 months and just upgraded to v0.3.2. and some of my existing code broke so I went to the tutorials to learn how to fix the problems but they showed up there as well. One other thing I noticed is that the GPU is not being accessed even though it is present and the device is reported as 'cuda'.
is this fixed? I got this error when using ROCKET
NameError: name 'generate_kernels' is not defined
still getting NameError: name 'generate_kernels' is not defined in NB1: TypeError: lr_find() got an unexpected keyword argument 'suggestions', NameError: name 'skm' is not defined
is this fixed? I got this error when using ROCKET
NameError: name 'generate_kernels' is not defined
same bugs occured