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

IndexError: list index out of range - model_path = os.path.join("./model", os.listdir("model")[1]) - train_qlora.py", line 45 #12

Closed
sardetushar opened this issue Jul 20, 2023 · 6 comments

Comments

@sardetushar
Copy link

sardetushar commented Jul 20, 2023

(dbgpt_hub) tushar@TGL305:~/TextSQL/DB-GPT-Hub$ sh ./scripts/spider_qlora_finetune.sh
100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8659/8659 [12:18<00:00, 11.73it/s]
The raw datasets has been generated

===================================BUG REPORT===================================
Welcome to bitsandbytes. For bug reports, please run

python -m bitsandbytes

 and submit this information together with your error trace to: https://github.com/TimDettmers/bitsandbytes/issues
================================================================================
bin /home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so
/home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/bitsandbytes/cextension.py:34: UserWarning: The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers, 8-bit multiplication, and GPU quantization are unavailable.
  warn("The installed version of bitsandbytes was compiled without GPU support. "
/home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so: undefined symbol: cadam32bit_grad_fp32
CUDA SETUP: Loading binary /home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so...
Traceback (most recent call last):
  File "/home/tushar/TextSQL/DB-GPT-Hub/src/train/train_qlora.py", line 45, in <module>
    model_path = os.path.join("./model", os.listdir("model")[1])
IndexError: list index out of range
./scripts/spider_qlora_finetune.sh: 11: --source_max_len: not found

===================================BUG REPORT===================================
Welcome to bitsandbytes. For bug reports, please run

python -m bitsandbytes

 and submit this information together with your error trace to: https://github.com/TimDettmers/bitsandbytes/issues
================================================================================
bin /home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so
/home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/bitsandbytes/cextension.py:34: UserWarning: The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers, 8-bit multiplication, and GPU quantization are unavailable.
  warn("The installed version of bitsandbytes was compiled without GPU support. "
/home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so: undefined symbol: cadam32bit_grad_fp32
CUDA SETUP: Loading binary /home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so...
Traceback (most recent call last):
  File "/home/tushar/TextSQL/DB-GPT-Hub/src/utils/merge_peft_adapters.py", line 11, in <module>
    model_path = os.path.join("./model", os.listdir("model")[1])
IndexError: list index out of range
(dbgpt_hub) tushar@TGL305:~/TextSQL/DB-GPT-Hub$
@zhanghy-sketchzh
Copy link
Collaborator

This is because your model file could not be found, the path to each model file may be different, you can try changing the index, e.g. model_path = os.path.join(". /model", os.listdir("model")[0]), I know this approach may not be very smart, we may introduce env later to manage model integration.

@sardetushar
Copy link
Author

sardetushar commented Jul 20, 2023

This is because your model file could not be found, the path to each model file may be different, you can try changing the index, e.g. model_path = os.path.join(". /model", os.listdir("model")[0]), I know this approach may not be very smart, we may introduce env later to manage model integration.

This is because your model file could not be found, the path to each model file may be different, you can try changing the index, e.g. model_path = os.path.join(". /model", os.listdir("model")[0]), I know this approach may not be very smart, we may introduce env later to manage model integration.

@zhanghy-sketchzh Thanks, how do we copy models into model directory

Do i have to download this from huggingface

https://huggingface.co/tiiuae/falcon-7b/blob/main/pytorch_model-00002-of-00002.bin and put bin files in model folder ? my model folder is empty

@zhanghy-sketchzh
Copy link
Collaborator

Yes, you can download large models after installing git lfs, this will increase your download speed and download success, for example you can download the vicuna-13b model with this command git clone https://huggingface.co/Tribbiani/vicuna-13b,"Tribbiani/vicuna-13b" is the address of the model in the hf.

This is because your model file could not be found, the path to each model file may be different, you can try changing the index, e.g. model_path = os.path.join(". /model", os.listdir("model")[0]), I know this approach may not be very smart, we may introduce env later to manage model integration.

This is because your model file could not be found, the path to each model file may be different, you can try changing the index, e.g. model_path = os.path.join(". /model", os.listdir("model")[0]), I know this approach may not be very smart, we may introduce env later to manage model integration.

@zhanghy-sketchzh Thanks, how do we copy models into model directory

Do i have to download this from huggingface

https://huggingface.co/tiiuae/falcon-7b/blob/main/pytorch_model-00002-of-00002.bin and put bin files in model folder ? my model folder is empty

Yes, you can download large models after installing git lfs, this will increase your download speed and download success, for example you can download the vicuna-13b model with this command git clone https://huggingface.co/Tribbiani/vicuna-13b,"Tribbiani/vicuna-13b" is the address of the model in the hf.

@sardetushar
Copy link
Author

sardetushar commented Jul 20, 2023

Thanks I will try

@sardetushar
Copy link
Author

sardetushar commented Jul 20, 2023

I got MemoryError @zhanghy-sketchzh and I am running it on CPU, I don't have GPU in my machine.
laptop RAM is 8 GB

Will this work on google colab ?

bin /home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so
/home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/bitsandbytes/cextension.py:34: UserWarning: The installed version of bitsandbytes was compiled without GPU support. 8-bit optimizers, 8-bit multiplication, and GPU quantization are unavailable.
  warn("The installed version of bitsandbytes was compiled without GPU support. "
/home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so: undefined symbol: cadam32bit_grad_fp32
CUDA SETUP: Loading binary /home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so...
loading base model ./model/pytorch_model-00001-of-00002.bin...
Traceback (most recent call last):
  File "/home/tushar/TextSQL/DB-GPT-Hub/src/train/train_qlora.py", line 831, in <module>
    train()
  File "/home/tushar/TextSQL/DB-GPT-Hub/src/train/train_qlora.py", line 667, in train
    model = get_accelerate_model(args, checkpoint_dir)
  File "/home/tushar/TextSQL/DB-GPT-Hub/src/train/train_qlora.py", line 276, in get_accelerate_model
    model = AutoModelForCausalLM.from_pretrained(
  File "/home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 461, in from_pretrained
    config, kwargs = AutoConfig.from_pretrained(
  File "/home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/transformers/models/auto/configuration_auto.py", line 986, in from_pretrained
    config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/transformers/configuration_utils.py", line 617, in get_config_dict
    config_dict, kwargs = cls._get_config_dict(pretrained_model_name_or_path, **kwargs)
  File "/home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/transformers/configuration_utils.py", line 702, in _get_config_dict
    config_dict = cls._dict_from_json_file(resolved_config_file)
  File "/home/tushar/anaconda3/envs/dbgpt_hub/lib/python3.10/site-packages/transformers/configuration_utils.py", line 793, in _dict_from_json_file
    text = reader.read()
MemoryError
./scripts/spider_qlora_finetune.sh: 11: --source_max_len: not found

@zhanghy-sketchzh
Copy link
Collaborator

This project requires a GPU and can work on google colab

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

3 participants