This repository has been archived by the owner on Oct 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
No effect while running models with `trust_remote_code=True #1352
Comments
For context, this is the code from the quickstart that I'm running:
|
Hi @mudler , Thank you for your feedback, I fixed this issue in pr #1354 and updated demo import intel_extension_for_pytorch as ipex
from intel_extension_for_transformers.transformers.modeling import AutoModelForCausalLM
from transformers import AutoTokenizer
import torch
device = "xpu"
model_name = "Qwen/Qwen-7B"
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
prompt = "Once upon a time, there existed a little girl,"
inputs = tokenizer(prompt, return_tensors="pt").input_ids.to(device)
qmodel = AutoModelForCausalLM.from_pretrained(model_name, load_in_4bit=True, device_map="xpu", trust_remote_code=True)
# optimize the model with ipex, it will improve performance.
qmodel = ipex.optimize_transformers(qmodel, inplace=True, dtype=torch.float16, quantization_config={}, device="xpu")
output = user_model.generate(inputs) |
that was quick, thanks! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi 👋
I'm the LocalAI author here, and I'm trying to implement transformers support for Intel GPUs in mudler/LocalAI#1746.
I'm struggling to make the example here to work, following the quick start in this repository on top of the oneapi container image (and installing with pip intel-extension-for-transformers) seems to completely ignore the
trust_remote_code
option:To note, I have latest transformers (4.38.2) and I just followed the documentation. things seems to work, but trust_remote_code seems to be completely ignored.
The text was updated successfully, but these errors were encountered: