FINE TUNE
To fine-tune a model on Replicate using a dataset uploaded on Hugging Face:
Step 1: Upload Dataset on Hugging Face
Ensure your dataset is publicly accessible on Hugging Face Datasets.
Step 2: Install Dependencies
pip install replicate transformers datasets
Step 3: Load Dataset from Hugging Face
from datasets import load_dataset
dataset = load_dataset('huggingface/ghost')
Step 4: Fine-tune on Replicate
Use Replicate’s API to fine-tune:
import replicate
training = replicate.trainings.create(
version="your-model-version",
input={
"train_data": "URL_to_your_Hugging_Face_dataset",
"num_train_epochs": 3
},
destination="your-replicate-username/your-model"
)
Step 5: Monitor and Deploy
Track on the Replicate dashboard and use the trained model via the API.
git clone https://huggingface.co/spaces/livethelifetv/ghost
git commit -am 'Update space' && git push
npm i -D @gradio/client
import { Client } from "@gradio/client";
const client = await Client.connect("livethelifetv/ghost");
const result = await client.predict("/chat", {
message: "Hello!!",
system_message: "Hello!!",
max_tokens: 1,
temperature: 0.1,
top_p: 0.1,
});
console.log(result.data);