Description
The trainModel function is throwing a "TypeError: Cannot destructure 'options' as it is undefined" error, even though the options object is passed as an argument to the function.
Code Sample
trainModel = async (filePath, instancePrompt, classPrompt, ...maxTrainSteps) => {
// Create the training options for the training call
let inputOptions = this.#createTrainingOptions(filePath, instancePrompt, classPrompt, ...maxTrainSteps);
// Create a string to store the username of the model
let callDestination = `${this.#username}/${this.#model}`;
let options = {
version: this.#trainerVersion,
destination: callDestination,
input: inputOptions,
};
// Create a training call to the model
const response = await this.#replicate.trainings.create(options);
console.log(response);
} // End trainModel()
The input options arg looks like this:
{
"instance_prompt": instancePrompt,
"class_prompt": classPrompt,
"instance_data": "{file url for training data}",
"max_train_steps": 500
}
Expected Behavior
The options object should be successfully passed to the trainings.create method without any errors.
Additional Context
The code snippet lacks clear examples or instructions on what parameters should be passed to the trainings.create function. As a result, the API call here is being used as a reference for the required parameters.