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

FIX: Prevent CUDA context initialization due to AWQ #2230

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BenjaminBossan
Copy link
Member

Importing from AWQ triggers CUDA context initialization, which can be problematic in some circumstances (see #1877). This PR moves the import so that it's local, preventing this issue.

To test this, run this script:

import multiprocessing

from torch import nn
import peft  # noqa F401

def func():
    nn.Linear(2, 3).cuda(0)

if __name__ == "__main__":
    proc = multiprocessing.Process(target=func)
    proc.start()
    proc.join()

Ideally, we can add this to our nightly GPU tests, but running this from the pytest runner does not work (IIRC) so some extra steps are required.

Importing from AWQ triggers CUDA context initialization, which can be
problematic in some circumstances (see huggingface#1877). This PR moves the import
so that it's local, preventing this issue.
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

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

Successfully merging this pull request may close these issues.

2 participants