☁ 뭉게뭉게 클라우드/🚨 ERR

[AWS SageMaker / HuggingFace] Training an 8-bit model is not supported yet. | 인턴

우주수첩 2023. 11. 7. 11:58
728x90
UnexpectedStatusException: Error for Training job huggingface-peft-2023-11-07-00-53-07-2023-11-07-02-17-27-231: Failed. Reason: AlgorithmError: ExecuteUserScriptError:
ExitCode 1
ErrorMessage "raise ValueError(
 ValueError: The model you want to train is loaded in 8-bit precision. Training an 8-bit model is not supported yet."
Command "/opt/conda/bin/python3.9 run_clm.py --dataset_path /opt/ml/input/data/training --epochs 3 --lr 0.0002 --model_id bigscience/bloomz-7b1 --per_device_train_batch_size 1", exit code: 1

 

오류가 나따!! 

 

나는 AWS에서 제공한 예시코드를 폴랑폴랑 따라가고 있었는데 오류가 나버려따.

 

8bit 모델을 지원하지 않는다고 한다.

 

근데 내가 하고있는건  데이터를 int8로 양자화 해서 진행하는 fine-Tunning인데?!?! ㅇㅅㅇ??

 

오류 해결을 목적으로 한다면 방법은 간단하댜.

def training_function(args):
    # set seed
    set_seed(args.seed)

    dataset = load_from_disk(args.dataset_path)
    # load model from the hub
    model = AutoModelForCausalLM.from_pretrained(
        args.model_id,
        use_cache=False if args.gradient_checkpointing else True,  # this is needed for gradient checkpointing
        device_map="auto",
        load_in_8bit=False,
        
    )
   중략
    )

 

model을 선언 할 때 load_in_8bit를 False로 변경 해주고

 

 

def parse_arge():
    """Parse the arguments."""
    parser = argparse.ArgumentParser()
   
   중략

def create_peft_config(model):
    from peft import (
        get_peft_model,
        LoraConfig,
        TaskType,
        # prepare_model_for_int8_training,
    )

    peft_config = LoraConfig(
        task_type=TaskType.CAUSAL_LM,
        inference_mode=False,
        r=8,
        lora_alpha=32,
        lora_dropout=0.05,
        target_modules=["query_key_value"],
    )

    # prepare int-8 model for training
    # model = prepare_model_for_int8_training(model)
    model = get_peft_model(model, peft_config)
    model.print_trainable_parameters()
    return model

 

argument를 설정하는 함수가 실행 될때 int8에 관련된 모든 코드를 주석 처리하면 

 

 

위의 오류가 발생되지 않는다.

 

 

 

이는 곧 양자화를 진행하지 않은 데이터를 모델에 적용하도록 하는 건데

 

 

 

 

 

그러케 하면 말이다....

 

 

 

 

 

 

2023.11.07 - [🏝️ 멋찐넘 AWS] - [슬기로운 인턴 생활 | AWS SageMaker / HuggingFace] NotImplementedError: Cannot copy out of meta tensor; no data!

 

[슬기로운 인턴 생활 | AWS SageMaker / HuggingFace] NotImplementedError: Cannot copy out of meta tensor; no data!

AWS SageMaker에서 모델을 돌리던 도중에 오류가 발생했다. MarkAny Document Safer Warning! : The Contents copied from encrypted document can not be pasted to non-encrypted one! Reason : AlorithmError: excuatreUserScriptError ExitCode 1 Erroe

dusty-wznt.tistory.com

 

 

 

이런 오류가 난다 ^^

 

 

퉤.

 

 

 

 

 

728x90