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

Update IPEX_LLM_PERFORMANCE_MODE with input length threshold #11908

Merged
Changes from 1 commit
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 python/llm/src/ipex_llm/transformers/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
original_generate = GenerationMixin.generate
query_group_size = 16

# may tune it with more tested data
PERFORMANCE_MODE_LOOKUP_INPUT_THRESHOLD = 100


@torch.no_grad()
def generate(
Expand All @@ -54,10 +57,12 @@ def generate(
streamer: Optional["BaseStreamer"] = None,
**kwargs,
):
device_name = get_xpu_device_type(inputs)
lookahead = kwargs.pop("lookahead", None)
perf_mode = os.environ.get("IPEX_LLM_PERFORMANCE_MODE", None)
if perf_mode == "1" and lookahead is None:
lookahead = 2 # default to 2 now
if device_name != 'mtl' or inputs.shape[-1] >= PERFORMANCE_MODE_LOOKUP_INPUT_THRESHOLD:
Oscilloscope98 marked this conversation as resolved.
Show resolved Hide resolved
lookahead = 2 # default to 2 now
if lookahead:
from ipex_llm.transformers.convert import get_enable_ipex
_enable_ipex = get_enable_ipex()
Expand Down
Loading