交互式操作
排队前向操作
在交互式训练作业上排队一次不计算梯度的前向传播,然后轮询返回的 future_id,直到状态为 completed、failed 或 cancelled。
POST
https://api.fastino.ai
/
v1
/
training
/
jobs
/
{job_id}
/
forward
curl -X POST "https://api.fastino.ai/v1/training/jobs/$TRAINING_JOB_ID/forward" \
-H "X-API-Key: $FASTINO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"datums": [
{
"model_input": {"chunks": [{"type": "encoded_text", "tokens": [151644, 872, 198, 3838]}]},
"loss_fn_inputs": {
"target_tokens": {"data": [872, 198, 3838, 30], "dtype": "int64"}
}
}
]
}'
{
"future_id": "FUTURE_ID",
"job_id": "SESSION_ID:train:0",
"type": "forward"
}
POST /v1/training/jobs/{job_id}/forward
在不累积梯度的情况下计算一批数据的损失和逐 token 对数概率,可用于评估。请求体、响应和结果与
POST /v1/training/jobs/{job_id}/forward-backward
相同,operation 的 type 为 forward。
curl -X POST "https://api.fastino.ai/v1/training/jobs/$TRAINING_JOB_ID/forward" \
-H "X-API-Key: $FASTINO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"datums": [
{
"model_input": {"chunks": [{"type": "encoded_text", "tokens": [151644, 872, 198, 3838]}]},
"loss_fn_inputs": {
"target_tokens": {"data": [872, 198, 3838, 30], "dtype": "int64"}
}
}
]
}'
{
"future_id": "FUTURE_ID",
"job_id": "SESSION_ID:train:0",
"type": "forward"
}
此页面对您有帮助吗?
⌘I
curl -X POST "https://api.fastino.ai/v1/training/jobs/$TRAINING_JOB_ID/forward" \
-H "X-API-Key: $FASTINO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"datums": [
{
"model_input": {"chunks": [{"type": "encoded_text", "tokens": [151644, 872, 198, 3838]}]},
"loss_fn_inputs": {
"target_tokens": {"data": [872, 198, 3838, 30], "dtype": "int64"}
}
}
]
}'
{
"future_id": "FUTURE_ID",
"job_id": "SESSION_ID:train:0",
"type": "forward"
}

