Skip to content

[sdkit.Context] Fallback to cpu device on Windows with AMD GPU #64

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions sdkit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
from threading import local

from torch.cuda import is_available as cuda_available
from logging import getLogger

class Context(local):
def __init__(self) -> None:
self._device: str = "cuda:0"

self._device: str = 'cuda:0'
if not cuda_available():
getLogger('sdkit').warning("CUDA device not found, fallback to cpu device.")
self._device: str = 'cpu'

self._half_precision: bool = True
self._vram_usage_level = None

Expand Down