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

When I execute train_doc.py I encountered the following issues while working #5

Open
water500ml opened this issue Apr 22, 2024 · 1 comment

Comments

@water500ml
Copy link

Traceback (most recent call last):
File "train_noc.py", line 186, in
for data in train_bar:
File "/home/tuxiangsuo1502/miniconda3/envs/hjl/lib/python3.7/site-packages/tqdm/std.py", line 1178, in iter
for obj in iterable:
File "/home/tuxiangsuo1502/miniconda3/envs/hjl/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 521, in next
data = self._next_data()
File "/home/tuxiangsuo1502/miniconda3/envs/hjl/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
return self._process_data(data)
File "/home/tuxiangsuo1502/miniconda3/envs/hjl/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
data.reraise()
File "/home/tuxiangsuo1502/miniconda3/envs/hjl/lib/python3.7/site-packages/torch/_utils.py", line 434, in reraise
raise exception
KeyError: Caught KeyError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/tuxiangsuo1502/miniconda3/envs/hjl/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/home/tuxiangsuo1502/miniconda3/envs/hjl/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/tuxiangsuo1502/miniconda3/envs/hjl/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/data/txs/hjl/coscvae/modules/data_loader_noc.py", line 263, in getitem
caps = self.inv_annotations[str(image_idx)]
KeyError: "b'262146'"

How can it run normally? Thank you in advance for your reply

@s-mahajan
Copy link
Collaborator

Hi, you might need to convert the byte string to ASCII.
https://stackoverflow.com/questions/6224052/what-is-the-difference-between-a-string-and-a-byte-string

Hope this helps!

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

2 participants