File size: 826 Bytes
78b611a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
"""
Minimal integration test for training endpoints.
"""
import time
import json
import requests

BASE = "http://localhost:8001"

print("1) Start a training job")
resp = requests.post(f"{BASE}/train/start", json={
    "dataset": "./sample_data/train.jsonl",
    "model_id": "unsloth/gemma-3n-E4B-it",
    "prompt_field": "prompt",
    "response_field": "response",
    "epochs": 1,
    "batch_size": 1,
    "gradient_accumulation": 8,
    "use_bf16": True,
    "dry_run": True
})
print(resp.status_code, resp.text)
resp.raise_for_status()
job = resp.json()
job_id = job["job_id"]
print("job_id=", job_id)

print("2) Poll status (10s)")
for _ in range(10):
    s = requests.get(f"{BASE}/train/status/{job_id}")
    print(s.status_code, json.dumps(s.json(), indent=2))
    time.sleep(1)

print("3) Done")