Get Training Step Metrics
curl --request GET \
--url https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"items": [
{
"step": 123,
"rollout_wait_seconds": 123,
"training_seconds": 123,
"forward_backward_seconds": 123,
"optimizer_seconds": 123,
"weight_sync_seconds": 123,
"checkpoint_seconds": 123,
"trainer_tokens_per_second": 123,
"generated_tokens_per_second": 123,
"learning_rate": 123,
"kl_estimate_k3": 123,
"kl_estimate_k3_min": 123,
"kl_estimate_k3_max": 123,
"kl_estimate_k3_p25": 123,
"kl_estimate_k3_p50": 123,
"kl_estimate_k3_p75": 123,
"kl_estimate_k3_by_staleness": [
{
"staleness": 123,
"kl_estimate_k3": 123
}
],
"sequences_per_trajectory_mean": 123,
"sequences_per_trajectory_min": 123,
"sequences_per_trajectory_max": 123,
"sequences_per_trajectory_p25": 123,
"sequences_per_trajectory_p50": 123,
"sequences_per_trajectory_p75": 123
}
],
"has_more": true,
"training_run_id": "<string>",
"next_cursor": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_cursor",
"message": "<string>",
"doc_url": "<string>",
"context": {},
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "<string>",
"doc_url": "<string>",
"context": {},
"param": "<string>"
}
}{
"error": {
"type": "conflict_error",
"code": "conflict",
"message": "<string>",
"doc_url": "<string>",
"context": {},
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"context": {},
"param": "<string>"
}
}Training
Get Training Step Metrics
Trainer timing, throughput, sequences per trajectory and k3 KL estimates for each committed update of a training run, in ascending training-step order. Steps trained before these metrics were recorded do not appear, and fields added later are null on earlier steps.
GET
/
api
/
v1
/
train
/
{run_id}
/
step-metrics
Get Training Step Metrics
curl --request GET \
--url https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trajectory.ai/api/v1/train/{run_id}/step-metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"items": [
{
"step": 123,
"rollout_wait_seconds": 123,
"training_seconds": 123,
"forward_backward_seconds": 123,
"optimizer_seconds": 123,
"weight_sync_seconds": 123,
"checkpoint_seconds": 123,
"trainer_tokens_per_second": 123,
"generated_tokens_per_second": 123,
"learning_rate": 123,
"kl_estimate_k3": 123,
"kl_estimate_k3_min": 123,
"kl_estimate_k3_max": 123,
"kl_estimate_k3_p25": 123,
"kl_estimate_k3_p50": 123,
"kl_estimate_k3_p75": 123,
"kl_estimate_k3_by_staleness": [
{
"staleness": 123,
"kl_estimate_k3": 123
}
],
"sequences_per_trajectory_mean": 123,
"sequences_per_trajectory_min": 123,
"sequences_per_trajectory_max": 123,
"sequences_per_trajectory_p25": 123,
"sequences_per_trajectory_p50": 123,
"sequences_per_trajectory_p75": 123
}
],
"has_more": true,
"training_run_id": "<string>",
"next_cursor": "<string>"
}{
"error": {
"type": "invalid_request_error",
"code": "invalid_cursor",
"message": "<string>",
"doc_url": "<string>",
"context": {},
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "resource_not_found",
"message": "<string>",
"doc_url": "<string>",
"context": {},
"param": "<string>"
}
}{
"error": {
"type": "conflict_error",
"code": "conflict",
"message": "<string>",
"doc_url": "<string>",
"context": {},
"param": "<string>"
}
}{
"error": {
"type": "invalid_request_error",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"context": {},
"param": "<string>"
}
}