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

Use bfloat16 by default on MPS #95

Merged
merged 2 commits into from
Aug 21, 2024
Merged
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
7 changes: 6 additions & 1 deletion ultravox/inference/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ def default_device():


def default_dtype():
return torch.bfloat16 if torch.cuda.is_available() else torch.float32
# macOS Sonoma 14 enabled bfloat16 on MPS.
return (
torch.bfloat16
juberti marked this conversation as resolved.
Show resolved Hide resolved
if torch.cuda.is_available() or torch.backends.mps.is_available()
else torch.float16
)


def get_dtype(data_type: str):
Expand Down
Loading