# 查询精调效果指标详细数据

> 全部文档的索引见 [llms.txt](https://ark.volcengine.com/llms.txt)；在任一文档页面地址后追加 `.md` 可获取该页的 Markdown 版本。

`POST https://ark.cn-beijing.volcengineapi.com/?Action=GetModelCustomizationJobMetricData&Version=2024-01-01`

查询精调效果指标详细数据接口，用于获取模型精调任务在训练过程中的效果指标（如 train/loss、eval/loss 等）的打点数据。

> **说明**
>
> - 指标数据按训练 Step 采样返回；当指定的 *MinSampleStep* 大于系统根据 *MaxMetricPoint* 计算出的步长时，以 *MinSampleStep* 为准。
> - 单次请求每个指标最多返回 *MaxMetricPoint* 个采样点，超出范围将自动降采样。
> - 指标数据仅在任务结束后保留有限时间，过期任务的指标可能无法查询。

## 鉴权

本接口支持鉴权方式如下，详情请参见 [Base URL 及鉴权](/docs/base-url-and-authentication)。

* Access Key 鉴权，请在 [Access Key 管理](https://console.volcengine.com/iam/keymanage) 页面，获取 Access Key。本接口仅支持 Access Key 鉴权。

---

<span id="request-parameters"></span>
## 请求参数

### Body 参数

**FromStep** `integer` `必选` | 查询的起点 step

**Metrics** `string[]` `必选` | 指标名称列表

指标名称列表。可通过 *GetModelCustomizationJobMetrics* 接口获取可用指标名，例如 `train/loss`、`eval/loss`、`train/total_tokens` 等。

**ModelCustomizationJobId** `string` `必选` | 精调任务 ID

精调任务 ID，格式如 mcj-20241128104838-g9vqg

**ToStep** `integer` `必选` | 查询的终点 step

**MaxMetricPoint** `string` `默认值 500` | 单个指标的最多返

单个指标最多返回的采样打点数上限。

**MinSampleStep** `string` | 最小采样步长

最小采样步长。当指定值大于系统根据 *MaxMetricPoint* 计算出的步长时，以此值生效。

## 响应参数

**Items** `object[]` | 指标数据列表

指标数据列表，每个元素包含一个指标的采样数据

**Metric** `string` | 指标名称

`Items.Metric`

**Samples** `object[]` | 指标数据

`Items.Samples`

**Step** `integer` | Step 序号

`Items.Samples.Step`

第几步

**Value** `string` | 打点值

`Items.Samples.Value`

上报的打点值


## 代码示例

## 默认

### cURL

#### Request

```bash
curl 'https://ark.cn-beijing.volcengineapi.com/?Action=GetModelCustomizationJobMetricData&Version=2024-01-01' \
  -H 'Content-Type: application/json' \
  -H 'X-Date: <X-Date>' \
  -H 'X-Content-Sha256: <X-Content-Sha256>' \
  -H 'Authorization: HMAC-SHA256 Credential=<AK>/<X-Date>/cn-beijing/ark/request, SignedHeaders=content-type;host;x-content-sha256;x-date, Signature=<Signature>' \
  -d '{
    "ModelCustomizationJobId": "mcj-20241128104838-g9vqg",
    "Metrics": [
        "train/total_tokens",
        "eval/loss",
        "train/loss",
        "eval/total_tokens"
    ]
}
'
```

#### Response

```
{
    "ResponseMetadata": {
        "RequestId": "20241212201041E7A67D3F69E447553B",
        "Action": "GetModelCustomizationJobMetricData",
        "Version": "2024-01-01",
        "Service": "ark",
        "Region": "cn-beijing"
    },
    "Result": {
        "Items": [
            {
                "Metric": "train/total_tokens",
                "Samples": [
                    {
                        "Step": 1,
                        "Value": 41422
                    },
                    {
                        "Step": 2,
                        "Value": 82844
                    }
                ]
            },
            {
                "Metric": "eval/loss",
                "Samples": [
                    {
                        "Step": 1,
                        "Value": 0.0725
                    },
                    {
                        "Step": 2,
                        "Value": 0.0625
                    }
                ]
            },
            {
                "Metric": "train/loss",
                "Samples": [
                    {
                        "Step": 1,
                        "Value": 0.0625
                    },
                    {
                        "Step": 2,
                        "Value": 0.0525
                    }
                ]
            }
        ]
    }
}
```
