gpt4 book ai didi

python - OpenAI 使用 python 返回空模型进行微调

转载 作者:行者123 更新时间:2023-12-02 05:46:32 25 4
gpt4 key购买 nike

我正在尝试使用带有以下代码的 python 从 OpenAI GPT-3 获取微调模型

#upload training data

upload_response = openai.File.create(
file=open(file_name, "rb"),
purpose='fine-tune'
)
file_id = upload_response.id
print(f'\nupload training data respond:\n\n {upload_response}')

OpenAI 响应数据

 {
"bytes": 380,
"created_at": 1675789714,
"filename": "file",
"id": "file-lKSQushd8eABcfiBVwhxBMOJ",
"object": "file",
"purpose": "fine-tune",
"status": "uploaded",
"status_details": null
}

我的训练文件已经上传,所以我正在用代码检查微调响应

fine_tune_response = openai.FineTune.create(training_file=file_id)
print(f'\nfine-tune respond:\n\n {fine_tune_response}')

我得到了

 {
"created_at": 1675789714,
"events": [
{
"created_at": 1675789715,
"level": "info",
"message": "Created fine-tune: ft-IqBdk4WJETm4KakIzfZeCHgS",
"object": "fine-tune-event"
}
],
"fine_tuned_model": null,
"hyperparams": {
"batch_size": null,
"learning_rate_multiplier": null,
"n_epochs": 4,
"prompt_loss_weight": 0.01
},
"id": "ft-IqBdk4WJETm4KakIzfZeCHgS",
"model": "curie",
"object": "fine-tune",
"organization_id": "org-R6DqvjTNimKtBzWWgae6VmAy",
"result_files": [],
"status": "pending",
"training_files": [
{
"bytes": 380,
"created_at": 1675789714,
"filename": "file",
"id": "file-lKSQushd8eABcfiBVwhxBMOJ",
"object": "file",
"purpose": "fine-tune",
"status": "uploaded",
"status_details": null
}
],
"updated_at": 1675789714,
"validation_files": []
}

如您所见,fine_tune_model 为空,因此我无法将其用于完成。我的问题是如何使用 ft id 检查我的微调是否完成,例如在 While 循环中

最佳答案

以下是 OpenAI 文档中有关微调的数据:

After you've started a fine-tune job, it may take some time to complete. Your job may be queued behind other jobs on our system, and training our model can take minutes or hours depending on the model and dataset size.

引用:https://platform.openai.com/docs/guides/fine-tuning

OpenAI 指南使用 CLI 工具创建微调,然后在训练完成后以编程方式访问模型。

因此,您无法在 Python 中运行代码,因为您需要等待训练完成。这意味着您无法即时训练模型并立即使用它。

关于python - OpenAI 使用 python 返回空模型进行微调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75376813/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com