Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

RuntimeError: Could not infer dtype of numpy.int16 #924

Open
Agtiger opened this issue Nov 15, 2024 · 2 comments
Open

RuntimeError: Could not infer dtype of numpy.int16 #924

Agtiger opened this issue Nov 15, 2024 · 2 comments

Comments

@Agtiger
Copy link

Agtiger commented Nov 15, 2024

When I attempted to use the TSC function, I encountered some errors. Could you assist me in resolving these issues?

dls = TSDataLoaders.from_dsets(dsets.train, dsets.valid, bs=[64, 128], batch_tfms=[TSStandardize()], num_workers=0)
Traceback (most recent call last):

Cell In[20], line 1
dls = TSDataLoaders.from_dsets(dsets.train, dsets.valid, bs=[64, 128], batch_tfms=[TSStandardize()], num_workers=0)

File D:\Anaconda\envs\TSAI\lib\site-packages\tsai\data\core.py:916 in from_dsets
loaders = [cls._dl_type(d, bs=b, num_workers=num_workers, batch_tfms=batch_tfms, weights=w, partial_n=n, sampler=s, sort=sort, vocab=vocab, **k)\

File D:\Anaconda\envs\TSAI\lib\site-packages\tsai\data\core.py:916 in
loaders = [cls._dl_type(d, bs=b, num_workers=num_workers, batch_tfms=batch_tfms, weights=w, partial_n=n, sampler=s, sort=sort, vocab=vocab, **k)\

File D:\Anaconda\envs\TSAI\lib\site-packages\tsai\data\core.py:630 in init
super().init(dataset, bs=bs, shuffle=shuffle, drop_last=drop_last, num_workers=num_workers, verbose=verbose, do_setup=do_setup, **kwargs)

File D:\Anaconda\envs\TSAI\lib\site-packages\fastai\data\core.py:77 in init
kwargs[nm].setup(self)

File D:\Anaconda\envs\TSAI\lib\site-packages\fastcore\transform.py:202 in setup
for t in tfms: self.add(t,items, train_setup)

File D:\Anaconda\envs\TSAI\lib\site-packages\fastcore\transform.py:206 in add
for t in ts: t.setup(items, train_setup)

File D:\Anaconda\envs\TSAI\lib\site-packages\fastcore\transform.py:89 in setup
return self.setups(getattr(items, 'train', items) if train_setup else items)

File D:\Anaconda\envs\TSAI\lib\site-packages\fastcore\dispatch.py:122 in call
return f(*args, **kwargs)

File D:\Anaconda\envs\TSAI\lib\site-packages\tsai\data\preprocessing.py:159 in setups
o, *_ = dl.one_batch()

File D:\Anaconda\envs\TSAI\lib\site-packages\fastai\data\load.py:189 in one_batch
with self.fake_l.no_multiproc(): res = first(self)

File D:\Anaconda\envs\TSAI\lib\site-packages\fastcore\basics.py:709 in first
return next(x, None)

File D:\Anaconda\envs\TSAI\lib\site-packages\fastai\data\load.py:129 in iter
for b in _loadersself.fake_l.num_workers==0:

File D:\Anaconda\envs\TSAI\lib\site-packages\torch\utils\data\dataloader.py:631 in next
data = self._next_data()

File D:\Anaconda\envs\TSAI\lib\site-packages\torch\utils\data\dataloader.py:675 in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration

File D:\Anaconda\envs\TSAI\lib\site-packages\torch\utils\data_utils\fetch.py:41 in fetch
data = next(self.dataset_iter)

File D:\Anaconda\envs\TSAI\lib\site-packages\fastai\data\load.py:140 in create_batches
yield from map(self.do_batch, self.chunkify(res))

File D:\Anaconda\envs\TSAI\lib\site-packages\fastai\data\load.py:185 in do_batch
def do_batch(self, b): return self.retain(self.create_batch(self.before_batch(b)), b)

File D:\Anaconda\envs\TSAI\lib\site-packages\tsai\data\core.py:656 in create_batch
return self.dataset[b]

File D:\Anaconda\envs\TSAI\lib\site-packages\tsai\data\core.py:515 in getitem
return tuple([ptl[it] for ptl in self.ptls])

File D:\Anaconda\envs\TSAI\lib\site-packages\tsai\data\core.py:515 in
return tuple([ptl[it] for ptl in self.ptls])

File D:\Anaconda\envs\TSAI\lib\site-packages\fastai\torch_core.py:384 in torch_function
res = super().torch_function(func, types, args, ifnone(kwargs, {}))

File D:\Anaconda\envs\TSAI\lib\site-packages\torch_tensor.py:1418 in torch_function
ret = func(*args, **kwargs)

RuntimeError: Could not infer dtype of numpy.int16

@mPowc
Copy link

mPowc commented Nov 15, 2024 via email

@Qingkali
Copy link

This question has troubled me for a long time. Have you solved it?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants