Skip to content
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

Error on running trainer.py #11

Open
sabuj7177 opened this issue Jun 29, 2021 · 0 comments
Open

Error on running trainer.py #11

sabuj7177 opened this issue Jun 29, 2021 · 0 comments

Comments

@sabuj7177
Copy link

I followed all the commands provided in Getting_Started.md file. Previously i installed all the dependent modules mentioned in install.md file. When i run the trainer.py with necessary arguments, the following error occurs.

Distributed training OFF
Loading model from ../models/CovidAID_transfered.pth.tar
Freezing feature layers
100%|██████████| 115/115.0 [02:07<00:00, 1.11s/it]
0%| | 0/10.0 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/home/sabuj/PycharmProjects/CovidAid/tools/trainer.py", line 438, in
start_epoch=args.start, save_path=args.save, freeze_feature_layers=args.freeze)
File "/home/sabuj/PycharmProjects/CovidAid/tools/trainer.py", line 147, in train
for i, (inputs, target) in tqdm(enumerate(val_loader), total=len(val_dataset)/BATCH_SIZE):
File "/home/sabuj/PycharmProjects/CovidAid/venv/lib/python3.6/site-packages/tqdm/std.py", line 1178, in iter
for obj in iterable:
File "/home/sabuj/PycharmProjects/CovidAid/venv/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 210, in next
return self._process_next_batch(batch)
File "/home/sabuj/PycharmProjects/CovidAid/venv/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 230, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
IndexError: Traceback (most recent call last):
File "/home/sabuj/PycharmProjects/CovidAid/venv/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 42, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/sabuj/PycharmProjects/CovidAid/venv/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 42, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/sabuj/PycharmProjects/CovidAid/tools/read_data.py", line 157, in getitem
image_name = random.choice(self.image_names[class_idx])
File "/usr/lib/python3.6/random.py", line 260, in choice
raise IndexError('Cannot choose from an empty sequence') from None
IndexError: Cannot choose from an empty sequence

Can anyone please suggest what might be causing this issue?

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

No branches or pull requests

1 participant