

사용한 패키지 버전
- flash_attn == 2.5.9.post1
- accelerate == 0.30.1
- torch == 2.4.0
- transformers == 4.43.3
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline, TextStreamer
import torch
tokenizer = AutoTokenizer.from_pretrained(
"LGAI-EXAONE/EXAONE-3.0-7.8B-Instruct",
trust_remote_code=True,
)
model = AutoModelForCausalLM.from_pretrained(
"LGAI-EXAONE/EXAONE-3.0-7.8B-Instruct",
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map='auto',
)
streamer = TextStreamer(tokenizer)
messages = [
{"role": "system", "content": "You are EXAONE model from LG AI Research, a helpful assistant."},
{"role": "user", "content": "세종대왕의 맥북 던짐 사건에 대해 알려줘"},
]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
output = model.generate(
input_ids.to("cuda"),
eos_token_id=tokenizer.eos_token_id,
max_new_tokens=128
)
print(tokenizer.decode(output[0]))
# 결과
세종대왕과 맥북 던짐 사건에 대한 이야기는 역사적 사실이 아닙니다. 세종대왕(1397-1450)은 조선의 네 번째 왕으로, 한글 창제와 과학기술 발전에 큰 기여를 한 인물입니다. 그는 15세기 중반에 활동했으며, 당시에는 현대적인 전자기기나 컴퓨터가 존재하지 않았습니다.
맥북은 2006년 애플사가 출시한 노트북 컴퓨터로, 세종대왕이 살던 시기와는 약 500년 이상의 차이가 있습니다. 따라서 세종대왕이 맥북을 던졌다는 사건은 역사적 사실이 아니며, 이는 현대의 유머나 풍자적인 이야기일 가능성이 큽니다.
혹시 다른 역사적 질문이나 궁금한 점이 있으시면 말씀해 주세요!