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: cannot unpack non-iterable ActionTypeHint object #1931

Open
pvaldivia4 opened this issue Jan 31, 2025 · 4 comments
Open

error: cannot unpack non-iterable ActionTypeHint object #1931

pvaldivia4 opened this issue Jan 31, 2025 · 4 comments
Labels
bug Something isn't working

Comments

@pvaldivia4
Copy link

pvaldivia4 commented Jan 31, 2025

Bug description

Dear Lightning,

I'm attempting to follow a medium tutorial using my own dataset. I have downgraded lightning due to a suggestion on issue #1915. On step 3 of the tutorial, the fine-tuning step using litgpt, I receive the message "error: cannot unpack non-iterable ActionTypeHint object".

I am on Version 0.5.7 of litgpt and have train.json as well as the checkpoints/mistralai/Mistral-7B-Instruct-v0.3 folders in my working directory

Thus far, I have tried:

  • Reading the finetune_lora readme
  • installing litgpt[all] as suggested in your documentation, since the medium article only installed litgpt
  • modifying the command in the medium article according to the documentation i.e. using: litgpt finetune_lora checkpoints/mistralai/Mistral-7B-Instruct-v0.3 --data JSON --data.json_path train.json --data.val_split_fraction 0.2 --out_dir out/custom-model
  • Creating the output directories [either finetuned (medium article), or out/custom-model (documentation)] ahead of running the commands

Appreciate any help that you can provide.

What operating system are you using?

Linux

LitGPT Version

Version: 0.5.7
@pvaldivia4 pvaldivia4 added the bug Something isn't working label Jan 31, 2025
@syntheticgio
Copy link
Contributor

syntheticgio commented Feb 16, 2025

Fwiw, I'm seeing the same thing on a fresh install of litgpt. Also trying to follow the tutorial. Same version. I'm going to see if I can downgrade and try again

Going back to 3.1 I'm still seeing it (for finetune, not finetune_lora since that wasn't an option there).

litgpt finetune_lora stabilityai/stablelm-base-alpha-3b --data Alpaca
Does work, something to do with the data. I've tried the same as the OP with the data file being what was shown in the tutorial here: https://github.com/Lightning-AI/litgpt/blob/main/tutorials/finetune_lora.md#tune-on-your-dataset

data file:
[
{
"instruction": "Arrange the given numbers in ascending order.",
"input": "2, 4, 0, 8, 3",
"output": "0, 2, 3, 4, 8"
}
]

@syntheticgio
Copy link
Contributor

This appears to be something related to jsonargparse library - as far as I can tell nothing is wrong in the code although I'm not familiar with this particular parser; I'm going to try a different version of python; I'm using 3.12 currently.

@syntheticgio
Copy link
Contributor

@pvaldivia4 changing to using python3.10 worked for me, I think jsonargparse needs to be updated to work with 3.12 (maybe also 3.11, not sure which one broke it).

Assuming you have python3.10 installed:
python3.10 -m venv venv
source venv/bin/activate
pip install -e '.[all]' (you could probably install the regular pip install litgpt[all] but this is what I did.

I also created a directory for the data files, and created two files in there - train.json and val.json; for the --data.json_path I pointed to that directory. You can do it with a file, I think, but you might have to specify val_split_fraction if you do it that way.

If I see a version of jsonargparse that is compatible with python3.12, I'll open a PR.

@syntheticgio
Copy link
Contributor

@pvaldivia4 if you can't downgrade or install a different python version, I've made a branch that should work https://github.com/syntheticgio/litgpt/tree/add-compatibility-for-python3.10%2B

python -m venv venv
source venv/bin/activate
pip install -e '.[all]'

I'll make a PR request, but not sure what the maintainer's process is for accepting those or if they are willing to try to support python3.12 (its possible other things break that I don't even know to test).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants