alesee / abstractive-text-summarization

PyTorch implementation/experiments on Abstractive Text Summarization using Sequence-to-sequence RNNs and Beyond paper.
https://arxiv.org/abs/1602.06023
148 stars 48 forks source link

fastai.text do not have the ModelData module #1

Open fooSynaptic opened 5 years ago

fooSynaptic commented 5 years ago

hello @alesee , i follow the document of your rep and run the jupyter notebook of abstractive-text-summ.ipynb to create modelData which stick the datasets to a single object. but the fastai.text do not have the ModelData module.

NameError Traceback (most recent call last)

in ----> 1 model_data = ModelData(SAMPLE_DATA_PATH, trn_dl=train_iter_tuple, val_dl=val_iter_tuple) NameError: name 'ModelData' is not defined can you give me some advices to handle this problem? or i need the check the subsequent program and write a function by myself? thank you !
fabrahman commented 5 years ago

I have the same issue as well. Any help would be appreciated

omarsar commented 5 years ago

You may need to manually define the version of the fastai library. I used an older version: 0.7. Good luck! Reach out to me on Twitter (@omarsar0) if you continue with any issues.

makamkkumar commented 5 years ago

Me too having the same issue how to we resolve this in the new version of fastai v1.0.X

fooSynaptic commented 5 years ago

Good luck to you

p-s-vishnu commented 5 years ago

this might help Code link

class ModelData():
    """Encapsulates DataLoaders and Datasets for training, validation, test. Base class for fastai *Data classes."""
    def __init__(self, path, trn_dl, val_dl, test_dl=None):
        self.path,self.trn_dl,self.val_dl,self.test_dl = path,trn_dl,val_dl,test_dl

    @classmethod
    def from_dls(cls, path,trn_dl,val_dl,test_dl=None):
        #trn_dl,val_dl = DataLoader(trn_dl),DataLoader(val_dl)
        #if test_dl: test_dl = DataLoader(test_dl)
        return cls(path, trn_dl, val_dl, test_dl)

    @property
    def is_reg(self): return self.trn_ds.is_reg
    @property
    def is_multi(self): return self.trn_ds.is_multi
    @property
    def trn_ds(self): return self.trn_dl.dataset
    @property
    def val_ds(self): return self.val_dl.dataset
    @property
    def test_ds(self): return self.test_dl.dataset
    @property
    def trn_y(self): return self.trn_ds.y
    @property
    def val_y(self): return self.val_ds.y