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

Finetuning get: ValueError: not enough values to unpack (expected 2, got 0) in get_modality_length_grouped_indices #109

Open
sc268 opened this issue Aug 22, 2024 · 2 comments

Comments

@sc268
Copy link

sc268 commented Aug 22, 2024

Hi I am encountering an issue during finetuning with the default script
ValueError: not enough values to unpack (expected 2, got 0) in get_modality_length_grouped_indices

Parameter Offload: Total persistent parameters: 1324480 in 540 params
  0%|                                                                                                                          | 0/155 [00:00<?, ?it/s]Traceback (most recent call last):
  File "tinyllava/train/train.py", line 92, in <module>
    train()
  File "tinyllava/train/train.py", line 87, in train
    trainer.train()
  File "/opt/conda/lib/python3.8/site-packages/transformers/trainer.py", line 1624, in train
    return inner_training_loop(
  File "/opt/conda/lib/python3.8/site-packages/transformers/trainer.py", line 1928, in _inner_training_loop
    for step, inputs in enumerate(epoch_iterator):
  File "/opt/conda/lib/python3.8/site-packages/accelerate/data_loader.py", line 451, in __iter__
    dataloader_iter = super().__iter__()
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 438, in __iter__
    return self._get_iterator()
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 386, in _get_iterator
    return _MultiProcessingDataLoaderIter(self)
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1084, in __init__
    self._reset(loader, first_iter=True)
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1117, in _reset
    self._try_put_index()
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1351, in _try_put_index
    index = self._next_index()
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 620, in _next_index
    return next(self._sampler_iter)  # may raise StopIteration
  File "/opt/conda/lib/python3.8/site-packages/torch/utils/data/sampler.py", line 282, in __iter__
    for idx in self.sampler:
  File "/data/TinyLLaVA_Factory/tinyllava/train/tinyllava_trainer.py", line 114, in __iter__
    indices = get_modality_length_grouped_indices(self.lengths, self.batch_size, self.world_size, generator=self.generator)
  File "/data/TinyLLaVA_Factory/tinyllava/train/tinyllava_trainer.py", line 47, in get_modality_length_grouped_indices
    lang_indices, lang_lengths = zip(*[(i, -l) for i, l in enumerate(lengths) if l < 0])
ValueError: not enough values to unpack (expected 2, got 0)
  0%|                                                                                                                          | 0/155 [00:01<?, ?it/s]
[2024-08-22 21:44:17,772] [INFO] [launch.py:315:sigkill_handler] Killing subprocess 9692

which occurs here in the code:
lang_indices, lang_lengths = zip(*[(i, -l) for i, l in enumerate(lengths) if l < 0])
when all lengths > 0, the right side is [] hence unable to unpack.

Any suggestions? Thanks!

@ggcr
Copy link

ggcr commented Aug 22, 2024

Maybe this is related #89

Personally, I fixed it changing some code as seen in the PR 371ef28

@sc268
Copy link
Author

sc268 commented Aug 22, 2024

Thanks @ggcr ! The PR makes sense and resolves the 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

2 participants