Skip to content

RuntimeError: Numpy is not available #30

@halegreen

Description

@halegreen

System Info / 系統信息

Traceback (most recent call last):
  File "/Users/shaw/workspace/CharacterGLM-6B/new_env/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling
    result = func()
             ^^^^^^
  File "/Users/shaw/workspace/CharacterGLM-6B/new_env/lib/python3.12/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 590, in code_to_exec
    exec(code, module.__dict__)
  File "/Users/shaw/workspace/CharacterGLM-6B/basic_demo/web_demo_streamlit.py", line 42, in <module>
    tokenizer, model = get_model()
                       ^^^^^^^^^^^
  File "/Users/shaw/workspace/CharacterGLM-6B/new_env/lib/python3.12/site-packages/streamlit/runtime/caching/cache_utils.py", line 210, in __call__
    return self._get_or_create_cached_value(args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/shaw/workspace/CharacterGLM-6B/new_env/lib/python3.12/site-packages/streamlit/runtime/caching/cache_utils.py", line 235, in _get_or_create_cached_value
    return self._handle_cache_miss(cache, value_key, func_args, func_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/shaw/workspace/CharacterGLM-6B/new_env/lib/python3.12/site-packages/streamlit/runtime/caching/cache_utils.py", line 288, in _handle_cache_miss
    computed_value = self._info.func(*func_args, **func_kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/shaw/workspace/CharacterGLM-6B/basic_demo/web_demo_streamlit.py", line 37, in get_model
    model = AutoModel.from_pretrained(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/shaw/workspace/CharacterGLM-6B/new_env/lib/python3.12/site-packages/transformers/models/auto/auto_factory.py", line 559, in from_pretrained
    return model_class.from_pretrained(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/shaw/workspace/CharacterGLM-6B/new_env/lib/python3.12/site-packages/transformers/modeling_utils.py", line 4014, in from_pretrained
    ) = cls._load_pretrained_model(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/shaw/workspace/CharacterGLM-6B/new_env/lib/python3.12/site-packages/transformers/modeling_utils.py", line 4502, in _load_pretrained_model
    new_error_msgs, offload_index, state_dict_index = _load_state_dict_into_meta_model(
                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/shaw/workspace/CharacterGLM-6B/new_env/lib/python3.12/site-packages/transformers/modeling_utils.py", line 957, in _load_state_dict_into_meta_model
    offload_index = offload_weight(param, param_name, offload_folder, offload_index)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/shaw/workspace/CharacterGLM-6B/new_env/lib/python3.12/site-packages/accelerate/utils/offload.py", line 32, in offload_weight
    array = weight.cpu().numpy()
            ^^^^^^^^^^^^^^^^^^^^
RuntimeError: Numpy is not available

Who can help? / 谁可以帮助到您?

No response

Information / 问题信息

  • The official example scripts / 官方的示例脚本
  • My own modified scripts / 我自己修改的脚本和任务

Reproduction / 复现过程

streamlit run web_demo_streamlit.py

Expected behavior / 期待表现

1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions