GithubHelp home page GithubHelp logo

problems when training about im2vec HOT 8 CLOSED

preddy5 avatar preddy5 commented on August 22, 2024
problems when training

from im2vec.

Comments (8)

preddy5 avatar preddy5 commented on August 22, 2024

Hey @CQNing
Which pytorch-lighting version are you using?

from im2vec.

CQNing avatar CQNing commented on August 22, 2024

Hey @CQNing
Which pytorch-lighting version are you using?

Here are what I use now:
pytorch-lightning 1.4.2
torch 1.8.0
python 3.7.10

from im2vec.

preddy5 avatar preddy5 commented on August 22, 2024

could try training with pytorch-lightning version 0.9.0

from im2vec.

CQNing avatar CQNing commented on August 22, 2024

could try training with pytorch-lightning version 0.9.0

I tried this command: conda install pytorch-lightning=0.9.0 -c conda-forge
but the pytorch-lightning version changed into 0.8.5
and command:CUDA_VISIBLE_DEVICES=1 python run.py -c configs/emoji.yaml

Traceback (most recent call last):
File "run.py", line 117, in
runner.fit(experiment)
File ".../lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1044, in fit
results = self.run_pretrain_routine(model)
File ".../lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1185, in run_pretrain_routine
self.reset_val_dataloader(ref_model)
File ".../lib/python3.7/site-packages/pytorch_lightning/trainer/data_loading.py", line 343, in reset_val_dataloader
self.num_val_batches, self.val_dataloaders = self._reset_eval_dataloader(model, 'val')
File ".../lib/python3.7/site-packages/pytorch_lightning/trainer/data_loading.py", line 303, in _reset_eval_dataloader
num_batches = len(dataloader) if _has_len(dataloader) else float('inf')
File ".../lib/python3.7/site-packages/pytorch_lightning/trainer/data_loading.py", line 58, in _has_len
raise ValueError('Dataloader returned 0 length.'
ValueError: Dataloader returned 0 length. Please make sure that your Dataloader at least returns 1 batch

from im2vec.

CQNing avatar CQNing commented on August 22, 2024

I tried this: pip install pytorch-lightning==0.9.0
and the pytorch-lightning version changed into 0.9.0
but it still came out those problems:

Traceback (most recent call last):
File "run.py", line 117, in
runner.fit(experiment)
File ".../lib/python3.7/site-packages/pytorch_lightning/trainer/states.py", line 48, in wrapped_fn
result = fn(self, *args, **kwargs)
File ".../lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1084, in fit
results = self.accelerator_backend.train(model)
File ".../lib/python3.7/site-packages/pytorch_lightning/accelerators/cpu_backend.py", line 39, in train
results = self.trainer.run_pretrain_routine(model)
File ".../lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1224, in run_pretrain_routine
self._run_sanity_check(ref_model, model)
File ".../lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1249, in _run_sanity_check
self.reset_val_dataloader(ref_model)
File ".../lib/python3.7/site-packages/pytorch_lightning/trainer/data_loading.py", line 337, in reset_val_dataloader
self.num_val_batches, self.val_dataloaders = self._reset_eval_dataloader(model, 'val')
File ".../lib/python3.7/site-packages/pytorch_lightning/trainer/data_loading.py", line 299, in _reset_eval_dataloader
num_batches = len(dataloader) if _has_len(dataloader) else float('inf')
File ".../lib/python3.7/site-packages/pytorch_lightning/trainer/data_loading.py", line 70, in _has_len
raise ValueError('Dataloader returned 0 length.'
ValueError: Dataloader returned 0 length. Please make sure that your Dataloader at least returns 1 batch

from im2vec.

preddy5 avatar preddy5 commented on August 22, 2024

Hey @CQNing
Sorry for the late reply completely slipped my mind.

Could you try
os.path.exists(self.params['data_path'])

here https://github.com/preddy5/Im2Vec/blob/master/experiment.py#L320 that should tell us if the folder is present or not.
If the output is true then torchvision datasets seems to have a bug and you can use the MyDataset object present in the experiment file.

from im2vec.

CQNing avatar CQNing commented on August 22, 2024

Hi, @preddy5
I‘ve solved this problem. And I feel so shame that this occurs because my carelessness.
self.sample_dataloader = DataLoader(dataset,
batch_size= 64, ###############
shuffle = False,
drop_last=True)
When I tried to train my dataset at first, I reduced the batch_size in emoji.yaml. And I didn't change the batch_size in DataLoader(). Emmm.... Sorry to bother you!

from im2vec.

preddy5 avatar preddy5 commented on August 22, 2024

I am glad you figured it out.

from im2vec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.