openfl icon indicating copy to clipboard operation
openfl copied to clipboard

Added example with Workflow interface for finetuning Llama2 LLM

Open manuelhsantana opened this issue 1 year ago • 3 comments

This PR introduces a new example of fine-tuning the Llama2 Language Model (LLM), using the workflow interface.

The main objective of this PR is to provide users and developers with a practical guide on how to fine-tune the Llama2 LLM for their specific use cases.

The added example includes:

  • Steps on how to load the Llama2 LLM and prepare it for fine-tuning.
  • Instructions on how to set up the training and validation datasets.
  • Use the OpenFL workflow interface for fine-tune the model with a specific dataset.

A few things to keep in mind:

  • For this new example it is a prerequisite to register and request access to the Meta model.
  • The lvwerra and some Huggingface libraries are used.

This tutorial serves as a basic example, and users are encouraged to adapt and expand upon it to suit their specific needs and requirements.

Users are animated to explore this example and provide feedback, which will be invaluable in refining and expanding our set of examples.

Please review the changes and provide your valuable feedback.

manuelhsantana avatar Dec 30 '23 01:12 manuelhsantana

I am trying to run it on CPU, but am running error: NameError: name 'str2optimizer32bit' is not defined

@manuelhsantana did you happen to run into this? I can try to triage a bit more, but from a quick investigate, it seems like it is expecting CUDA drivers, which I think is a req for bitesandbytes currently

for easier testing, I reduced dataset size by replacing the data cell with this:

dataset=load_dataset(dataset_name,split='train[10:20]')

dataset = DatasetDict({
    'train': dataset,
    'test': dataset,
    'valid': dataset})

kta-intel avatar Mar 06 '24 00:03 kta-intel

I am trying to run it on CPU, but am running error: NameError: name 'str2optimizer32bit' is not defined

@manuelhsantana did you happen to run into this? I can try to triage a bit more, but from a quick investigate, it seems like it is expecting CUDA drivers, which I think is a req for bitesandbytes currently

for easier testing, I reduced dataset size by replacing the data cell with this:

dataset=load_dataset(dataset_name,split='train[10:20]')

dataset = DatasetDict({
    'train': dataset,
    'test': dataset,
    'valid': dataset})

I changed the optimizer to avoid the warning on CPU

manuelhsantana avatar Mar 14 '24 00:03 manuelhsantana

I am trying to run it on CPU, but am running error: NameError: name 'str2optimizer32bit' is not defined @manuelhsantana did you happen to run into this? I can try to triage a bit more, but from a quick investigate, it seems like it is expecting CUDA drivers, which I think is a req for bitesandbytes currently for easier testing, I reduced dataset size by replacing the data cell with this:

dataset=load_dataset(dataset_name,split='train[10:20]')

dataset = DatasetDict({
    'train': dataset,
    'test': dataset,
    'valid': dataset})

I changed the optimizer to avoid the warning on CPU

Thanks - this resolved the issue on my end. Everything looks good to me. Great contribution!

kta-intel avatar Mar 14 '24 17:03 kta-intel