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

ImportError when using weight_diff.py script #303

Open
SebastianRiquelmeM opened this issue Nov 20, 2023 · 2 comments
Open

ImportError when using weight_diff.py script #303

SebastianRiquelmeM opened this issue Nov 20, 2023 · 2 comments

Comments

@SebastianRiquelmeM
Copy link

SebastianRiquelmeM commented Nov 20, 2023

ImportError when using weight_diff.py script.

Problem Description:

I encountered an ImportError when attempting to execute the weight_diff.py script from the Stanford Alpaca project for applying a weight differential. The command used and the traceback of the error are as follows:

Operating System: Windows 11
Python Version: 3.10

Command:

python .\stanford_alpaca\weight_diff.py recover --path_raw ".\output_hf_7B" --path_diff ".\alpaca-7b-wdiff" --path_tuned ".\alpaca7b_recovered" --device "cuda"

Error:

Traceback (most recent call last):
  File "[project path]\stanford_alpaca\weight_diff.py", line 21, in <module>
    from train import smart_tokenizer_and_embedding_resize
  File "[project path]\stanford_alpaca\train.py", line 22, in <module>
    import utils
  File "[project path]\stanford_alpaca\utils.py", line 13, in <module>
    from openai import openai_object
ImportError: cannot import name 'openai_object' from 'openai' ([Python environment path]\lib\site-packages\openai\__init__.py)
@SebastianRiquelmeM SebastianRiquelmeM changed the title ImportError when using weight_diff.py script in Stanford Alpaca project ImportError when using weight_diff.py script Nov 20, 2023
@boyue-jiang
Copy link

boyue-jiang commented Nov 20, 2023

I encountered the same problem and I guess cuz openai upadte their module. If you only want to recover the weight, you can just delete the code in utils.py that relates to openai.

@gaodexiaozheng
Copy link

I met the same problem, I resolved this by using openai==0.28.0, just like this:pip install openai==0.28.0

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