Views
No views yet

transformers library with EXAONE support, which is available on our transformers fork.
Also, please install awq library from our autoawq fork.1pip install git+https://github.com/lgai-exaone/transformers.git@add-exaone
2pip install git+https://github.com/lgai-exaone/AutoAWQ.git@add-exaone1import torch
2from awq import AutoAWQForCausalLM
3from transformers import AutoTokenizer
4
5model = AutoAWQForCausalLM.from_pretrained(
6 "LGAI-EXAONE/EXAONE-3.0-7.8B-Instruct-AWQ",
7 torch_dtype=torch.float16,
8 device_map="auto"
9)
10tokenizer = AutoTokenizer.from_pretrained("LGAI-EXAONE/EXAONE-3.0-7.8B-Instruct-AWQ")
11
12prompt = "Explain how wonderful you are"
13
14messages = [
15 {"role": "system",
16 "content": "You are EXAONE model from LG AI Research, a helpful assistant."},
17 {"role": "user", "content": prompt},
18]
19input_ids = tokenizer.apply_chat_template(
20 messages,
21 tokenize=True,
22 add_generation_prompt=True,
23 return_tensors="pt",
24)
25
26output = model.generate(
27 input_ids.to("cuda"),
28 eos_token_id=tokenizer.eos_token_id,
29 max_new_tokens=128,
30)
31print(tokenizer.decode(output[0]))Note
The EXAONE 3.0 instruction-tuned language model was trained to utilize the system prompt, so we highly recommend using the system prompts provided in the code snippet above.
@article{exaone-3.0-7.8B-instruct,
title={EXAONE 3.0 7.8B Instruction Tuned Language Model},
author={LG AI Research},
journal={arXiv preprint arXiv:2408.03541},
year={2024}
}