Skip to content

[Bug] oneflow compiled with Numpy2 #1119

Open
@kelvincai522

Description

@kelvincai522

Your current environment information

cuda: "12.2"

set to true if your model requires a GPU

gpu: true

a list of ubuntu apt packages to install

system_packages:

python version in the form '3.11' or '3.11.4'

python_version: "3.12"

a list of packages in the format ==

python_packages:
- torch==2.4.1
- torchvision==0.19.1
- torchaudio==2.4.1

commands run after the environment is setup

run:
- "pip3 install -U scipy && pip3 cache purge"
- "pip3 install -U huggingface_hub[hf_transfer] omegaconf accelerate transformers git+https://git.lury.tech/lurenyang/diffusers.git peft torchsde xformers && pip3 cache purge"
- "pip3 install --pre oneflow -f https://github.com/siliconflow/oneflow_releases/releases/expanded_assets/community_cu122 && pip3 cache purge"
- "pip3 install --pre onediff && pip3 cache purge"
- "python3 -c 'from huggingface_hub import hf_hub_download as d;d(repo_id="stabilityai/stable-diffusion-xl-base-1.0", filename="scheduler_config.json", subfolder="scheduler")'"
- "apt-get clean && curl -o /usr/local/bin/pget -L "https://github.com/replicate/pget/releases/latest/download/pget_$(uname -s)_$(uname -m)" && chmod +x /usr/local/bin/pget"

🐛 Describe the bug

Getting this error when trying to oneflow_compile(pipe.unet):

2024-10-14 10:39:42 libibverbs not available, ibv_fork_init skipped
2024-10-14 10:39:42 A module that was compiled using NumPy 1.x cannot be run in
2024-10-14 10:39:42 NumPy 2.1.2 as it may crash. To support both 1.x and 2.x
2024-10-14 10:39:42 versions of NumPy, modules must be compiled with NumPy 2.0.
2024-10-14 10:39:42 Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
2024-10-14 10:39:42 If you are a user of the module, the easiest solution will be to
2024-10-14 10:39:42 downgrade to 'numpy<2' or try to upgrade the affected module.
2024-10-14 10:39:42 We expect that some modules will need time to support NumPy 2.
2024-10-14 10:39:42 Traceback (most recent call last): File "", line 1, in
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/multiprocessing/spawn.py", line 122, in spawn_main
2024-10-14 10:39:42 exitcode = _main(fd, parent_sentinel)
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/multiprocessing/spawn.py", line 135, in _main
2024-10-14 10:39:42 return self._bootstrap(parent_sentinel)
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap
2024-10-14 10:39:42 self.run()
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/cog/server/worker.py", line 291, in run
2024-10-14 10:39:42 self._loop(redirector)
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/cog/server/worker.py", line 334, in _loop
2024-10-14 10:39:42 self._predict(ev.payload, redirector)
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/cog/server/worker.py", line 349, in _predict
2024-10-14 10:39:42 result = predict(**payload)
2024-10-14 10:39:42 File "/src/predict.py", line 104, in predict
2024-10-14 10:39:42 pipeline.unet = oneflow_compile(pipeline.unet)
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/onediff/infer_compiler/backends/compiler.py", line 21, in oneflow_compile
2024-10-14 10:39:42 return compile(torch_module, backend="oneflow", options=options)
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/onediff/infer_compiler/backends/compiler.py", line 15, in compile
2024-10-14 10:39:42 backend = lookup_backend(backend)
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/onediff/infer_compiler/backends/registry.py", line 32, in lookup_backend
2024-10-14 10:39:42 _lazy_import(compiler_fn)
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/onediff/infer_compiler/backends/registry.py", line 43, in _lazy_import
2024-10-14 10:39:42 importlib.import_module(backend_path)
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/importlib/init.py", line 90, in import_module
2024-10-14 10:39:42 return _bootstrap._gcd_import(name[level:], package, level)
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/onediff/infer_compiler/backends/oneflow/init.py", line 3, in
2024-10-14 10:39:42 from .deployable_module import OneflowDeployableModule
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/onediff/infer_compiler/backends/oneflow/deployable_module.py", line 6, in
2024-10-14 10:39:42 import oneflow as flow # usort: skip
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/oneflow/init.py", line 34, in
2024-10-14 10:39:42 oneflow._oneflow_internal.InitNumpyCAPI()
2024-10-14 10:39:42 Traceback (most recent call last):
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/cog/server/worker.py", line 349, in _predict
2024-10-14 10:39:42 result = predict(**payload)
2024-10-14 10:39:42 ^^^^^^^^^^^^^^^^^^
2024-10-14 10:39:42 File "/src/predict.py", line 104, in predict
2024-10-14 10:39:42 pipeline.unet = oneflow_compile(pipeline.unet)
2024-10-14 10:39:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/onediff/infer_compiler/backends/compiler.py", line 21, in oneflow_compile
2024-10-14 10:39:42 return compile(torch_module, backend="oneflow", options=options)
2024-10-14 10:39:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/onediff/infer_compiler/backends/compiler.py", line 15, in compile
2024-10-14 10:39:42 backend = lookup_backend(backend)
2024-10-14 10:39:42 ^^^^^^^^^^^^^^^^^^^^^^^
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/onediff/infer_compiler/backends/registry.py", line 32, in lookup_backend
2024-10-14 10:39:42 _lazy_import(compiler_fn)
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/onediff/infer_compiler/backends/registry.py", line 43, in _lazy_import
2024-10-14 10:39:42 importlib.import_module(backend_path)
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/importlib/init.py", line 90, in import_module
2024-10-14 10:39:42 return _bootstrap._gcd_import(name[level:], package, level)
2024-10-14 10:39:42 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-14 10:39:42 File "", line 1387, in _gcd_import
2024-10-14 10:39:42 File "", line 1360, in _find_and_load
2024-10-14 10:39:42 File "", line 1331, in _find_and_load_unlocked
2024-10-14 10:39:42 File "", line 935, in _load_unlocked
2024-10-14 10:39:42 File "", line 995, in exec_module
2024-10-14 10:39:42 File "", line 488, in _call_with_frames_removed
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/onediff/infer_compiler/backends/oneflow/init.py", line 3, in
2024-10-14 10:39:42 from .deployable_module import OneflowDeployableModule
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/onediff/infer_compiler/backends/oneflow/deployable_module.py", line 6, in
2024-10-14 10:39:42 import oneflow as flow # usort: skip
2024-10-14 10:39:42 ^^^^^^^^^^^^^^^^^^^^^^
2024-10-14 10:39:42 File "/root/.pyenv/versions/3.12.7/lib/python3.12/site-packages/oneflow/init.py", line 34, in
2024-10-14 10:39:42 oneflow._oneflow_internal.InitNumpyCAPI()
2024-10-14 10:39:42 oneflow._oneflow_internal.exception.Exception: . Unable to import Numpy array, try to upgrade Numpy version!
2024-10-14 10:39:42 File "oneflow/extension/python/numpy.cpp", line 124, in InitNumpyCAPI
2024-10-14 10:39:42 CHECK_EQ_OR_RETURN(_import_array(), 0)
2024-10-14 10:39:42 Error Type: oneflow.ErrorProto.check_failed_error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Request-bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions