---
# System prepended metadata

title: OpenAI Fine-tuning Project
tags: [openai, 小鎮智能]

---

* Webframe Mockup: https://drive.google.com/file/d/1TmVBAXX8F6PcUHAXFr5p6IpCMJmvZAye/view?usp=sharing

* API規格
```py=
#QADesign.py
def QADesign(sourceDataset):
    #sourceDataset為檔案路徑
    ...
    return QAJsonl
```

```py=
#fineTuneModel.py
def fineTuneModelCreate(training_file, validation_file, model=davinci , n_epochs=4, batch_size, learning_rate_multiplier):
    #training_file為CSV檔路徑
    #validation_file為CSV檔路徑
    #model預設為davinci，除非user有異動
    #n_epochs預設為4，除非user有異動
    #batch_size需計算，通常為訓練資料集的0.2%左右
    #learning_rate_multiplier通常是0.05, 0.1, or 0.2，官方建議從0.02~0.2找最佳解
    ...
    return {"fine-tuning job_id": fine-tuning job_id,
            "status": status
    }

def checkModelStatus(fineTuningJobId):
    ...
    return {"fine-tuning job_id": fine-tuning job_id,
            "elapsed_tokens": elapsed_tokens,
            "elapsed_examples": elapsed_examples,
            "training_loss": training_loss,
            "training_sequence_accuracy": training_sequence_accuracy,
            "training_token_accuracy": training_token_accuracy
    }

```

```py=
#benchmark.py
def benchmark(contextInjection, inputData, finetunedModelId):
    #contextInjection為檔案路徑
    #inputData為檔案路徑
    #finetunedModelId為訓練完的模型id，user填入
    return ???
```
