Skip to content

Commit c986c74

Browse files
Merge pull request #210 from mistralai/doc/v0.0.131
Update docs to v0.0.131
2 parents 32293f8 + ce22c55 commit c986c74

File tree

1 file changed

+66
-10
lines changed

1 file changed

+66
-10
lines changed

docs/capabilities/finetuning.mdx

Lines changed: 66 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,21 @@ Conversational data between user and assistant, which can be one-turn or multi-t
7676
}
7777
```
7878

79+
Note that the files must be in JSONL format, meaning every JSON object must be flattened into a single line, and each JSON object is on a new line.
80+
<details>
81+
82+
<summary><b>Raw `.jsonl` file example.</b></summary>
83+
84+
```json
85+
{"messages": [{"role": "user","content": "..."},{"role": "assistant","content": "..."},...]}
86+
{"messages": [{"role": "user","content": "..."},{"role": "assistant","content": "..."},...]}
87+
{"messages": [{"role": "user","content": "..."},{"role": "assistant","content": "..."},...]}
88+
{"messages": [{"role": "user","content": "..."},{"role": "assistant","content": "..."},...]}
89+
...
90+
```
91+
92+
</details>
93+
7994
- Conversational data must be stored under the `"messages"` key as a list.
8095
- Each list item is a dictionary containing the `"content"` and `"role"` keys. `"role"` is a string: `"user"`, `"assistant"`, or `"system"`.
8196
- Loss computation is performed only on tokens corresponding to assistant messages (`"role" == "assistant"`).
@@ -261,12 +276,10 @@ created_jobs = client.fine_tuning.jobs.create(
261276
},
262277
auto_start=False
263278
)
264-
265-
# start a fine-tuning job
266-
client.fine_tuning.jobs.start(job_id = created_jobs.id)
267-
268-
created_jobs
269279
```
280+
281+
After creating a fine-tuning job, you can check the job status using
282+
`client.fine_tuning.jobs.get(job_id = created_jobs.id)`.
270283
</TabItem>
271284

272285
<TabItem value="typescript" label="typescript">
@@ -282,9 +295,10 @@ const createdJob = await client.fineTuning.jobs.create({
282295
},
283296
autoStart:false,
284297
});
285-
286-
await client.fineTuning.jobs.start({jobId: createdJob.id})
287298
```
299+
300+
After creating a fine-tuning job, you can check the job status using
301+
`client.fineTuning.jobs.get({ jobId: createdJob.id })`.
288302
</TabItem>
289303

290304
<TabItem value="curl" label="curl">
@@ -305,8 +319,50 @@ curl https://api.mistral.ai/v1/fine_tuning/jobs \
305319
"hyperparameters": {
306320
"training_steps": 10,
307321
"learning_rate": 0.0001
308-
}
322+
},
323+
"auto_start": false
309324
}'
325+
```
326+
327+
After creating a fine-tuning job, you can check the job status using:
328+
```bash
329+
curl https://api.mistral.ai/v1/fine_tuning/jobs/<jobid> \
330+
--header "Authorization: Bearer $MISTRAL_API_KEY" \
331+
--header 'Content-Type: application/json'
332+
```
333+
334+
</TabItem>
335+
336+
</Tabs>
337+
338+
Initially, the job status will be `"QUEUED"`.
339+
After a brief period, the status will update to `"VALIDATED"`.
340+
At this point, you can proceed to start the fine-tuning job:
341+
342+
<Tabs>
343+
<TabItem value="python" label="python" default>
344+
345+
```python
346+
# start a fine-tuning job
347+
client.fine_tuning.jobs.start(job_id = created_jobs.id)
348+
349+
created_jobs
350+
```
351+
</TabItem>
352+
353+
<TabItem value="typescript" label="typescript">
354+
355+
```typescript
356+
await client.fineTuning.jobs.start({jobId: createdJob.id})
357+
```
358+
</TabItem>
359+
360+
<TabItem value="curl" label="curl">
361+
362+
```bash
363+
curl -X POST https://api.mistral.ai/v1/fine_tuning/jobs/<jobid>/start \
364+
--header "Authorization: Bearer $MISTRAL_API_KEY" \
365+
--header 'Content-Type: application/json'
310366
```
311367
</TabItem>
312368

@@ -343,10 +399,10 @@ print(canceled_jobs)
343399
const jobs = await client.fineTuning.jobs.list();
344400

345401
// Retrieve a job
346-
const retrievedJob = await mistral.fineTuning.jobs.get({ jobId: createdJob.id })
402+
const retrievedJob = await client.fineTuning.jobs.get({ jobId: createdJob.id })
347403

348404
// Cancel a job
349-
const canceledJob = await mistral.fineTuning.jobs.cancel({
405+
const canceledJob = await client.fineTuning.jobs.cancel({
350406
jobId: createdJob.id,
351407
});
352408
```

0 commit comments

Comments
 (0)