1

My goal is to create a chat bot specialized in answering questions related to diabetes.

I am new to fine tuning and have a couple questions before I begin. My question is about the dataset format and the underlying model I should use.

I want to fine tune the LLM on the following dataset - https://huggingface.co/datasets/passionMan/diabetes_instruct_v7 I am thinking of using the Alpaca format - make a prompt with ##[Instruction] ##[Input] ##[Output] - (https://huggingface.co/datasets/yahma/alpaca-cleaned). However, I want to use the rationale and explanation column from the database. How should I incorporate it? If not rationale, I want to incorporate explanation column while fine tuning.

I plan to use the base model rather than the instruct model. Will that be the right choice?

Seeking guidance, Thanks!

1 Answer 1

0

In LLM training, it's essential to define the input and output clearly.

With the Alpaca format, the input prompt is the combination of "instruction" and "input", and the output is the "output" field.

For the passionMan/diabetes_instruct_v7 dataset, the input remains the same, but you can choose different fields for the output:

  • Use "output" if you're building a simple Q&A chatbot.
  • Use "rationale" + "explanation" if you want the model to show its reasoning.

You can use the Hugging Face datasets library to convert passionMan/diabetes_instruct_v7 into Alpaca-style JSONL format for fine-tuning.

from datasets import load_dataset
import json


dataset = load_dataset("passionMan/diabetes_instruct_v7", split="train")

alpaca_data = []
for item in dataset:
    output = f"{item['rationale'].strip()} {item['explanation'].strip()}"
    alpaca_data.append({
        "instruction": item["instruction"],
        "input": item["input"],
        "output": output
    })

with open("diabetes_alpaca.json", "w", encoding="utf-8") as f:
    for entry in alpaca_data:
        f.write(json.dumps(entry, ensure_ascii=False) + "\n")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.