pythonlessons / mltu

Machine Learning Training Utilities (for TensorFlow and PyTorch)
MIT License
160 stars 100 forks source link

I have issue with model.fit class NoneType #13

Closed dtanhphuong1189 closed 1 year ago

dtanhphuong1189 commented 1 year ago

Hi, thanks a lot for helping me, I'm really struggling with this homework.

I'm running my code on my laptop. I am using your dataset in the Tutorial in 5. Speech to text. here are some of details of my implementation:

training code in google colab: https://drive.google.com/file/d/1UGk49m0qeAb8XMEFCeJq6n8hOEvfg_da/view?usp=sharing training code in laptop: https://drive.google.com/file/d/1OxuDo-rvNJM2j5kjUMdJpqKk1YpCT5CB/view?usp=drive_link I uploaded the dataset provided by my professor and the mltu just update today

All cells can run without encountering any errors until the last cell:

model.fit( train_data_provider, validation_data=val_data_provider, epochs=configs.train_epochs, callbacks=[earlystopper, checkpoint, trainLogger, reduceLROnPlat, tb_callback, model2onnx], workers=configs.train_workers )

where the error popped up: ValueError: Failed to find data adapter that can handle input: <class 'mltu.torch.dataProvider.DataProvider'>, <class 'NoneType'>

If you need any other details of my implementation to find out what caused the error, please let me know. I really appreciate the help.

pythonlessons commented 1 year ago

Hi, saw your comment on another issue, I'll review it later, but <class 'NoneType'> means you are feeding None as label, so there will be some issue with your preprocessing of data

dtanhphuong1189 commented 1 year ago

I updated my code. In my local I change some line in dataProvider.py

Validate dataset

self._dataset = self.validate(dataset)

if not skip_validation:

#self._dataset = self.validate(dataset)

else:

#self.logger.info("Skipping Dataset validation...")
it shows "Validating Dataset". I think it is ok. In the colab, i cannot change it, I think it show error

I double check train_data_provider._dataset and val_data_provider._dataset, it has data Although, there doesnt have any error when running in local, my model.fit still has error

dtanhphuong1189 commented 1 year ago

@pythonlessons Do you have any update for my issue. Please, I need your help

pythonlessons commented 1 year ago

Hi, you need to be more attentive when you refactor code and write it your self. You are using from mltu.torch.dataProvider import DataProvider when you should use from mltu.tensorflow.dataProvider import DataProvider with TensorFlow

pythonlessons commented 1 year ago

I assume its solved