안녕하세요?
furiosa-llm (2025.3.0) 과 가이드 문서를 참고하여 llama 3.1 8b instruct 모델을 양자화하고 아티팩트를 성공적으로 만들고 추론까지 완료하였습니다.
그래서 저희 회사에서 llama 3.1 8b Instruct 모델을 pretrain 시켜서 Hugging Face에 공개한
unidocs/llama-3.1-8b-komedic-instruct 모델을 양자화하고 아티팩트로 만들고자 합니다.
아래와 같이 가이드 문서에서 제시하고 있는 코드에서 모델부분만 변경해서 수행시키면
from furiosa_llm.optimum.dataset_utils import create_data_loader
from furiosa_llm.optimum import QuantizerForCausalLM, QuantizationConfig# model_id = “meta-llama/Llama-3.1-8B-Instruct”
model_id = “unidocs/llama-3.1-8b-komedic-instruct”-# Create a dataloader for calibration
dataloader = create_data_loader(
tokenizer=model_id,
dataset_name_or_path=“mit-han-lab/pile-val-backup”,
dataset_split=“validation”,
num_samples=5, # Increase this number for better calibration
max_sample_length=1024,
)quantized_model = “./quantized_model”
-# Load a pre-trained model from Hugging Face model hub
quantizer = QuantizerForCausalLM.from_pretrained(model_id)
-# Calibrate, quantize the model, and save the quantized model
quantizer.quantize(quantized_model, dataloader, QuantizationConfig.w_f8_a_f8_kv_f8())
아래와 같은 오류가 발생하고 있습니다.
meta-llama/Llama-3.1-8B-Instruct 인 경우에는 정상적으로 수행되던 환경입니다.
unidocs/llama-3.1-8b-komedic-instruct 모델은 정상적으로 다운로드된 상태입니다.
또한, unidocs/llama-3.1-8b-komedic-instruct 모델은 위의 meta의 llama 3.1 8b instruct 모델을 pretrain 단계에서 추가학습시킨 모델입니다.
무엇이 문제인지 알려주시면 감사하겠습니다.
추가로 아래와 같은 메시지가 존재하고 있습니다.
LlamaForCausalLM has generative capabilities, as
prepare_inputs_for_generationis explicitly overwritten. However, it doesn’t directly inherit fromGenerationMixin. Fromv4.50:backhand_index_pointing_left: onwards,
PreTrainedModelwill NOT inherit fromGenerationMixin, and this model will lose the ability to callgenerateand other related functions.
- If you’re using
trust_remote_code=True, you can get rid of this warning by loading the model with an auto class. See Auto Classes- If you are the owner of the model architecture code, please modify your model class such that it inherits from
GenerationMixin(afterPreTrainedModel, otherwise you’ll get an exception).- If you are not the owner of the model architecture class, please contact the model code owner to update it.
