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

Can't run starchat: fails with AttributeError: module 'global_vars' has no attribute 'gen_config' #75

Open
nathanielastudillo opened this issue May 31, 2023 · 13 comments

Comments

@nathanielastudillo
Copy link

nathanielastudillo commented May 31, 2023

Trying to run starchat and getting an error. The model downloaded but when I click "Confirm", I just get an error.

Update: Also getting this error when trying to download models. Might be an env issue, going to nuke my conda env and try again.

@nathanielastudillo
Copy link
Author

nathanielastudillo commented May 31, 2023

Wiped my conda env, tried to install another model (alpacoom-7b), getting the same error:

AttributeError: module 'global_vars' has no attribute 'gen_config'

@kdubba
Copy link

kdubba commented May 31, 2023

There might be some other error before this. Maybe the model could not be loaded because of memory limits. Could you check the error log?

@sandeepraizada
Copy link

Here is a part of the error detail before the the error. I have made a few changes to the file to run it in Google Colab, bit the error is the same as reported earlier.

File "/usr/local/lib/python3.10/site-packages/transformers/modeling_utils.py", line 2969, in _load_pretrained_model
raise ValueError(
ValueError: The current device_map had weights offloaded to the disk. Please provide an offload_folder for them. Alternatively, make sure you have safetensors installed if the model you are using offers the weights in this format.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 427, in run_predict
output = await app.get_blocks().process_api(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1323, in process_api
result = await self.call_function(
File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1051, in call_function
prediction = await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "/content/LLM-As-Chatbot/app.py", line 218, in move_to_third_view
gen_config = global_vars.gen_config
AttributeError: module 'global_vars' has no attribute 'gen_config'

@deep-diver
Copy link
Owner

what kind of changes have you made?

@deep-diver
Copy link
Owner

also, notice that I make updates very frequently, so please git pull whenever you try

@sandeepraizada
Copy link

I have used Google colab so

  1. used the conda install there
  2. changed the app.py and set shared= True to get a public link.
    however i was not using a GPU.. now with a GPU... here is the second error message
    File "/usr/local/lib/python3.10/site-packages/peft/peft_model.py", line 167, in from_pretrained
    PeftConfig.from_pretrained(model_id, subfolder=kwargs.get("subfolder", None), **kwargs).peft_type
    File "/usr/local/lib/python3.10/site-packages/peft/utils/config.py", line 110, in from_pretrained
    raise ValueError(f"Can't find '{CONFIG_NAME}' at '{pretrained_model_name_or_path}'")
    ValueError: Can't find 'adapter_config.json' at 'LLMs/Alpaca-LoRA-7B-elina'
    Traceback (most recent call last):
    File "/usr/local/lib/python3.10/site-packages/gradio/routes.py", line 427, in run_predict
    output = await app.get_blocks().process_api(
    File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1323, in process_api
    result = await self.call_function(
    File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1051, in call_function
    prediction = await anyio.to_thread.run_sync(
    File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
    File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
    File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
    File "/content/LLM-As-Chatbot/app.py", line 218, in move_to_third_view
    gen_config = global_vars.gen_config
    AttributeError: module 'global_vars' has no attribute 'gen_config'

@deep-diver
Copy link
Owner

I would not recommend to use Colab since the connection is not stable. This error is due to the unstable connection that will eventually be terminated shortly (I don't know why)

@sandeepraizada
Copy link

It works with t5-vicuna though.

@deep-diver
Copy link
Owner

yeah since t5-vicuna is the smallest model which don't take too much time to load up

@sandeepraizada
Copy link

thought as much to try with Vicuna being a smaller model. thanks for your response!

@deep-diver
Copy link
Owner

T5-Vicuna is 3B model, hence :)

@bitsnaps
Copy link

bitsnaps commented Aug 22, 2023

I got the same error when running on Gitpod (the 16Gb container), trying to run on CPU mode, the only changes:

# for torch
pip install torch==2.0.0+cpu torchvision==0.15.1+cpu -f https://download.pytorch.org/whl/torch_stable.html

# for auto-gptq
BUILD_CUDA_EXT=0 pip install auto-gptq 

using Python v3.11.1.

@gavi
Copy link

gavi commented Oct 14, 2023

In my case the download_complete was getting the model_name and model_base with html tags, I cleaned up with the following

    print(f"model_name: {model_name}")
    print(f"model_base: {model_base}")
    model_name = model_name.replace("<h2>","").replace("</h2>","").strip()
    model_base = clean_up(model_base)
    model_ckpt = clean_up(model_ckpt)
    model_gptq = clean_up(model_gptq)
    

The clean_up function is below

def clean_up(model_base):
    pattern = r":\s*(\w+/[\w-]+)"
    match = re.search(pattern, model_base)

    result = match.group(1) if match else model_base
    return result

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

6 participants