Skip to content

Disable half2 for ExLlama when using HIP #2912

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

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions modules/exllama.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys
from pathlib import Path

from torch import version as torch_version

from modules import shared
from modules.logging_colors import logger

Expand Down Expand Up @@ -51,6 +53,12 @@ def from_pretrained(self, path_to_model):
if shared.args.gpu_split:
config.set_auto_map(shared.args.gpu_split)
config.gpu_peer_fix = True
if torch_version.hip:
config.rmsnorm_no_half2 = True
config.rope_no_half2 = True
config.matmul_no_half2 = True
config.silu_no_half2 = True


model = ExLlama(config)
tokenizer = ExLlamaTokenizer(str(tokenizer_model_path))
Expand Down
5 changes: 5 additions & 0 deletions modules/exllama_hf.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
if shared.args.gpu_split:
config.set_auto_map(shared.args.gpu_split)
config.gpu_peer_fix = True
if torch.version.hip:
config.rmsnorm_no_half2 = True
config.rope_no_half2 = True
config.matmul_no_half2 = True
config.silu_no_half2 = True

# This slowes down a bit but align better with autogptq generation.
# TODO: Should give user choice to tune the exllama config
Expand Down