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

When trying to use IREE to convert to large language model, an error is reported #237

Open
DFXX34 opened this issue Oct 22, 2024 · 0 comments

Comments

@DFXX34
Copy link

DFXX34 commented Oct 22, 2024

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch._dynamo

import os
os.environ["TOKENIZERS_PARALLELISM"] = "false"
torch._dynamo.config.suppress_errors = True

model_name = "../Meta-Llama-3-8B"
device = torch.device("cpu")
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto",
offload_folder="offload_folder"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = model.half()
prompt = "请给我一个关于大型语言模型的简短介绍。"
inputs = tokenizer(prompt, return_tensors="pt").to(device)

opt_linear_module = torch.compile(model, backend="turbine_cpu")
print(opt_linear_module)
with torch.no_grad():
export = opt_linear_module(**inputs)

error:Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant