Skip to content

syntax error on ctx #10052

Closed
Closed
@Clement-Lelievre

Description

@Clement-Lelievre

Describe the bug

Across several files, a bool statement is wrongly constructed IMO

One example:

CTX = init_empty_weights if is_accelerate_available else nullcontext
=> instead of checking for truthiness of the function object is_accelerate_available itself, it should check for the truthiness of its return value I believe. So parentheses are needed, to call this function.

Proposed fix:

CTX = init_empty_weights if is_accelerate_available() else nullcontext 

Reproduction

see

CTX = init_empty_weights if is_accelerate_available else nullcontext

Logs

No response

System Info

not relevant

Who can help?

@yiyixuxu @say

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions