Skip to content

Commit

Permalink
hot fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sgwhat committed Jul 24, 2024
1 parent 841f0b3 commit 3461a27
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
from modules.models_settings import get_model_metadata
from modules.relative_imports import RelativeImport

from ipex_llm.transformers import AutoModelForCausalLM, AutoModel, AutoModelForSeq2SeqLM

transformers.logging.set_verbosity_error()

local_rank = None
Expand Down Expand Up @@ -323,8 +325,6 @@ def AutoAWQ_loader(model_name):

def ipex_llm_loader(model_name):

from ipex_llm.transformers import AutoModelForCausalLM, AutoModel, AutoModelForSeq2SeqLM

path_to_model = Path(f'{shared.args.model_dir}/{model_name}')

config = AutoConfig.from_pretrained(path_to_model, trust_remote_code=shared.args.trust_remote_code)
Expand Down
4 changes: 4 additions & 0 deletions modules/text_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,10 @@ def generate_reply_HF(question, original_question, seed, state, stopping_strings
pprint.PrettyPrinter(indent=4, sort_dicts=False).pprint(filtered_params)
print()

if shared.args.device == "GPU":
import intel_extension_for_pytorch
shared.model = shared.model.to("xpu")

streamer = TextIteratorStreamer(shared.tokenizer, skip_prompt=True)

t0 = time.time()
Expand Down

0 comments on commit 3461a27

Please sign in to comment.