-
Notifications
You must be signed in to change notification settings - Fork 675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues saving models with TSMetaDataset Dataloader #317
Comments
Hi @ykim, it seems like a true bug so you won't be able to work around it. It needs to be fixed. I won't be able to work on it though for the next few days. |
Well, the next few days have become > 1yr. In any case, I want to document that I've found a way to fix the issue. Here's the documented solution:
from tsai.data.metadatasets import TSMetaDataset, TSMetaDatasets
vocab = alphabet[:10]
dsets = []
for i in range(3):
size = np.random.randint(50, 150)
X = torch.rand(size, 5, 50)
y = vocab[torch.randint(0, 10, (size,))]
tfms = [None, TSClassification(vocab=vocab)]
dset = TSDatasets(X, y, tfms=tfms)
dsets.append(dset)
metadataset = TSMetaDataset(dsets)
splits = TimeSplitter()(metadataset)
metadatasets = TSMetaDatasets(metadataset, splits=splits)
dls = TSDataLoaders.from_dsets(metadatasets.train, metadatasets.valid)
xb, yb = dls.train.one_batch()
xb, yb
learn = ts_learner(dls, arch="TSTPlus")
learn.fit_one_cycle(1)
learn.export("test.pkl") # this has been fixed now and it should work
vocab = alphabet[:10]
dsets = []
for i in range(2):
size = np.random.randint(50, 150)
X = torch.rand(size, 5, 50)
y = vocab[torch.randint(0, 10, (size,))]
tfms = [None, TSClassification(vocab=vocab)]
dset = TSDatasets(X, y, tfms=tfms)
dsets.append(dset)
metadataset = TSMetaDataset(dsets)
dl = TSDataLoader(metadataset)
learn = load_learner("test.pkl")
learn.get_preds(dl=dl) |
This issue has been fixed in GitHub. The solution will be available in the next pip/ conda release (0.3.6). |
On trying to save a model that uses a dataloader from
TSMetaDatasets(TSMetaDataset)
, I got the following error:After looking around, it looks like #215 is related. Any suggestions on how I can get around this?
The text was updated successfully, but these errors were encountered: