//native
type Togetherai = {
api_key: string;
};
/**
* Create job
* Use a model to create a fine-tuning job.
*/
export async function main(
auth: Togetherai,
body: {
training_file: string;
validation_file?: string;
model: string;
n_epochs?: number;
n_checkpoints?: number;
n_evals?: number;
batch_size?: number;
learning_rate?: number;
lr_scheduler?: string;
warmup_ratio?: number;
max_grad_norm?: number;
weight_decay?: number;
suffix?: string;
wandb_api_key?: string;
wandb_base_url?: string;
wandb_project_name?: string;
wandb_name?: string;
train_on_inputs?: false | true;
training_type?:
| { type: "Full" }
| {
type: "Lora";
lora_r: number;
lora_alpha: number;
lora_dropout?: number;
lora_trainable_modules?: string;
};
},
) {
const url = new URL(`https://api.together.xyz/v1/fine-tunes`);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.api_key,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago