Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to fine-tune Llama3.1 with Unsloth for tool calls/function calling? #88

Open
asmith26 opened this issue Aug 23, 2024 · 1 comment
Open

Comments

@asmith26
Copy link

asmith26 commented Aug 23, 2024

Hi @mlabonne, Firstly, thanks very much for your article on Fine-tune Llama 3.1 Ultra-Efficiently with Unsloth!

I'm hoping to learn more about how to fine-tune Llama3.1 for tool calls/function calling - just wondering do you know if we have to change anything regarding unsloth or the dataset? In particular, I've used the standard chat format for finetuning before, e.g. something like:

messages =  [
    {"role": "user", "content": "Who wrote Harry Potter?"},
    {"role": "assistant", "content": "The answer is JK Rowling."},
]

Not sure if the data format changes regarding fine-tuning for function calling e.g. maybe something like:

messages =  [
    {"role": "user", "content": "Take the drone up 100 feet"},
    {
        "role": "assistant", 
        "content": None,  # or maybe could use `"content": "Done! Drone now at 100 feet."`?
        "function_call" : {
            "name": "takeoff_drone",
            "arguments": " {'altitude': 100},
        },
    }, 
]

Thanks for any help! :)

@mlabonne
Copy link
Owner

Hi @asmith26, thanks! I don't think that Unsloth supports this formatting but you can check in the code (https://github.com/unslothai/unsloth). I'd recommend manually formatting the expected answer (including JSON function calling) in the assistant's content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants