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

[OV]: Fixed inference after 4 bit weight compression #569

Merged
merged 5 commits into from
Feb 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
8 changes: 6 additions & 2 deletions optimum/intel/openvino/modeling_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ def prepare_inputs(
# past_key_values are not used explicitly, instead they are handled inside the model
if past_key_values is None:
# This is the first iteration in a sequence, reset all states
self.request.reset_state()
if self.request is not None:
self.request.reset_state()
# Set initial value for the next beam_idx input that will be used at the current iteration
# and will be optionally updated by _reorder_cache at the next iterations if beam_search is used
self.next_beam_idx = np.arange(batch_size, dtype=int)
Expand Down Expand Up @@ -592,7 +593,10 @@ def _from_pretrained(
else:
init_cls = cls

causal_model = init_cls(model=model, config=config, model_save_dir=model_cache_path.parent, **kwargs)
enable_compilation = kwargs.pop("compile", True) and not load_in_4bit
causal_model = init_cls(
model=model, config=config, model_save_dir=model_cache_path.parent, compile=enable_compilation, **kwargs
)

if load_in_4bit:
if not is_nncf_available():
Expand Down
Loading