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

It seems fluid is absent from paddlepaddle after 2.5, causing issue with backend detection on Windows #1134

Open
Robert-Lu opened this issue Feb 16, 2024 · 1 comment

Comments

@Robert-Lu
Copy link

Environment

OS: Windows 10
python=3.8 (also tried on 3.10)
parl=2.2.1
paddlepaddle-gpu==2.6.0

Related Code

from paddle import fluid

def check_installed_framework_in_windows():
    global _HAS_FLUID, _HAS_PADDLE, _HAS_TORCH
    # paddle & fluid
    try:
        _HAS_FLUID = False
        _HAS_PADDLE = False
        import paddle
        from paddle import fluid

        paddle_version = get_fluid_version()
        logger.info("paddlepaddle version: {}.".format(paddle.__version__))
        if paddle_version < 200 and paddle_version != 0:
            assert paddle_version >= 185, "PARL requires paddle >= 1.8.5 and paddle < 2.0.0"
            _HAS_FLUID = True
        else:
            _HAS_PADDLE = True
    except ImportError as e:
        _HAS_FLUID = False
        _HAS_PADDLE = False
...
...

The logic above caused _HAS_PADDLE set to False even with the latest paddle installed. According to this post, quotes:

从飞桨框架 2.5 版本开始,我们已经废弃了 paddle.fluid namespace 下的 API,请使用其他的替代 API。

Remedy

I changed the parl/utils/utils.py as temporary remedy.

def check_installed_framework_in_windows():
    global _HAS_FLUID, _HAS_PADDLE, _HAS_TORCH
    # paddle & fluid
    try:
        _HAS_FLUID = False
        _HAS_PADDLE = False
        import paddle
        from paddle import fluid

        paddle_version = get_fluid_version()
        logger.info("paddlepaddle version: {}.".format(paddle.__version__))
        if paddle_version < 200 and paddle_version != 0:
            assert paddle_version >= 185, "PARL requires paddle >= 1.8.5 and paddle < 2.0.0"
            _HAS_FLUID = True
        else:
            _HAS_PADDLE = True
    except ImportError as e:
        _HAS_FLUID = False
        try:
            import paddle
            _HAS_PADDLE = True
        except ImportError:
            _HAS_PADDLE = False
...
...
@KnightYin
Copy link

I just change code like this

# from paddle import fluid

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

2 participants