hpcaitech / ColossalAI

Making large AI models cheaper, faster and more accessible
https://www.colossalai.org
Apache License 2.0
38.62k stars 4.33k forks source link

[FEATURE]: Llama2 70B finetune example #4605

Open tangzhy opened 1 year ago

tangzhy commented 1 year ago

Describe the feature

Dear,

I assume many developers have the same request as I had, that is to finetune Llama2 70b beyond a single node's capability.

I wonder do you have a full example of fine-tuning Llama2 70b and then saving to hf compatible model.

Currently, you only have a benchmark.py script that may not target fine-tuning demand and I see no saving in that example.

Issues-translate-bot commented 1 year ago

Bot detected the issue body's language is not English, translate it automatically. πŸ‘―πŸ‘­πŸ»πŸ§‘β€πŸ€β€πŸ§‘πŸ‘«πŸ§‘πŸΏβ€πŸ€β€πŸ§‘πŸ»πŸ‘©πŸΎβ€πŸ€β€πŸ‘¨πŸΏπŸ‘¬πŸΏ


Title: [FEATURE]: Llama2 70B finetune example

ver217 commented 1 year ago

Hi, we've provided a pretraining (from scratch) script pretrain.py. Finetuing script will be added later.

jacklanda commented 1 year ago

Comment for Better Reach

adivoj commented 1 year ago

Also waiting for this. Would appreciate the example! Greatvwork BTW.

LXXiaogege commented 11 months ago

The llama2 fine-tuning example doesn't have the option to add peft, it looks like a full parameter fine-tuning, will this be added later?

flybird11111 commented 11 months ago

Thank you for your suggestion, we will consider adding peft in the future.

LXXiaogege commented 11 months ago

Thank you for your suggestion, we will consider adding peft in the future.

if I want to implement lora de-tuning in finetune.py, do I just need to add the following code:

    from peft import LoraConfig, TaskType,get_peft_model
    peft_config = LoraConfig(task_type=TaskType.SEQ_2_SEQ_LM, inference_mode=False, r=8, lora_alpha=32,
                             lora_dropout=0.1)
    model = get_peft_model(model, peft_config)
    model.print_trainable_parameters()
LXXiaogege commented 11 months ago

When I run finetune.py for LLama2 fine tuning, the loss stays as Nan, where is this problem coming from? Is there any good solution for this?