[go: nahoru, domu]

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 while importing peft #82

Closed
vishalghor opened this issue Feb 13, 2023 · 4 comments
Closed

Error while importing peft #82

vishalghor opened this issue Feb 13, 2023 · 4 comments
Labels
solved solved

Comments

@vishalghor
Copy link

I am trying PEFT example with DeepSpeed integration using the shared .py file: [peft_lora_seq2seq_accelerate_ds_zero3_offload.py]
But I am getting an error as below:

Traceback (most recent call last):                                                                                                                                                                                                                                   
  File "/home/vghorpad/LLM/peft_lora_seq2seq_accelerate_ds_zero3_offload.py", line 14, in <module>
    from peft import LoraConfig, TaskType, get_peft_model
  File "/home/vghorpad/LLM/peft_lora_seq2seq_accelerate_ds_zero3_offload.py", line 14, in <module>
    from peft import LoraConfig, TaskType, get_peft_model
ImportError: cannot import name 'LoraConfig' from partially initialized module 'peft' (most likely due to a circular import)

I followed the steps to configure accelerate as per the readme.
Anything that I might be missing out on?

@pacman100
Copy link
Contributor

Hello, I'm unable to reproduce this error with PEFT v0.1.0. Can you provide a minimal reproducible example for this?

  1. I did pip install peft
  2. ran from peft import LoraConfig, TaskType, get_peft_model and it works as expected without any import errors.

@ghorvish
Copy link
ghorvish commented Feb 15, 2023

Hi @pacman100 , I was resolve this by installing peft from source(git). But I am currently facing an error due to deepspeed.

Traceback (most recent call last):
  File "/home/vghorpad/LLM/peft/examples/conditional_generation/peft_lora_seq2seq_accelerate_ds_zero3_offload.py", line 375, in <module>
    main()
  File "/home/vghorpad/LLM/peft/examples/conditional_generation/peft_lora_seq2seq_accelerate_ds_zero3_offload.py", line 253, in main
    model, train_dataloader, eval_dataloader, test_dataloader, optimizer, lr_scheduler = accelerator.prepare(
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/accelerate/accelerator.py", line 943, in prepare
    result = self._prepare_deepspeed(*args)
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/accelerate/accelerator.py", line 1173, in _prepare_deepspeed
    engine, optimizer, _, lr_scheduler = deepspeed.initialize(**kwargs)
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/deepspeed/_init_.py", line 125, in initialize
    engine = DeepSpeedEngine(args=args,
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/deepspeed/runtime/engine.py", line 340, in _init_
    self._configure_optimizer(optimizer, model_parameters)
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/deepspeed/runtime/engine.py", line 1291, in _configure_optimizer
    self.optimizer = self._configure_zero_optimizer(basic_optimizer)
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/deepspeed/runtime/engine.py", line 1594, in _configure_zero_optimizer
    optimizer = DeepSpeedZeroOptimizer_Stage3(
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/deepspeed/runtime/zero/stage3.py", line 131, in _init_
    util_ops = UtilsBuilder().load()
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/deepspeed/ops/op_builder/builder.py", line 462, in load
    return self.jit_load(verbose)
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/deepspeed/ops/op_builder/builder.py", line 497, in jit_load
    op_module = load(
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1284, in load
    return _jit_compile(
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1508, in _jit_compile
    _write_ninja_file_and_build_library(
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1623, in _write_ninja_file_and_build_library
    _run_ninja_build(
  File "/home/vghorpad/LLM/venv_llm/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1916, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension 'utils'

Which is mentioned here - microsoft/DeepSpeed#2187
For the dataset i'm trying to use wikisql instead of twitter_complaints from ought
Is it possible to run this without deepspeed?

@pacman100
Copy link
Contributor

Hello @ghorvish, yes, you can use it without DeepSpeed, just change the accelerate config file to not use it

@pacman100 pacman100 added the solved solved label Feb 24, 2023
@github-actions
Copy link
github-actions bot commented Apr 3, 2023

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

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

No branches or pull requests

3 participants