环境镜像:vllm-ascend 0.18.0.rc1
客户模型:https://modelscope.cn/models/holywang11/vlm35b
权重目录:PP-cm35b-P2v4 ,penr300m_cm35b-non
测试脚本数据:scripts-v0180、chinese_images
#!/bin/sh
# Load model from ModelScope to speed up download.
export VLLM_USE_MODELSCOPE=True
# Reduce memory fragmentation and avoid out-of-memory errors.
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
export HCCL_OP_EXPANSION_MODE="AIV"
export HCCL_BUFFSIZE=1024
export OMP_NUM_THREADS=1
export OMP_PROC_BIND=false
export TASK_QUEUE_ENABLE=1
export ASCEND_RT_VISIBLE_DEVICES=4,5,6,7
# 开启确定性配置参数
export VLLM_BATCH_INVARIANT=1
export VLLM_ASCEND_ENABLE_NZ=0
export HCCL_DETERMINISTIC=true
export LCCL_DETERMINISTIC=1
export ATB_MATMUL_SHUFFLE_K_ENABLE=0
export ATB_LLM_LCOC_ENABLE=0
export PYTHONHASHSEED=42
export CLOSE_MATMUL_K_SHIFT=1
export PYTORCH_DETERMINISTIC=1
export ASCEND_LAUNCH_BLOCKING=1
export TORCH_NPU_ENABLE_DETERMINISTIC=1
# --enforce-eager
# --no-enable-prefix-caching
##########
vllm serve /home/w00634320/Qwen3-VL-30B-A3B-Instruct \
--host 0.0.0.0 \
--port 8022 \
--served-model-name qwen3-vl-30b \
--allowed-local-media-path "/home/w00634320/" \
--data-parallel-size 1 \
--tensor-parallel-size 4 \
--enable-expert-parallel \
--limit-mm-per-prompt '{"video": 1}' \
--media-io-kwargs '{"video": {"num_frames": -1, "fps": 1, "max_frames": 32, "min_frames": 2}}' \
--seed 1024 \
--max-num-seqs 32 \
--max-model-len 32768 \
--max-num-batched-tokens 16384 \
--gpu-memory-utilization 0.8 \
--mm-processor-cache-gb 0 \
--limit-mm-per-prompt.image 1 \
--trust-remote-code \
--enforce-eager \
--no-enable-prefix-caching
export STR_MODEL_PATH="/root/work/filestorage/liuguoshuai/data/infer_models/vllm-ascend/penr300m_cm35b-non/checkpoint-448-vllm"
export STR_MODEL_PATH="/root/work/filestorage/liyilong/vlmdev-260601/VLANM//checkpoints/PP-cm35b-P2v4-SFT-s260604-video-pix2016-0721/pp2non-checkpoint-2147"export VLLM_USE_MODELSCOPE=True
export VLLM_WORKER_MULTIPROC_METHOD=spawn
export PYTORCH_NPU_ALLOC_CONF=max_split_size_mb:256
export VLLM_USE_V1=1
export ASCEND_VISIBLE_DEVICES=0,1,2,3
export STR_MODEL_PATH="/root/work/filestorage/liuguoshuai/data/infer_models/vllm-ascend/penr300m_cm35b-non/checkpoint-448-vllm"
#export STR_MODEL_PATH="/root/work/filestorage/liyilong/vlmdev-260601/VLANM//checkpoints/PP-cm35b-P2v4-SFT-s260604-video-pix2016-0721/pp2non-checkpoint-2147"
# DEBUG使用
# export VLLM_TRACE_FUNCTION=1
# export PYTHONFAULTHANDLER=1
# export VLLM_LOGGING_LEVEL=DEBUG
# export STR_MODEL_PATH="/root/work/liuguoshuai/data/infer_models/vllm-ascend/penr300m_cm35b_v1"
# export STR_MODEL_PATH="/root/work/filestorage/liuguoshuai/data/infer_models/vllm-ascend/penr300m_cm35b-non/hftype"
export STR_MODELTYPE="jtvlm_penr300mcm35b"
export STR_TOOLPARSER_NAME="cm"
# 请参考 [docs/cmvideo.md]判断视频推理部分的参数设置
# --media-io-kwargs '{"video": {"num_frames": -1, "fps": 1, "max_frames": 16, "min_frames": 2}}' \
# --media-io-kwargs '{"video": {"num_frames": 32}}' \
# --"image": 2,
# --chat-template /root/work/filestorage/liuguoshuai/code/vllm-ascend-jtcv/data/cm40b_chenxiao.jinja2 \
export VLLM_LOGGING_LEVEL=INFO
export HCCL_DETERMINISTIC=true
export CLOSE_MATMUL_K_SHIFT=1
# ERROR 当设置1时
export VLLM_BATCH_INVARIANT=1
export VLLM_ASCEND_ENABLE_NZ=0
export HCCL_DETERMINISTIC=true
export LCCL_DETERMINISTIC=1
export ATB_MATMUL_SHUFFLE_K_ENABLE=0
export ATB_LLM_LCOC_ENABLE=0
export PYTHONHASHSEED=42
export CLOSE_MATMUL_K_SHIFT=1
export PYTORCH_DETERMINISTIC=1
export ASCEND_LAUNCH_BLOCKING=1
export TORCH_NPU_ENABLE_DETERMINISTIC=1
# warmup这里有日志可以打印
vllm serve ${STR_MODEL_PATH} \
--host 0.0.0.0 \
--port 8000 \
--served-model-name ${STR_MODELTYPE} \
--allowed-local-media-path "/root/work/" \
--limit-mm-per-prompt '{"video": 1}' \
--media-io-kwargs '{"video": {"num_frames": -1, "fps": 1, "max_frames": 32, "min_frames": 2}}' \
--tensor_parallel_size 4 \
--chat_template /root/work/filestorage/liuguoshuai/code/vllm-ascend-jtcv/data/cm40b_yourahelpful.jinja2 \
--gpu-memory-utilization 0.85 \
--max-num-seqs 32 \
--trust-remote-code \
--max-num-batched-tokens 8192 \
--enable-auto-tool-choice \
--tool-call-parser ${STR_TOOLPARSER_NAME} \
--enforce-eager \
--no-enable-prefix-caching \
--max-model-len 131072 2>&1 | tee ./logs/${STR_VLLM_VERSION}/${STR_MODELTYPE}/server_online.log
# --attention-backend FLASH_ATTN \
# --max-num-batched-tokens 131072 \
# --media-io-kwargs '{"video": {"num_frames": -1, "fps": 1, "max_frames": 16}}' \
# --media-io-kwargs '{"video": {"num_frames": 16}}' \
#--no-enable-prefix-caching \cd /root/work/wanglihua/code/vllm-ascend-jtcv
python scripts-v0180/penr300mcm35b/online_infer.py目前也可以直接参考 https://github.com/vllm-project/vllm-ascend/blob/main/csrc/build_batch_invariant_ops.sh 这个看下,A5的话,需要手动按照这个shell脚本将上面的链接包下载下来安装
# A2
bash build_batch_invariant_ops.sh ascend910b
# A3
bash build_batch_invariant_ops.sh ascend910_93build_batch_invariant_ops.sh脚本
torch\_npu < 2.10.0版本需要使用旧包安装,注释rm \-rf, 修改torch\_ops\_extension/batch\_invariant\_ops/csrc/fused\_infer\_attention\_score\_batch\_invariant.cpp高版本不需要做此操作
build_batch_invariant_ops.sh:
#!/bin/bash
set -euo pipefail
# arguments:
# $1: SOC_ARG (ascend910b, ascend910_93, ascend950)
SOC_ARG="${1:-}"
log() {
echo "[install_batch_invariant] $*"
}
# validate arguments
if [[ -z "${SOC_ARG}" ]]; then
log "ERROR: SOC_ARG is required as first argument"
exit 1
fi
log "Starting batch_invariant installation..."
log "SOC_ARG=${SOC_ARG}"
# determine device type from SOC_ARG
case "${SOC_ARG}" in
ascend910b)
BATCH_INVARIANT_DEVICE="910b"
;;
ascend910_93)
BATCH_INVARIANT_DEVICE="A3"
;;
*)
log "Warning: batch_invariant not available for SOC_ARG=${SOC_ARG}; skipping"
exit 0
;;
esac
# detect system architecture
ARCH_INFO=$(uname -m)
case "${ARCH_INFO}" in
aarch64)
ARCH_SUFFIX="aarch64"
;;
x86_64)
ARCH_SUFFIX="x86_64"
;;
*)
log "Warning: unknown architecture ${ARCH_INFO}; cannot determine batch_invariant package"
exit 0
;;
esac
# download and install run package
BATCH_INVARIANT_RUN_URL="https://vllm-ascend.obs.cn-north-4.myhuaweicloud.com/vllm-ascend/cann-ops-batch_invariant-${BATCH_INVARIANT_DEVICE}-1.0.0-linux.${ARCH_SUFFIX}.run"
BATCH_INVARIANT_RUN_FILE="cann-ops-batch_invariant-${BATCH_INVARIANT_DEVICE}-1.0.0-linux.${ARCH_SUFFIX}.run"
log "Downloading batch_invariant run package..."
unset ASCEND_CUSTOM_OPP_PATH
if curl --max-time 60 -sS -k -O "${BATCH_INVARIANT_RUN_URL}" && [[ -f "${BATCH_INVARIANT_RUN_FILE}" ]]; then
chmod +x "${BATCH_INVARIANT_RUN_FILE}"
log "Running installer: ${BATCH_INVARIANT_RUN_FILE}"
if "./${BATCH_INVARIANT_RUN_FILE}"; then
log "batch_invariant run package installed successfully"
else
log "Failed to install batch_invariant run package"
fi
else
log "Failed to download batch_invariant run package: ${BATCH_INVARIANT_RUN_URL}"
fi
# clean up downloaded run file (always clean, regardless of success/failure)
rm -f "${BATCH_INVARIANT_RUN_FILE}"
# download and install whl package
BATCH_INVARIANT_WHL_URL="https://vllm-ascend.obs.cn-north-4.myhuaweicloud.com/vllm-ascend/batch_invariant-torch_ops_extension-1.0.0.zip"
BATCH_INVARIANT_WHL_FILE="batch_invariant-torch_ops_extension-1.0.0.zip"
log "Downloading batch_invariant whl package..."
if curl --max-time 3 -sS -k -O "${BATCH_INVARIANT_WHL_URL}" >/dev/null 2>&1 && [[ -f "${BATCH_INVARIANT_WHL_FILE}" ]]; then
if unzip -o "${BATCH_INVARIANT_WHL_FILE}" >/dev/null 2>&1; then
if [[ -d "torch_ops_extension/batch_invariant_ops" ]]; then
cd torch_ops_extension/batch_invariant_ops
log "Building and installing batch_invariant whl package..."
if bash build_and_install.sh; then
log "batch_invariant whl package installed successfully"
else
log "Failed to build and install batch_invariant whl package"
fi
cd -
else
log "batch_invariant_ops directory not found in zip"
fi
else
log "Failed to unzip batch_invariant whl package"
fi
else
log "Failed to download batch_invariant whl package: ${BATCH_INVARIANT_WHL_URL}"
fi
# clean up downloaded files (always clean, regardless of success/failure)
rm -rf "${BATCH_INVARIANT_WHL_FILE}" torch_ops_extension
log "batch_invariant_ops build completed"fused_infer_attention_score_batch_invariant.cpp替换
https://gitcode.com/cann/ops-batchinvariant/pull/110
/**
* Copyright (c) 2025 Huawei Technologies Co., Ltd.
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
* CANN Open Software License Agreement Version 2.0 (the "License").
* Please refer to the License for details. You may not use this file except in compliance with the License.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
* See LICENSE in the root of the software repository for the full text of the License.
*/
#include <iostream>
#include <torch/library.h>
#include <torch/csrc/autograd/custom_function.h>
#include <torch_npu/csrc/core/npu/DeviceUtils.h>
#include <torch_npu/csrc/core/npu/NPUFormat.h>
#include <torch_npu/csrc/core/npu/NpuVariables.h>
#include "torch_npu/csrc/aten/NPUNativeFunctions.h"
#include "torch_npu/csrc/framework/utils/RandomOpAdapter.h"
#include "torch_npu/csrc/framework/utils/CalcuOpUtil.h"
#include "torch_npu/csrc/core/npu/NPUStream.h"
#include "pytorch_npu_helper.h"
#include <string>
#include <map>
using torch::autograd::Function;
using torch::autograd::AutogradContext;
using variable_list = std::vector<at::Tensor>;
const static int64_t DIM_0 = 0;
const static int64_t DIM_1 = 1;
const static int64_t DIM_2 = 2;
const static int64_t DIM_3 = 3;
const static int64_t INT4_PER_INT32 = 8;
const static int64_t DIM_4 = 4;
const static int64_t DIM_NUMS_3 = 3;
const static int64_t DIM_NUMS_4 = 4;
const static int SHAPE_3D = 3;
const static int SHAPE_4D = 4;
const static int SHAPE_5D = 5;
const static int64_t INT4_IN_INT32 = 8;
static std::pair<std::string, std::string> get_query_and_attention_out_layout(
const at::Tensor query,
std::string input_layout_str)
{
struct parserLayout {
std::string qLayout;
std::string outLayout;
int32_t qDim;
};
const std::map<std::string, parserLayout> LAYOUT_MAP = {
{"BSH", {"BSH", "BSH", DIM_NUMS_3}},
{"BSND", {"BSND", "BSND", DIM_NUMS_4}},
{"BNSD", {"BNSD", "BNSD", DIM_NUMS_4}},
{"TND", {"TND", "TND", DIM_NUMS_3}},
{"NTD", {"NTD", "NTD", DIM_NUMS_3}},
{"BNSD_BSND", {"BNSD", "BSND", DIM_NUMS_4}},
{"BSH_BNSD", {"BSH", "BNSD", DIM_NUMS_3}},
{"BSND_BNSD", {"BSND", "BNSD", DIM_NUMS_4}},
{"NTD_TND", {"NTD", "TND", DIM_NUMS_3}},
{"BSH_NBSD", {"BSH", "NBSD", DIM_NUMS_3}},
{"BSND_NBSD", {"BSND", "NBSD", DIM_NUMS_4}},
{"BNSD_NBSD", {"BNSD", "NBSD", DIM_NUMS_4}},
{"TND_NTD", {"TND", "NTD", DIM_NUMS_3}},
{"NSD", {"NSD", "NSD", DIM_NUMS_3}}
};
std::string query_layout = "BSH";
std::string attention_out_layout = "BSH";
int32_t query_dim = 0;
auto it = LAYOUT_MAP.find(input_layout_str);
if (it != LAYOUT_MAP.end()) {
query_layout = it->second.qLayout;
attention_out_layout = it->second.outLayout;
query_dim = it->second.qDim;
TORCH_CHECK(query.dim() == query_dim,
"query's dim should be consistent with that of Layout");
} else {
TORCH_CHECK(
false,
"layout only support BSH, BSND, TND, NTD, BNSD_BSND, BSH_BNSD, BSND_BNSD, NTD_TND, "
"BSH_NBSD, BSND_NBSD, BNSD_NBSD, TND_NTD, but got ",
query_layout);
}
return {query_layout, attention_out_layout};
}
static std::tuple<int64_t, int64_t, int64_t, int64_t> get_query_b_n_s_d(
const at::Tensor &query,
std::string query_layout,
int64_t num_heads)
{
int64_t b = 0;
int64_t n1 = 0;
int64_t s1 = 0;
int64_t d1 = 0;
if (query_layout == "BSH") {
b = query.size(DIM_0);
s1 = query.size(DIM_1);
n1 = num_heads;
d1 = query.size(DIM_2) / num_heads;
} else if (query_layout == "BSND") {
b = query.size(DIM_0);
s1 = query.size(DIM_1);
n1 = query.size(DIM_2);
d1 = query.size(DIM_3);
} else if (query_layout == "BNSD") {
b = query.size(DIM_0);
s1 = query.size(DIM_2);
n1 = query.size(DIM_1);
d1 = query.size(DIM_3);
} else if (query_layout == "NSD") {
b = 1;
s1 = query.size(DIM_1);
n1 = query.size(DIM_0);
d1 = query.size(DIM_2);
} else {
TORCH_CHECK(
false,
"It is not supported in get_query_b_n_s_d function, layout ",
query_layout);
}
return {b, n1, s1, d1};
}
static std::tuple<int64_t, int64_t, int64_t> get_query_t_n_d(
const at::Tensor &query,
std::string query_layout)
{
int64_t t = 0;
int64_t n1 = 0;
int64_t d1 = 0;
if (query_layout == "TND") {
t = query.size(DIM_0);
n1 = query.size(DIM_1);
d1 = query.size(DIM_2);
} else if (query_layout == "NTD") {
t = query.size(DIM_1);
n1 = query.size(DIM_0);
d1 = query.size(DIM_2);
} else {
TORCH_CHECK(
false,
"It is not supported in get_query_t_n_d function, layout ",
query_layout);
}
return {t, n1, d1};
}
static int64_t get_value_d(
const c10::optional<at::Tensor> &block_table,
const at::Tensor &query,
const at::Tensor &value,
std::string query_layout,
int64_t kv_num_heads)
{
int64_t valueD = 0;
if (block_table.has_value()) { // PA场景
if (value.dim() == SHAPE_3D) {
valueD = value.size(DIM_2) / kv_num_heads;
} else if (value.dim() == SHAPE_4D) {
valueD = value.size(DIM_3);
} else if (value.dim() == SHAPE_5D) {
valueD = value.size(DIM_2) * value.size(DIM_4);
} else {
TORCH_CHECK(
false,
"when Page Attention enabled, value's dim should be 3/4/5, but got ",
value.dim());
}
} else { // 非PA场景
TORCH_CHECK(
value.dim() == query.dim(),
"when Page Attention not enabled, value'dim should equal to query's dim!");
if (query_layout == "BSH") {
valueD = value.size(DIM_2) / kv_num_heads;
} else if (query_layout == "BSND" || query_layout == "BNSD") {
valueD = value.size(DIM_3);
} else if (query_layout == "TND" || query_layout == "NTD" || query_layout == "NSD") {
valueD = value.size(DIM_2);
}
}
return valueD;
}
static int get_change_d_scale(
const at::Tensor &value)
{
const static int changeDScale = 1;
const static int changeDForInt32 = 8;
// int4 伪装成 int32
if (value.scalar_type() == at::kInt) {
return changeDForInt32;
}
return changeDScale;
}
static at::Tensor infer_attention_out_shape(
std::string attention_out_layout,
const at::Tensor &query,
std::string query_layout,
int64_t num_heads,
int64_t valueD)
{
at::Tensor attention_out;
if (attention_out_layout == "BSH") {
auto [b, n1, s1, d1] = get_query_b_n_s_d(query, query_layout, num_heads);
int outH = num_heads * valueD;
outH = (outH == 0 || query.size(DIM_2) == 0) ? query.size(DIM_2) : outH;
attention_out = at::empty_symint(
{b, s1, outH},
query.options().dtype(query.dtype())
);
} else if (attention_out_layout == "BSND") {
auto [b, n1, s1, d1] = get_query_b_n_s_d(query, query_layout, num_heads);
int outD = valueD;
outD = (outD == 0 || d1 == 0) ? d1 : outD;
attention_out = at::empty_symint(
{b, s1, n1, outD},
query.options().dtype(query.dtype())
);
} else if (attention_out_layout == "BNSD") {
auto [b, n1, s1, d1] = get_query_b_n_s_d(query, query_layout, num_heads);
int outD = valueD;
outD = (outD == 0 || d1 == 0) ? d1 : outD;
attention_out = at::empty_symint(
{b, n1, s1, outD},
query.options().dtype(query.dtype())
);
} else if (attention_out_layout == "NBSD") {
auto [b, n1, s1, d1] = get_query_b_n_s_d(query, query_layout, num_heads);
int outD = valueD;
outD = (outD == 0 || d1 == 0) ? d1 : outD;
attention_out = at::empty_symint(
{n1, b, s1, outD},
query.options().dtype(query.dtype())
);
} else if (attention_out_layout == "TND") {
auto [t, n1, d1] = get_query_t_n_d(query, query_layout);
int outD = valueD;
outD = (outD == 0 || d1 == 0) ? d1 : outD;
attention_out = at::empty_symint(
{t, n1, outD},
query.options().dtype(query.dtype())
);
} else if (attention_out_layout == "NTD") {
auto [t, n1, d1] = get_query_t_n_d(query, query_layout);
int outD = valueD;
outD = (outD == 0 || d1 == 0) ? d1 : outD;
attention_out = at::empty_symint(
{n1, t, outD},
query.options().dtype(query.dtype())
);
} else if (attention_out_layout == "NSD") {
auto [b, n1, s1, d1] = get_query_b_n_s_d(query, query_layout, num_heads);
int outD = valueD;
outD = (outD == 0 || d1 == 0) ? d1 : outD;
attention_out = at::empty_symint(
{n1, s1, outD},
query.options().dtype(query.dtype())
);
}
return attention_out;
}
static at::Tensor infer_lse_out_shape(
std::string input_layout_str,
const at::Tensor &query,
std::string query_layout,
int64_t num_heads)
{
at::Tensor lse_out;
if (input_layout_str == "TND" || input_layout_str == "NTD" ||
input_layout_str == "TND_NTD" || input_layout_str == "NTD_TND") {
auto [t, n1, d1] = get_query_t_n_d(query, query_layout);
lse_out = at::empty_symint({t, n1, 1}, query.options().dtype(c10::ScalarType::Float));
} else {
auto [b, n1, s1, d1] = get_query_b_n_s_d(query, query_layout, num_heads);
lse_out = at::empty_symint({b, n1, s1, 1}, query.options().dtype(c10::ScalarType::Float));
}
return lse_out;
}
std::tuple<at::Tensor, at::Tensor> construct_fia_output_tensor(
const at::Tensor &query,
const at::Tensor &value,
std::string input_layout_str,
const c10::optional<at::Tensor> &quant_scale2,
const c10::optional<at::Tensor> &block_table,
int64_t num_heads,
int64_t num_key_value_heads,
bool softmax_lse_flag,
const c10::optional<at::Tensor> &query_rope)
{
TORCH_CHECK(
num_heads > 0,
"num_heads should be greater than 0, but the actual value is",
num_heads);
num_key_value_heads = (num_key_value_heads == 0) ? num_heads : num_key_value_heads;
// get query_layout, attention_out_layout
auto [query_layout, attention_out_layout] = get_query_and_attention_out_layout(query, input_layout_str);
// cal valueD
int64_t valueD = get_value_d(block_table, query, value, query_layout, num_key_value_heads);
// 计算changeDScale
int changeDScale = get_change_d_scale(value);
valueD = valueD * changeDScale;
// 推导attenout shape
at::Tensor tmp_output = infer_attention_out_shape(attention_out_layout, query, query_layout, num_heads, valueD);
at::Tensor output;
if (quant_scale2.has_value()) {
output = at::empty_symint(tmp_output.sym_sizes(), tmp_output.options().dtype(c10::ScalarType::Char));
} else if (query.dtype() == at::kChar) {
if (query_rope.has_value()) {
const at::Tensor query_rope_tensor = query_rope.value_or(at::Tensor());
output = at::empty_symint(tmp_output.sym_sizes(), tmp_output.options().dtype(query_rope_tensor.dtype()));
} else {
output = at::empty_symint(tmp_output.sym_sizes(), tmp_output.options().dtype(c10::ScalarType::Half));
}
} else {
output = at::empty_symint(tmp_output.sym_sizes(), tmp_output.options());
}
// infer lseout shape
at::Tensor softmax_lse;
if (softmax_lse_flag) {
softmax_lse = infer_lse_out_shape(input_layout_str, query, query_layout, num_heads);
} else {
softmax_lse = at::empty_symint({0}, query.options().dtype(c10::ScalarType::Float));
}
return std::tuple<at::Tensor, at::Tensor>(output, softmax_lse);
}
// 为NPU设备注册前向实现
std::tuple<at::Tensor, at::Tensor> npu_fused_infer_attention_score_batch_invariant_impl_npu(
const at::Tensor &query, const at::Tensor &key, const at::Tensor &value,
const c10::optional<at::Tensor> &pse_shift,
const c10::optional<at::Tensor> &atten_mask,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths_kv,
const c10::optional<at::Tensor> &dequant_scale1,
const c10::optional<at::Tensor> &quant_scale1,
const c10::optional<at::Tensor> &dequant_scale2,
const c10::optional<at::Tensor> &quant_scale2,
const c10::optional<at::Tensor> &quant_offset2,
const c10::optional<at::Tensor> &antiquant_scale,
const c10::optional<at::Tensor> &antiquant_offset,
const c10::optional<at::Tensor> &key_antiquant_scale,
const c10::optional<at::Tensor> &key_antiquant_offset,
const c10::optional<at::Tensor> &value_antiquant_scale,
const c10::optional<at::Tensor> &value_antiquant_offset,
const c10::optional<at::Tensor> &block_table,
const c10::optional<at::Tensor> &query_padding_size,
const c10::optional<at::Tensor> &kv_padding_size,
const c10::optional<at::Tensor> &key_shared_prefix,
const c10::optional<at::Tensor> &value_shared_prefix,
c10::OptionalArrayRef<c10::SymInt> actual_shared_prefix_len,
const c10::optional<at::Tensor> &query_rope,
const c10::optional<at::Tensor> &key_rope,
const c10::optional<at::Tensor> &key_rope_antiquant_scale,
int64_t num_heads, double scale,
int64_t pre_tokens, int64_t next_tokens,
c10::string_view input_layout, int64_t num_key_value_heads,
int64_t sparse_mode, int64_t inner_precise,
int64_t block_size, int64_t antiquant_mode,
int64_t key_antiquant_mode, int64_t value_antiquant_mode,
bool softmax_lse_flag
)
{
const c10::OptionalDeviceGuard device_guard(device_of(query));
// convert str
std::string input_layout_str = std::string(input_layout);
// construct the output tensor
std::tuple<at::Tensor, at::Tensor> fia_output = construct_fia_output_tensor(query, value, input_layout_str,
quant_scale2, block_table, num_heads, num_key_value_heads,
softmax_lse_flag, query_rope);
at::Tensor output = std::get<0>(fia_output);
at::Tensor softmax_lse = std::get<1>(fia_output);
std::vector<char> input_layout_buf(input_layout_str.begin(), input_layout_str.end());
input_layout_buf.push_back('\0');
char *input_layout_ptr = input_layout_buf.data();
at::TensorList valueTensors = value;
at::TensorList keyTensors = key;
at::Tensor default_dequant_scale_query {nullptr};
at::Tensor default_learnable_sink {nullptr};
at::Tensor default_q_start_idx {nullptr};
at::Tensor default_kv_start_idx {nullptr};
int64_t default_query_quant_mode = 0;
int64_t default_pse_type_value = 0;
auto actSeqLenQueryMiddle = actual_seq_lengths.value_or(at::ArrayRef<c10::SymInt>{});
auto actSeqLenQuery = c10::asIntArrayRefUnchecked(actSeqLenQueryMiddle);
auto actSeqLenKeyMiddle = actual_seq_lengths_kv.value_or(at::ArrayRef<c10::SymInt>{});
auto actSeqLenKey = c10::asIntArrayRefUnchecked(actSeqLenKeyMiddle);
const char* soc_name = aclrtGetSocName();
if (soc_name != nullptr) {
std::string soc_str(soc_name);
if (soc_str.find("950") != std::string::npos) {
EXEC_NPU_CMD(aclnnFusedInferAttentionScoreBatchInvariantV5, query, keyTensors, valueTensors, pse_shift, atten_mask, actual_seq_lengths, actual_seq_lengths_kv, dequant_scale1, quant_scale1, dequant_scale2,
quant_scale2, quant_offset2, antiquant_scale, antiquant_offset, block_table, query_padding_size, kv_padding_size, key_antiquant_scale, key_antiquant_offset, value_antiquant_scale,
value_antiquant_offset, key_shared_prefix, value_shared_prefix, actual_shared_prefix_len,
query_rope, key_rope, key_rope_antiquant_scale,
default_dequant_scale_query, default_learnable_sink, default_q_start_idx, default_kv_start_idx, // new
num_heads, scale, pre_tokens, next_tokens, input_layout_ptr,
num_key_value_heads, sparse_mode, inner_precise, block_size, antiquant_mode, softmax_lse_flag, key_antiquant_mode, value_antiquant_mode, default_query_quant_mode, default_pse_type_value, // new
output, softmax_lse);
} else {
EXEC_NPU_CMD(aclnnFusedInferAttentionScoreBatchInvariantV3, query, keyTensors, valueTensors, pse_shift, atten_mask, actSeqLenQuery, actSeqLenKey, dequant_scale1, quant_scale1, dequant_scale2,
quant_scale2, quant_offset2, antiquant_scale, antiquant_offset, block_table, query_padding_size, kv_padding_size, key_antiquant_scale, key_antiquant_offset, value_antiquant_scale,
value_antiquant_offset, key_shared_prefix, value_shared_prefix, actual_shared_prefix_len,
query_rope, key_rope, key_rope_antiquant_scale,
num_heads, scale, pre_tokens, next_tokens, input_layout_ptr,
num_key_value_heads, sparse_mode, inner_precise, block_size, antiquant_mode, softmax_lse_flag, key_antiquant_mode, value_antiquant_mode, output, softmax_lse);
}
}
return std::tuple<at::Tensor, at::Tensor>(output, softmax_lse);
}
// 为Meta设备注册前向实现
std::tuple<at::Tensor, at::Tensor> npu_fused_infer_attention_score_batch_invariant_impl_meta(
const at::Tensor &query, const at::Tensor &key, const at::Tensor &value,
const c10::optional<at::Tensor> &pse_shift,
const c10::optional<at::Tensor> &atten_mask,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths_kv,
const c10::optional<at::Tensor> &dequant_scale1,
const c10::optional<at::Tensor> &quant_scale1,
const c10::optional<at::Tensor> &dequant_scale2,
const c10::optional<at::Tensor> &quant_scale2,
const c10::optional<at::Tensor> &quant_offset2,
const c10::optional<at::Tensor> &antiquant_scale,
const c10::optional<at::Tensor> &antiquant_offset,
const c10::optional<at::Tensor> &key_antiquant_scale,
const c10::optional<at::Tensor> &key_antiquant_offset,
const c10::optional<at::Tensor> &value_antiquant_scale,
const c10::optional<at::Tensor> &value_antiquant_offset,
const c10::optional<at::Tensor> &block_table,
const c10::optional<at::Tensor> &query_padding_size,
const c10::optional<at::Tensor> &kv_padding_size,
const c10::optional<at::Tensor> &key_shared_prefix,
const c10::optional<at::Tensor> &value_shared_prefix,
c10::OptionalArrayRef<c10::SymInt> actual_shared_prefix_len,
const c10::optional<at::Tensor> &query_rope,
const c10::optional<at::Tensor> &key_rope,
const c10::optional<at::Tensor> &key_rope_antiquant_scale,
int64_t num_heads, double scale,
int64_t pre_tokens, int64_t next_tokens,
c10::string_view input_layout, int64_t num_key_value_heads,
int64_t sparse_mode, int64_t inner_precise,
int64_t block_size, int64_t antiquant_mode,
int64_t key_antiquant_mode, int64_t value_antiquant_mode,
bool softmax_lse_flag
)
{
// convert str
std::string input_layout_str = std::string(input_layout);
// construct the output tensor
std::tuple<at::Tensor, at::Tensor> fia_output = construct_fia_output_tensor(query, value, input_layout_str,
quant_scale2, block_table, num_heads, num_key_value_heads,
softmax_lse_flag, query_rope);
at::Tensor output = std::get<0>(fia_output);
at::Tensor softmax_lse = std::get<1>(fia_output);
return std::tuple<at::Tensor, at::Tensor>(output, softmax_lse);
}
// 通过继承torch::autograd::Function类实现前反向绑定
class FusedInferAttentionBatchInvariantFunction : public torch::autograd::Function<FusedInferAttentionBatchInvariantFunction> {
public:
static variable_list forward(
AutogradContext *ctx,
const at::Tensor &query, const at::Tensor &key, const at::Tensor &value,
const c10::optional<at::Tensor> &pse_shift,
const c10::optional<at::Tensor> &atten_mask,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths_kv,
const c10::optional<at::Tensor> &dequant_scale1,
const c10::optional<at::Tensor> &quant_scale1,
const c10::optional<at::Tensor> &dequant_scale2,
const c10::optional<at::Tensor> &quant_scale2,
const c10::optional<at::Tensor> &quant_offset2,
const c10::optional<at::Tensor> &antiquant_scale,
const c10::optional<at::Tensor> &antiquant_offset,
const c10::optional<at::Tensor> &key_antiquant_scale,
const c10::optional<at::Tensor> &key_antiquant_offset,
const c10::optional<at::Tensor> &value_antiquant_scale,
const c10::optional<at::Tensor> &value_antiquant_offset,
const c10::optional<at::Tensor> &block_table,
const c10::optional<at::Tensor> &query_padding_size,
const c10::optional<at::Tensor> &kv_padding_size,
const c10::optional<at::Tensor> &key_shared_prefix,
const c10::optional<at::Tensor> &value_shared_prefix,
c10::OptionalArrayRef<c10::SymInt> actual_shared_prefix_len,
const c10::optional<at::Tensor> &query_rope,
const c10::optional<at::Tensor> &key_rope,
const c10::optional<at::Tensor> &key_rope_antiquant_scale,
int64_t num_heads, double scale,
int64_t pre_tokens, int64_t next_tokens,
c10::string_view input_layout, int64_t num_key_value_heads,
int64_t sparse_mode, int64_t inner_precise,
int64_t block_size, int64_t antiquant_mode,
int64_t key_antiquant_mode, int64_t value_antiquant_mode,
bool softmax_lse_flag
)
{
at::AutoDispatchBelowADInplaceOrView guard;
static auto op = torch::Dispatcher::singleton()
.findSchemaOrThrow("batch_invariant_ops::npu_fused_infer_attention_score_batch_invariant", "")
.typed<decltype(npu_fused_infer_attention_score_batch_invariant_impl_npu)>();
auto result = op.call(query, key, value, pse_shift, atten_mask, actual_seq_lengths, actual_seq_lengths_kv, dequant_scale1, quant_scale1,
dequant_scale2, quant_scale2, quant_offset2, antiquant_scale, antiquant_offset, key_antiquant_scale, key_antiquant_offset,
value_antiquant_scale, value_antiquant_offset, block_table, query_padding_size, kv_padding_size, key_shared_prefix, value_shared_prefix,
actual_shared_prefix_len, query_rope, key_rope, key_rope_antiquant_scale, num_heads, scale, pre_tokens, next_tokens, input_layout,
num_key_value_heads, sparse_mode, inner_precise, block_size, antiquant_mode, key_antiquant_mode, value_antiquant_mode, softmax_lse_flag);
return {std::get<0>(result), std::get<1>(result)};
}
static variable_list backward(AutogradContext *ctx, variable_list grad_outputs)
{
return {};
}
};
// 使用的时候调用apply()方法
auto npu_fused_infer_attention_score_batch_invariant_autograd(
const at::Tensor &query, const at::Tensor &key, const at::Tensor &value,
const c10::optional<at::Tensor> &pse_shift,
const c10::optional<at::Tensor> &atten_mask,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths_kv,
const c10::optional<at::Tensor> &dequant_scale1,
const c10::optional<at::Tensor> &quant_scale1,
const c10::optional<at::Tensor> &dequant_scale2,
const c10::optional<at::Tensor> &quant_scale2,
const c10::optional<at::Tensor> &quant_offset2,
const c10::optional<at::Tensor> &antiquant_scale,
const c10::optional<at::Tensor> &antiquant_offset,
const c10::optional<at::Tensor> &key_antiquant_scale,
const c10::optional<at::Tensor> &key_antiquant_offset,
const c10::optional<at::Tensor> &value_antiquant_scale,
const c10::optional<at::Tensor> &value_antiquant_offset,
const c10::optional<at::Tensor> &block_table,
const c10::optional<at::Tensor> &query_padding_size,
const c10::optional<at::Tensor> &kv_padding_size,
const c10::optional<at::Tensor> &key_shared_prefix,
const c10::optional<at::Tensor> &value_shared_prefix,
c10::OptionalArrayRef<c10::SymInt> actual_shared_prefix_len,
const c10::optional<at::Tensor> &query_rope,
const c10::optional<at::Tensor> &key_rope,
const c10::optional<at::Tensor> &key_rope_antiquant_scale,
int64_t num_heads, double scale,
int64_t pre_tokens, int64_t next_tokens,
c10::string_view input_layout, int64_t num_key_value_heads,
int64_t sparse_mode, int64_t inner_precise,
int64_t block_size, int64_t antiquant_mode,
int64_t key_antiquant_mode, int64_t value_antiquant_mode,
bool softmax_lse_flag
)
{
return FusedInferAttentionBatchInvariantFunction::apply(query, key, value, pse_shift, atten_mask, actual_seq_lengths, actual_seq_lengths_kv,
dequant_scale1, quant_scale1, dequant_scale2, quant_scale2, quant_offset2, antiquant_scale, antiquant_offset, key_antiquant_scale, key_antiquant_offset,
value_antiquant_scale, value_antiquant_offset, block_table, query_padding_size, kv_padding_size, key_shared_prefix, value_shared_prefix,
actual_shared_prefix_len, query_rope, key_rope, key_rope_antiquant_scale, num_heads, scale, pre_tokens, next_tokens, input_layout,
num_key_value_heads, sparse_mode, inner_precise, block_size, antiquant_mode, key_antiquant_mode, value_antiquant_mode, softmax_lse_flag);
}
at::Tensor _npu_fused_infer_attention_score_batch_invariant_get_max_workspace_impl(
const at::Tensor &query, const at::Tensor &key, const at::Tensor &value,
const c10::optional<at::Tensor> &pse_shift,
const c10::optional<at::Tensor> &atten_mask,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths_kv,
const c10::optional<at::Tensor> &dequant_scale1,
const c10::optional<at::Tensor> &quant_scale1,
const c10::optional<at::Tensor> &dequant_scale2,
const c10::optional<at::Tensor> &quant_scale2,
const c10::optional<at::Tensor> &quant_offset2,
const c10::optional<at::Tensor> &antiquant_scale,
const c10::optional<at::Tensor> &antiquant_offset,
const c10::optional<at::Tensor> &key_antiquant_scale,
const c10::optional<at::Tensor> &key_antiquant_offset,
const c10::optional<at::Tensor> &value_antiquant_scale,
const c10::optional<at::Tensor> &value_antiquant_offset,
const c10::optional<at::Tensor> &block_table,
const c10::optional<at::Tensor> &query_padding_size,
const c10::optional<at::Tensor> &kv_padding_size,
const c10::optional<at::Tensor> &key_shared_prefix,
const c10::optional<at::Tensor> &value_shared_prefix,
c10::OptionalArrayRef<c10::SymInt> actual_shared_prefix_len,
const c10::optional<at::Tensor> &query_rope,
const c10::optional<at::Tensor> &key_rope,
const c10::optional<at::Tensor> &key_rope_antiquant_scale,
int64_t num_heads, double scale,
int64_t pre_tokens, int64_t next_tokens,
c10::string_view input_layout, int64_t num_key_value_heads,
int64_t sparse_mode, int64_t inner_precise,
int64_t block_size, int64_t antiquant_mode,
int64_t key_antiquant_mode, int64_t value_antiquant_mode,
bool softmax_lse_flag)
{
std::string input_layout_str = std::string(input_layout);
// construct the output tensor (needed for workspace size calculation)
std::tuple<at::Tensor, at::Tensor> fia_output = construct_fia_output_tensor(
query, value, input_layout_str, quant_scale2, block_table, num_heads, num_key_value_heads,
softmax_lse_flag, query_rope);
at::Tensor output = std::get<0>(fia_output);
at::Tensor softmax_lse = std::get<1>(fia_output);
std::vector<char> input_layout_buf(input_layout_str.begin(), input_layout_str.end());
input_layout_buf.push_back('\0');
char *input_layout_ptr = input_layout_buf.data();
at::TensorList valueTensors = value;
at::TensorList keyTensors = key;
at::Tensor default_dequant_scale_query{nullptr};
at::Tensor default_learnable_sink{nullptr};
at::Tensor default_q_start_idx{nullptr};
at::Tensor default_kv_start_idx{nullptr};
int64_t default_query_quant_mode = 0;
int64_t default_pse_type_value = 0;
uint64_t workspace_size = 0;
const char* soc_name = aclrtGetSocName();
if (soc_name != nullptr) {
std::string soc_str(soc_name);
if (soc_str.find("950") != std::string::npos) {
workspace_size = EXEC_GET_MAX_WORKSPACE_CMD(
aclnnFusedInferAttentionScoreBatchInvariantV5,
query, keyTensors, valueTensors, pse_shift, atten_mask,
actual_seq_lengths, actual_seq_lengths_kv,
dequant_scale1, quant_scale1, dequant_scale2,
quant_scale2, quant_offset2, antiquant_scale, antiquant_offset,
block_table, query_padding_size, kv_padding_size,
key_antiquant_scale, key_antiquant_offset,
value_antiquant_scale, value_antiquant_offset,
key_shared_prefix, value_shared_prefix, actual_shared_prefix_len,
query_rope, key_rope, key_rope_antiquant_scale,
default_dequant_scale_query, default_learnable_sink,
default_q_start_idx, default_kv_start_idx,
num_heads, scale, pre_tokens, next_tokens, input_layout_ptr,
num_key_value_heads, sparse_mode, inner_precise,
block_size, antiquant_mode, softmax_lse_flag,
key_antiquant_mode, value_antiquant_mode,
default_query_quant_mode, default_pse_type_value,
output, softmax_lse);
} else {
auto actSeqLenQueryMiddle = actual_seq_lengths.value_or(at::ArrayRef<c10::SymInt>{});
auto actSeqLenQuery = c10::asIntArrayRefUnchecked(actSeqLenQueryMiddle);
auto actSeqLenKeyMiddle = actual_seq_lengths_kv.value_or(at::ArrayRef<c10::SymInt>{});
auto actSeqLenKey = c10::asIntArrayRefUnchecked(actSeqLenKeyMiddle);
workspace_size = EXEC_GET_MAX_WORKSPACE_CMD(
aclnnFusedInferAttentionScoreBatchInvariantV3,
query, keyTensors, valueTensors, pse_shift, atten_mask,
actSeqLenQuery, actSeqLenKey,
dequant_scale1, quant_scale1, dequant_scale2,
quant_scale2, quant_offset2, antiquant_scale, antiquant_offset,
block_table, query_padding_size, kv_padding_size,
key_antiquant_scale, key_antiquant_offset,
value_antiquant_scale, value_antiquant_offset,
key_shared_prefix, value_shared_prefix, actual_shared_prefix_len,
query_rope, key_rope, key_rope_antiquant_scale,
num_heads, scale, pre_tokens, next_tokens, input_layout_ptr,
num_key_value_heads, sparse_mode, inner_precise,
block_size, antiquant_mode, softmax_lse_flag,
key_antiquant_mode, value_antiquant_mode,
output, softmax_lse);
}
}
at::Tensor workspace_tensor = at::empty(
{static_cast<int64_t>(workspace_size)}, query.options().dtype(query.dtype()));
return workspace_tensor;
}
std::tuple<at::Tensor &, at::Tensor &> npu_fused_infer_attention_score_out_batch_invariant_impl(
const at::Tensor &query, const at::Tensor &key, const at::Tensor &value,
const c10::optional<at::Tensor> &pse_shift,
const c10::optional<at::Tensor> &atten_mask,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths_kv,
const c10::optional<at::Tensor> &dequant_scale1,
const c10::optional<at::Tensor> &quant_scale1,
const c10::optional<at::Tensor> &dequant_scale2,
const c10::optional<at::Tensor> &quant_scale2,
const c10::optional<at::Tensor> &quant_offset2,
const c10::optional<at::Tensor> &antiquant_scale,
const c10::optional<at::Tensor> &antiquant_offset,
const c10::optional<at::Tensor> &key_antiquant_scale,
const c10::optional<at::Tensor> &key_antiquant_offset,
const c10::optional<at::Tensor> &value_antiquant_scale,
const c10::optional<at::Tensor> &value_antiquant_offset,
const c10::optional<at::Tensor> &block_table,
const c10::optional<at::Tensor> &query_padding_size,
const c10::optional<at::Tensor> &kv_padding_size,
const c10::optional<at::Tensor> &key_shared_prefix,
const c10::optional<at::Tensor> &value_shared_prefix,
c10::OptionalArrayRef<c10::SymInt> actual_shared_prefix_len,
const c10::optional<at::Tensor> &query_rope,
const c10::optional<at::Tensor> &key_rope,
const c10::optional<at::Tensor> &key_rope_antiquant_scale,
int64_t num_heads, double scale,
int64_t pre_tokens, int64_t next_tokens,
c10::string_view input_layout, int64_t num_key_value_heads,
int64_t sparse_mode, int64_t inner_precise,
int64_t block_size, int64_t antiquant_mode,
int64_t key_antiquant_mode, int64_t value_antiquant_mode,
bool softmax_lse_flag,
const c10::optional<at::Tensor> &workspace,
at::Tensor &attention_out,
at::Tensor &softmax_lse)
{
const c10::OptionalDeviceGuard device_guard(device_of(query));
std::string input_layout_str = std::string(input_layout);
std::vector<char> input_layout_buf(input_layout_str.begin(), input_layout_str.end());
input_layout_buf.push_back('\0');
char *input_layout_ptr = input_layout_buf.data();
at::TensorList valueTensors = value;
at::TensorList keyTensors = key;
at::Tensor default_dequant_scale_query{nullptr};
at::Tensor default_learnable_sink{nullptr};
at::Tensor default_q_start_idx{nullptr};
at::Tensor default_kv_start_idx{nullptr};
int64_t default_query_quant_mode = 0;
int64_t default_pse_type_value = 0;
auto actSeqLenQueryMiddle = actual_seq_lengths.value_or(at::ArrayRef<c10::SymInt>{});
auto actSeqLenQuery = c10::asIntArrayRefUnchecked(actSeqLenQueryMiddle);
auto actSeqLenKeyMiddle = actual_seq_lengths_kv.value_or(at::ArrayRef<c10::SymInt>{});
auto actSeqLenKey = c10::asIntArrayRefUnchecked(actSeqLenKeyMiddle);
const char* soc_name = aclrtGetSocName();
if (soc_name != nullptr) {
std::string soc_str(soc_name);
if (soc_str.find("950") != std::string::npos) {
if (workspace.has_value()) {
void* workspace_addr = const_cast<void *>(workspace.value().storage().data());
uint64_t workspace_size = static_cast<uint64_t>(
workspace.value().numel() * workspace.value().element_size());
EXEC_UPDATE_NPU_NO_FORMAT_CHECK_CMD(
aclnnFusedInferAttentionScoreBatchInvariantV5,
workspace_addr, workspace_size,
query, keyTensors, valueTensors, pse_shift, atten_mask,
actual_seq_lengths, actual_seq_lengths_kv,
dequant_scale1, quant_scale1, dequant_scale2,
quant_scale2, quant_offset2, antiquant_scale, antiquant_offset,
block_table, query_padding_size, kv_padding_size,
key_antiquant_scale, key_antiquant_offset,
value_antiquant_scale, value_antiquant_offset,
key_shared_prefix, value_shared_prefix, actual_shared_prefix_len,
query_rope, key_rope, key_rope_antiquant_scale,
default_dequant_scale_query, default_learnable_sink,
default_q_start_idx, default_kv_start_idx,
num_heads, scale, pre_tokens, next_tokens, input_layout_ptr,
num_key_value_heads, sparse_mode, inner_precise,
block_size, antiquant_mode, softmax_lse_flag,
key_antiquant_mode, value_antiquant_mode,
default_query_quant_mode, default_pse_type_value,
attention_out, softmax_lse);
} else {
EXEC_NPU_CMD(
aclnnFusedInferAttentionScoreBatchInvariantV5,
query, keyTensors, valueTensors, pse_shift, atten_mask,
actual_seq_lengths, actual_seq_lengths_kv,
dequant_scale1, quant_scale1, dequant_scale2,
quant_scale2, quant_offset2, antiquant_scale, antiquant_offset,
block_table, query_padding_size, kv_padding_size,
key_antiquant_scale, key_antiquant_offset,
value_antiquant_scale, value_antiquant_offset,
key_shared_prefix, value_shared_prefix, actual_shared_prefix_len,
query_rope, key_rope, key_rope_antiquant_scale,
default_dequant_scale_query, default_learnable_sink,
default_q_start_idx, default_kv_start_idx,
num_heads, scale, pre_tokens, next_tokens, input_layout_ptr,
num_key_value_heads, sparse_mode, inner_precise,
block_size, antiquant_mode, softmax_lse_flag,
key_antiquant_mode, value_antiquant_mode,
default_query_quant_mode, default_pse_type_value,
attention_out, softmax_lse);
}
} else {
if (workspace.has_value()) {
void* workspace_addr = const_cast<void *>(workspace.value().storage().data());
uint64_t workspace_size = static_cast<uint64_t>(
workspace.value().numel() * workspace.value().element_size());
EXEC_UPDATE_NPU_NO_FORMAT_CHECK_CMD(
aclnnFusedInferAttentionScoreBatchInvariantV3,
workspace_addr, workspace_size,
query, keyTensors, valueTensors, pse_shift, atten_mask,
actSeqLenQuery, actSeqLenKey,
dequant_scale1, quant_scale1, dequant_scale2,
quant_scale2, quant_offset2, antiquant_scale, antiquant_offset,
block_table, query_padding_size, kv_padding_size,
key_antiquant_scale, key_antiquant_offset,
value_antiquant_scale, value_antiquant_offset,
key_shared_prefix, value_shared_prefix, actual_shared_prefix_len,
query_rope, key_rope, key_rope_antiquant_scale,
num_heads, scale, pre_tokens, next_tokens, input_layout_ptr,
num_key_value_heads, sparse_mode, inner_precise,
block_size, antiquant_mode, softmax_lse_flag,
key_antiquant_mode, value_antiquant_mode,
attention_out, softmax_lse);
} else {
EXEC_NPU_CMD(
aclnnFusedInferAttentionScoreBatchInvariantV3,
query, keyTensors, valueTensors, pse_shift, atten_mask,
actSeqLenQuery, actSeqLenKey,
dequant_scale1, quant_scale1, dequant_scale2,
quant_scale2, quant_offset2, antiquant_scale, antiquant_offset,
block_table, query_padding_size, kv_padding_size,
key_antiquant_scale, key_antiquant_offset,
value_antiquant_scale, value_antiquant_offset,
key_shared_prefix, value_shared_prefix, actual_shared_prefix_len,
query_rope, key_rope, key_rope_antiquant_scale,
num_heads, scale, pre_tokens, next_tokens, input_layout_ptr,
num_key_value_heads, sparse_mode, inner_precise,
block_size, antiquant_mode, softmax_lse_flag,
key_antiquant_mode, value_antiquant_mode,
attention_out, softmax_lse);
}
}
}
return std::tuple<at::Tensor &, at::Tensor &>(attention_out, softmax_lse);
}
std::tuple<at::Tensor, at::Tensor> npu_fused_infer_attention_score_batch_invariant_out_impl(
const at::Tensor &query, const at::Tensor &key, const at::Tensor &value,
const c10::optional<at::Tensor> &pse_shift,
const c10::optional<at::Tensor> &atten_mask,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths,
c10::OptionalArrayRef<c10::SymInt> actual_seq_lengths_kv,
const c10::optional<at::Tensor> &dequant_scale1,
const c10::optional<at::Tensor> &quant_scale1,
const c10::optional<at::Tensor> &dequant_scale2,
const c10::optional<at::Tensor> &quant_scale2,
const c10::optional<at::Tensor> &quant_offset2,
const c10::optional<at::Tensor> &antiquant_scale,
const c10::optional<at::Tensor> &antiquant_offset,
const c10::optional<at::Tensor> &key_antiquant_scale,
const c10::optional<at::Tensor> &key_antiquant_offset,
const c10::optional<at::Tensor> &value_antiquant_scale,
const c10::optional<at::Tensor> &value_antiquant_offset,
const c10::optional<at::Tensor> &block_table,
const c10::optional<at::Tensor> &query_padding_size,
const c10::optional<at::Tensor> &kv_padding_size,
const c10::optional<at::Tensor> &key_shared_prefix,
const c10::optional<at::Tensor> &value_shared_prefix,
c10::OptionalArrayRef<c10::SymInt> actual_shared_prefix_len,
const c10::optional<at::Tensor> &query_rope,
const c10::optional<at::Tensor> &key_rope,
const c10::optional<at::Tensor> &key_rope_antiquant_scale,
int64_t num_heads, double scale,
int64_t pre_tokens, int64_t next_tokens,
c10::string_view input_layout, int64_t num_key_value_heads,
int64_t sparse_mode, int64_t inner_precise,
int64_t block_size, int64_t antiquant_mode,
int64_t key_antiquant_mode, int64_t value_antiquant_mode,
bool softmax_lse_flag,
const c10::optional<at::Tensor> &workspace,
c10::optional<at::TensorList> out,
c10::optional<at::Tensor> attention_out,
c10::optional<at::Tensor> softmax_lse)
{
at::Tensor attn_out_tensor, lse_tensor;
// 支持两种调用方式 (互斥):
// 1. out=[attention_out, softmax_lse] (合并传入)
// 2. attention_out=..., softmax_lse=... (分开传入)
bool has_out = out.has_value();
bool has_separate = attention_out.has_value() && softmax_lse.has_value();
TORCH_CHECK(!(has_out && has_separate),
"Cannot provide both 'out' and 'attention_out'/'softmax_lse' simultaneously. "
"Use either out=[attention_out, softmax_lse] or attention_out=..., softmax_lse=...");
if (has_out) {
TORCH_CHECK(out.value().size() == 2,
"out must contain exactly 2 tensors [attention_out, softmax_lse]");
attn_out_tensor = out.value()[0];
lse_tensor = out.value()[1];
} else if (has_separate) {
attn_out_tensor = attention_out.value();
lse_tensor = softmax_lse.value();
} else {
TORCH_CHECK(false,
"Must provide either out=[attention_out, softmax_lse] or "
"attention_out=... and softmax_lse=... separately");
}
npu_fused_infer_attention_score_out_batch_invariant_impl(
query, key, value, pse_shift, atten_mask,
actual_seq_lengths, actual_seq_lengths_kv,
dequant_scale1, quant_scale1, dequant_scale2,
quant_scale2, quant_offset2, antiquant_scale, antiquant_offset,
key_antiquant_scale, key_antiquant_offset,
value_antiquant_scale, value_antiquant_offset,
block_table, query_padding_size, kv_padding_size,
key_shared_prefix, value_shared_prefix, actual_shared_prefix_len,
query_rope, key_rope, key_rope_antiquant_scale,
num_heads, scale, pre_tokens, next_tokens,
input_layout, num_key_value_heads, sparse_mode, inner_precise,
block_size, antiquant_mode, key_antiquant_mode, value_antiquant_mode,
softmax_lse_flag, workspace, attn_out_tensor, lse_tensor);
return std::tuple<at::Tensor, at::Tensor>(attn_out_tensor, lse_tensor);
}
std::tuple<at::Tensor, at::Tensor> _npu_fused_infer_attention_score_batch_invariant_infer_output_impl(
const at::Tensor &query,
const at::Tensor &value,
c10::string_view input_layout,
const c10::optional<at::Tensor> &quant_scale2,
const c10::optional<at::Tensor> &block_table,
int64_t num_heads,
int64_t num_key_value_heads,
bool softmax_lse_flag,
const c10::optional<at::Tensor> &query_rope)
{
std::string input_layout_str = std::string(input_layout);
std::tuple<at::Tensor, at::Tensor> fia_output = construct_fia_output_tensor(
query, value, input_layout_str, quant_scale2, block_table, num_heads, num_key_value_heads,
softmax_lse_flag, query_rope);
return fia_output;
}
// 为NPU设备注册前反向实现
// NPU设备在pytorch 2.1及以上版本使用的设备名称是PrivateUse1,在2.1以下版本用的是XLA,如果是2.1以下版本PrivateUse1需要改成XLA
TORCH_LIBRARY_IMPL(batch_invariant_ops, PrivateUse1, m) {
m.impl("npu_fused_infer_attention_score_batch_invariant", &npu_fused_infer_attention_score_batch_invariant_impl_npu);
m.impl("_npu_fused_infer_attention_score_batch_invariant_get_max_workspace", &_npu_fused_infer_attention_score_batch_invariant_get_max_workspace_impl);
m.impl("npu_fused_infer_attention_score_batch_invariant_out", &npu_fused_infer_attention_score_out_batch_invariant_impl);
m.impl("npu_fused_infer_attention_score_batch_invariant.out", &npu_fused_infer_attention_score_batch_invariant_out_impl);
m.impl("_npu_fused_infer_attention_score_batch_invariant_infer_output", &_npu_fused_infer_attention_score_batch_invariant_infer_output_impl);
}
// 为Meta设备注册前反向实现
TORCH_LIBRARY_IMPL(batch_invariant_ops, Meta, m) {
m.impl("npu_fused_infer_attention_score_batch_invariant", &npu_fused_infer_attention_score_batch_invariant_impl_meta);
}
# Batch Invariant 算子白名单
本文件列出当前 skill 在分析 Ascend profiling op_statistic.csv 时视为 batch invariant 或可接受的算子名称。该白名单用于 triage 缩小嫌疑范围,不等价于这些算子在所有 shape、dtype、layout、TP 配置下都已完成独立证明。
`scripts/analyze_op_statistic.py` 会先根据芯片类型选择本文件中的分区,再解析对应分区表格 `算子名` 列中的反引号内容。
## 强制黑名单
以下五个基础算子名直接判定为不满足 batch invariance,优先级高于 A2/A3 和 A5 白名单;只有名称完全匹配时才命中黑名单:
| 基础算子名 | 黑名单规则 |
|------|------|
| `SoftmaxV2` | 精确匹配 `SoftmaxV2` |
| `MatMulV2` | 精确匹配 `MatMulV2` |
| `FusedInferAttentionScore` | 精确匹配 `FusedInferAttentionScore` |
| `AddRmsNorm` | 精确匹配 `AddRmsNorm` |
| `ReduceSum` | 精确匹配 `ReduceSum` |
名称已明确列在当前芯片白名单中的 BatchInvariant 算子不命中黑名单。不得据此把任意基础算子名直接拼接 `BatchInvariant` 作为替换方案;profiling 名称、模型或 vLLM-Ascend 源代码 API、注册入口和芯片实现可能并非一一对应。黑名单只检查白名单外算子;命中后先保留 `FAIL_BLACKLIST` 证据并跳过基础算子的单算子验证,再检查实际代码路径。只有替换实现、参数语义、芯片可用性和修改位置都能从当前代码确认时才可实施;无法确认时标记 `BLOCKED_REPLACEMENT_REQUIRES_USER_DECISION`,由用户确定修改方案。替换后重新 profiling,并对实际替换路径完成 10,000 条验证。
## A3 / A2
A2 暂时复用 A3 白名单。
| 类别 | 算子名 | 说明 |
|------|--------|------|
| Batch invariant custom op | `FusedInferAttentionScoreBatchInvariant` | attention score batch invariant 变体 |
| Batch invariant custom op | `SoftmaxV2BatchInvariant` | softmax batch invariant 变体 |
| Batch invariant custom op | `MatMulV2BatchInvariant` | matmul batch invariant 变体 |
| Batch invariant custom op | `AddRmsNormBatchInvariant` | add rms norm batch invariant 变体 |
| Batch invariant custom op | `ReduceSumBatchInvariant` | reduce sum batch invariant 变体 |
| Batch invariant custom op | `MatMulV3BatchInvariant` | matmul batch invariant 变体 |
| Tensor shape / data movement | `ScatterPaKvCache` | paged attention KV cache scatter 路径 |
| Tensor shape / data movement | `ScatterElementsV2` | scatter elements 路径 |
| Tensor shape / data movement | `Transpose` | shape 或数据搬移相关 |
| Tensor shape / data movement | `Tile` | shape 或数据搬移相关 |
| Tensor shape / data movement | `Slice` | shape 或数据搬移相关 |
| Tensor shape / data movement | `ReshapeAndCacheNdKernel` | KV cache reshape/cache 路径 |
| Tensor shape / data movement | `BroadcastTo` | shape 广播 |
| Tensor shape / data movement | `GatherV3` | gather 路径 |
| Tensor shape / data movement | `GatherV2` | gather 路径 |
| Tensor shape / data movement | `Index` | index 路径 |
| Tensor shape / data movement | `LinearIndex` | 线性索引/散射辅助路径 |
| Tensor shape / data movement | `Fill` | fill 路径 |
| Compute / elementwise | `SwiGlu` | 激活计算 |
| Compute / elementwise | `Sub` | elementwise |
| Compute / elementwise | `RealDiv` | elementwise |
| Compute / elementwise | `Neg` | elementwise |
| Compute / elementwise | `Mul` | elementwise |
| Compute / elementwise | `MaskedFill` | mask 填充 |
| Compute / elementwise | `LogicalNot` | logical |
| Compute / elementwise | `LogicalAnd` | logical |
| Compute / elementwise | `Log` | elementwise |
| Compute / elementwise | `Less` | compare |
| Compute / elementwise | `GreaterEqual` | compare |
| Compute / elementwise | `Cast` | dtype 转换 |
| Compute / elementwise | `Add` | elementwise |
| Compute / elementwise | `Abs` | elementwise |
| Compute / elementwise | `Exp` | elementwise |
| Reduction / selection | `ReduceMax` | reduction |
| Reduction / selection | `ArgMaxV2` | selection |
| Norm / projection | `RmsNorm` | normalization |
| MoE | `MoeTokenUnpermute` | MoE token restore |
| MoE | `MoeInitRoutingCustom` | MoE routing |
| MoE | `MoeInitRoutingV3` | MoE routing 初始化 |
| MoE | `MoeGatingTopK` | MoE gating top-k |
| MoE | `GroupedMatmul` | expert grouped matmul |
| Random / sampling | `DSARandomUniform` | 采样随机数路径,需结合 seed 和采样阶段判断 |
| vLLM / custom kernel | `_triton_rope` | rotary embedding kernel |
| vLLM / custom kernel | `_compute_slot_mapping_kernel` | slot mapping kernel |
| Communication | `allreduceAicpuKernel` | 通信相关,单独出现不代表失败 |
| Communication | `allgatherAicpuKernel` | 通信相关,单独出现不代表失败 |
| Communication | `hcom_allReduce` | HCCL 通信相关 |
| Communication | `hcom_allGather` | HCCL 通信相关 |
## A5
A5 指昇腾 950 系列。A5 与 A2/A3 使用相同的强制黑名单和白名单外算子处理规则:命中强制黑名单时先输出并保留 `FAIL_BLACKLIST`,再按实际代码和 A5 已安装实现确认是否存在可用替换;不得用 A2/A3 的同名实现外推。无法确认时标记 `BLOCKED_REPLACEMENT_REQUIRES_USER_DECISION`。白名单外且黑名单外时输出 `REVIEW_REQUIRED`,完成关键路径分析和必要的 10,000 条单算子验证后才能进入 Phase 2。
| 类别 | 算子名 | 说明 |
|------|--------|------|
| Batch invariant custom op | `MatMulV3BatchInvariant` | matmul batch invariant 变体 |
| Batch invariant custom op | `FusedInferAttentionScoreBatchInvariant` | attention score batch invariant 变体 |
| Batch invariant custom op | `ReduceSumBatchInvariant` | reduce sum batch invariant 变体 |
| Compute / elementwise | `GroupedMatmul` | expert grouped matmul |
| Compute / elementwise | `RmsNorm` | normalization |
| Compute / elementwise | `Slice` | slice 路径 |
| Compute / elementwise | `Add` | elementwise |
| Compute / elementwise | `SwiGlu` | 激活计算 |
| Compute / elementwise | `RealDiv` | elementwise |
| Compute / elementwise | `Cast` | dtype 转换 |
| Compute / elementwise | `Fill` | fill 路径 |
| Compute / elementwise | `Sub` | elementwise |
| MoE | `MoeInitRoutingV3` | MoE routing 初始化 |
| MoE | `MoeGatingTopK` | MoE gating top-k |
| MoE | `MoeFinalizeRoutingV2` | MoE routing 完成 |
| Tensor shape / data movement | `ScatterPaKvCache` | paged attention KV cache scatter 路径 |
| Tensor shape / data movement | `Index` | index 路径 |
| Tensor shape / data movement | `Tile` | shape 或数据搬移相关 |
| Tensor shape / data movement | `Embedding` | embedding 查表路径 |
| Tensor shape / data movement | `GatherV2` | gather 路径 |
| Tensor shape / data movement | `BroadcastTo` | shape 广播 |
| Tensor shape / data movement | `TensorMove` | 张量搬移路径 |
| Tensor shape / data movement | `ScatterElementsV2` | scatter elements 路径 |
| Reduction / selection | `ArgMaxV2` | selection |
| vLLM / custom kernel | `_triton_rope` | rotary embedding kernel |
| vLLM / custom kernel | `_compute_slot_mapping_kernel` | slot mapping kernel |vllm_ascend/ops/triton/batch_invariant/matmul.py:
def linear_batch_invariant(input_, weight, bias=None):
if input_.dim() > 2: # 折叠 ND -> 2D, ViT qkv 能过
leading = input_.shape[:-1]
K = input_.shape[-1]
out2d = linear_persistent(input_.reshape(-1, K), weight)
output = out2d.reshape(*leading, -1)
else:
output = linear_persistent(input_, weight)
if bias is not None:
output = output + bias
return output
测试结果
curl -X POST http://127.0.0.1:8022/start_profile;sleep 20;curl -X POST http://127.0.0.1:8022/stop_profile
python scripts-v0180/penr300mcm35b/online_infer.py > logs/v0180/jtvlm_penr300mcm35b/request.log1101
--profiler-config '{"profiler": "torch", "torch_profiler_dir": "/root/work/wanglihua/code/vllm-ascend-jtcv/jtvlm-prof01", "torch_profiler_with_stack": false}'
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然柔和,针脚",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然柔和,针脚",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然柔和,针脚",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "这张图片展示的是位于英国伦敦的著名历史建筑——**The Anchor Tavern(锚酒馆)**,它坐落在泰晤士河南岸的**Southwark**地区,靠近伦敦桥和伦敦塔桥。\n\n---\n\n### 🏛️ 建筑特色:\n\n- **建造年代**:建筑上明确标示“BUILT 1615”,表明它建于17世纪初,是伦敦现存最古老的酒馆之一。\n- **建筑风格**:典型的都铎式(Tudor-style)砖砌建筑,深色砖墙搭配鲜艳的红色木框窗户,",
"content": "这幅图片展示了一座具有历史感的建筑,名为“THE ANCHOR”,建于1615年。建筑的外墙是砖砌的,窗户和门框都涂成了鲜艳的红色,显得非常醒目。窗户上装饰着花盆,里面种满了鲜花,增添了生机和色彩。建筑的正面有一个标志,上面写着“THE ANCHOR”和“BUILT 1615”,表明了这座建筑的历史悠久。\n\n在建筑的前面,有一个户外的座位区,摆放着几张桌子和椅子,供人们休息和用餐。座位区的围栏上",
"content": "这幅图片展示了一座具有历史感的建筑,名为“THE ANCHOR”,建于1615年。建筑的外墙是砖砌的,窗户和门框都涂成了鲜艳的红色,显得非常醒目。窗户上装饰着花盆,里面种满了鲜花,增添了生机和色彩。建筑的正面有一个标志,上面写着“THE ANCHOR”和“BUILT 1615”,表明了这座建筑的历史悠久。\n\n在建筑的前面,有一个户外的座位区,摆放着几张桌子和椅子,供人们休息和用餐。座位区的围栏上",
"content": "这幅图片展示了一座具有历史感的建筑,名为“THE ANCHOR”,建于1615年。建筑的外墙是砖砌的,窗户和门框都涂成了鲜艳的红色,显得非常醒目。窗户上装饰着花盆,里面种满了鲜花,增添了生机和色彩。建筑的正面有一个标志,上面写着“THE ANCHOR”和“BUILT 1615”,表明了这座建筑的历史悠久。\n\n在建筑的前面,有一个户外的座位区,摆放着几张桌子和椅子,供人们休息和用餐。座位区的围栏上",
"content": "这幅图片展示了一座具有历史感的建筑,名为“THE ANCHOR”,建于1615年。建筑的外墙是砖砌的,窗户和门框都涂成了鲜艳的红色,显得非常醒目。窗户上装饰着花盆,里面种满了鲜花,增添了生机和色彩。建筑的正面有一个标志,上面写着“THE ANCHOR”和“BUILT 1615”,表明了这座建筑的历史悠久。\n\n在建筑的前面,有一个户外的座位区,摆放着几张桌子和椅子,供人们休息和用餐。座位区的围栏上",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
=============关闭确定性计算:
图片2:str_image_path = "/root/work/filestorage/test_toolkits/merge_data/mmmu_pro_10c/images/MMMU_Pro_10c/test_Sociology_191_0.png"
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、戏剧性的视觉效果。\n- **地面",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、戏剧性的视觉效果。\n- **地面",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n画面中央是一个被从中间撕裂的房屋剪影,象征着一个家庭的“家”被破坏或分裂。房屋的裂口清晰可见,仿佛是暴力或决裂的痕迹。\n\n在房屋的左右两侧,分别站立着两个家庭单位:\n\n- **左侧**:一位成年女性牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一位成年男性牵着一个小男孩的手,代表父亲和孩子。\n\n两个家庭单位被“破碎的家”",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、戏剧性的视觉效果。\n- **地面",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n画面中央是一个被从中间撕裂的房屋剪影,象征着一个家庭的“家”被破坏或分裂。房屋的裂痕清晰可见,仿佛是暴力或决裂的痕迹。\n\n在房屋的左右两侧,分别站立着两个家庭单位:\n\n- **左侧**:一位成年女性牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一位成年男性牵着一个小男孩的手,代表父亲和孩子。\n\n两个家庭单位被“破碎的家”",
图片3:#str_image_path = "/root/work/filestorage/liuguoshuai/code/vllm-ascend-jtcv/scripts-v0180/penr300mcm35b/5_decoded.png"
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承地,当地至今保留有大量苏绣传承人、苏绣工坊与相关非遗保护项目。\n---\n### 补充说明\n图中的团扇是苏绣的典型应用载体,扇面的花鸟",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承地,当地至今保留了大量苏绣传承人、苏绣工坊与相关文化活动。\n---\n### 工艺特点(结合图中器物特征)\n1. **针法精细**:图中",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **工艺特征**:图中团扇的刺绣针法细腻,色彩过渡自然,花卉、禽鸟的形态刻画生动,",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承地,当地至今保留有大量苏绣传承人、苏绣工坊与相关文化活动。\n---\n### 补充说明\n图中的团扇是苏绣的典型应用载体,扇面的花鸟纹",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承地,当地至今保留了大量苏绣传承人、苏绣工坊与相关文化活动。\n---\n### 工艺特点(结合图中器物特征)\n1. **针法精细**:图中",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承地,当地至今保留有大量苏绣传承人、苏绣工坊与相关非遗保护项目。\n---\n### 补充说明\n图中的团扇是苏绣的典型应用载体,扇面的花鸟",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承地,当地至今保留了大量苏绣传承人、苏绣工坊与相关文化活动。\n---\n### 补充说明\n图中的团扇是苏绣的典型应用载体,扇面的花鸟纹",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承地,当地至今保留了大量苏绣传承人、苏绣工坊与相关文化活动。\n---\n### 补充说明\n图中的团扇是苏绣的典型应用载体,扇面的花鸟纹",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然柔和,针脚",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承地,当地至今保留有大量苏绣传承人、苏绣工坊与相关文化活动。\n---\n### 补充说明\n图中的团扇是苏绣的典型应用载体,扇面的花鸟纹",
=============开启确定性计算:
# ERROR 当设置1时
export VLLM_BATCH_INVARIANT=0
export VLLM_ASCEND_ENABLE_NZ=0
export HCCL_DETERMINISTIC=true
export LCCL_DETERMINISTIC=1
export ATB_MATMUL_SHUFFLE_K_ENABLE=0
export ATB_LLM_LCOC_ENABLE=0
export PYTHONHASHSEED=42
export CLOSE_MATMUL_K_SHIFT=1
export PYTORCH_DETERMINISTIC=1
export ASCEND_LAUNCH_BLOCKING=1
export TORCH_NPU_ENABLE_DETERMINISTIC=1
图片2:
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
"content": "这幅图片是一幅具有象征意义的黑白剪影艺术作品,主题是**家庭破裂或离婚**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂的房屋剪影,象征“家”的破碎。\n- **左侧**:一个女性剪影牵着一个小女孩的手,代表母亲和孩子。\n- **右侧**:一个男性剪影牵着一个小男孩的手,代表父亲和孩子。\n- **背景**:纯白色渐变背景,突出黑色剪影,营造简洁、冷峻、略带伤感的氛围。\n-",
图片3:
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然柔和,针脚",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南地区最具代表性的传统刺绣工艺,苏州也是苏绣的核心传承、发展区域。\n---\n### 工艺与器物特点\n1. **苏绣工艺特征**:图中团扇的刺绣针法细腻,花卉、禽鸟的色彩过渡自然,丝线光泽",
=============开启确定性计算+关闭prefix-cache+seed_all
from msprobe.pytorch import seed_all
seed_all(seed=1234, mode=True, rm_dropout=True)
图片3:
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南苏杭地区最具代表性的传统工艺品类,这类团扇也是江南地区古代女性常用的纳凉、装饰类日用品,是江南传统生活文化的典型载体。\n---\n### 工艺特征(结合图中器物)\n1. **绣工特点**:图中团扇",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南苏杭地区最具代表性的传统工艺品类,这类团扇也是江南地区古代女性常用的纳凉、装饰类日用品,是江南传统生活文化的典型载体。\n---\n### 工艺特征(结合图中器物)\n1. **绣工特点**:图中团扇",
"content": "### 所属传统工艺\n这是**苏绣团扇**,核心工艺为苏绣,是中国四大名绣(苏绣、湘绣、粤绣、蜀绣)之一,属于国家级非物质文化遗产。\n---\n### 所属地域\n苏绣的发源地为**中国江苏省苏州市**,是江南苏杭地区最具代表性的传统工艺品类,这类团扇也是江南地区古代女性常用的纳凉、装饰类日用品,是江南传统生活文化的典型载体。\n---\n### 工艺特征(结合图中器物)\n1. **绣工特点**:图中团扇",
=============开启确定性计算+关闭prefix-cache+seed_all
权重换成:/root/work/filestorage/liyilong/vlmdev-260601/VLANM//checkpoints/PP-cm35b-P2v4-SFT-s260604-video-pix2016-0721/pp2non-checkpoint-2147/
图片3:
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
图2:
"content": "这幅图片是一幅具有强烈象征意义的黑白剪影艺术作品,主题围绕**家庭破裂、离婚或家庭分离**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂成两半的“房子”剪影。房子是家庭、稳定与归属感的普遍象征,其破碎直接传达出家庭结构的瓦解。\n- **左右两侧人物**:\n - 左侧:一位女性(可能是母亲)牵着一个小女孩的手,两人并肩站立,面向右侧。\n - 右侧:一位男性(可能是父亲",
"content": "这幅图片是一幅具有强烈象征意义的黑白剪影艺术作品,主题围绕**家庭破裂、离婚或家庭分离**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂成两半的“房子”剪影。房子是家庭、稳定与归属感的普遍象征,其破碎直接传达出家庭结构的瓦解。\n- **左右两侧人物**:\n - 左侧:一位女性(可能是母亲)牵着一个小女孩的手,两人并肩站立,面向右侧。\n - 右侧:一位男性(可能是父亲",
"content": "这幅图片是一幅具有强烈象征意义的黑白剪影艺术作品,主题围绕**家庭破裂、离婚或家庭分离**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂成两半的“房子”剪影。房子是家庭、稳定与归属感的普遍象征,其破碎直接传达出家庭结构的瓦解。\n- **左右两侧人物**:\n - 左侧:一位女性(可能是母亲)牵着一个小女孩的手,两人并肩站立,面向右侧。\n - 右侧:一位男性(可能是父亲",
"content": "这幅图片是一幅具有强烈象征意义的黑白剪影艺术作品,主题围绕**家庭破裂、离婚或家庭分离**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂成两半的“房子”剪影。房子是家庭、稳定与归属感的普遍象征,其破碎直接传达出家庭结构的瓦解。\n- **左右两侧人物**:\n - 左侧:一位女性(可能是母亲)牵着一个小女孩的手,两人并肩站立,面向右侧。\n - 右侧:一位男性(可能是父亲",
"content": "这幅图片是一幅具有强烈象征意义的黑白剪影艺术作品,主题围绕**家庭破裂、离婚或家庭分离**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂成两半的“房子”剪影。房子是家庭、稳定与归属感的普遍象征,其破碎直接传达出家庭结构的瓦解。\n- **左右两侧人物**:\n - 左侧:一位女性(可能是母亲)牵着一个小女孩的手,两人并肩站立,面向右侧。\n - 右侧:一位男性(可能是父亲",
=============开启确定性计算+seed_all
权重换成:/root/work/filestorage/liyilong/vlmdev-260601/VLANM//checkpoints/PP-cm35b-P2v4-SFT-s260604-video-pix2016-0721/pp2non-checkpoint-2147/
图片3:
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采用并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采用并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采用并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采用并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采用并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采用并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
图2:
"content": "这幅图片是一幅具有强烈象征意义的黑白剪影艺术作品,主题围绕**家庭破裂、离婚或家庭分离**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂成两半的“房子”剪影。房子是家庭、稳定与归属感的普遍象征,其破碎直接传达出家庭结构的瓦解。\n- **左右两侧人物**:\n - 左侧:一位女性(可能是母亲)牵着一个小女孩的手,两人并肩站立,面向右侧。\n - 右侧:一位男性(可能是父亲",
"content": "这幅图片是一幅具有强烈象征意义的黑白剪影艺术作品,主题围绕**家庭破裂、离婚或家庭分离**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂成两半的“房子”剪影。房子是家庭、稳定与归属感的普遍象征,其破碎直接传达出家庭结构的瓦解。\n- **左右两侧人物**:\n - 左侧:一位女性(可能是母亲)牵着一个小女孩的手,两人并肩站立,面向右侧。\n - 右侧:一位男性(可能是父亲",
"content": "这幅图片是一幅具有强烈象征意义的黑白剪影艺术作品,主题围绕**家庭破裂、离婚或家庭分离**。\n\n---\n\n### 🖼️ 图像内容描述:\n\n- **中心主体**:一个被从中间撕裂成两半的“房子”剪影。房子是家庭、稳定与归属感的普遍象征,其破碎直接传达出家庭结构的瓦解。\n- **左右两侧人物**:\n - 左侧:一位女性(可能是母亲)牵着一个小女孩的手,两人并肩站立,面向右侧。\n - 右侧:一位男性(可能是父亲",
=============开启确定性计算+关闭prefix-cache
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
"content": "这是一把**清代宫廷风格的刺绣团扇**,其核心传统工艺是**苏绣(或广义的“宫廷刺绣”)**,属于**中国江南地区(以苏州为中心)**的传统工艺,后被清代宫廷广泛采纳并发展为“京绣”或“宫廷绣”。\n\n---\n\n### 一、工艺识别:刺绣(苏绣为主)\n\n从图像可见:\n\n- 扇面为织物底(可能是缎或锦),上面绣有花鸟图案;\n- 针法细腻,色彩过渡自然,花瓣层次分明,鸟羽质感逼真——",
================
/root/work/filestorage/test_toolkits/self-built-data/chinese/images/1.jpeg
你帮我看看这是什么书法作品,作者是谁?
"content": "这是一幅非常著名的书法拓片,出自唐代大书法家**颜真卿**之手。\n\n### 1. 作品名称\n**《颜勤礼碑》**(全称《唐故秘书省著作郎夔州都督府长史上护军颜君神道碑》)。\n\n### 2. 作者\n**颜真卿**(709年-785年),字清臣,唐代中期杰出的书法家、政治家。他是“颜体”楷书的创始人,与柳公权并称“颜筋柳骨”。\n\n### 3. 图片",
"content": "这是一幅非常著名的书法拓片,出自唐代大书法家**颜真卿**之手。\n\n### 1. 作品名称\n**《颜勤礼碑》**(全称《唐故秘书省著作郎夔州都督府长史上护军颜君神道碑》)。\n\n### 2. 作者\n**颜真卿**(709年-785年),字清臣,唐代中期杰出的书法家、政治家。他是“颜体”楷书的创始人,与柳公权并称“颜筋柳骨”。\n\n### 3. 图片",
"content": "这是一幅非常著名的书法拓片,出自唐代大书法家**颜真卿**之手。\n\n### 1. 作品名称\n**《颜勤礼碑》**(全称《唐故秘书省著作郎夔州都督府长史上护军颜君神道碑》)。\n\n### 2. 作者\n**颜真卿**(709年-785年),字清臣,唐代中期杰出的书法家、政治家。他是“颜体”楷书的创始人,与柳公权并称“颜筋柳骨”。\n\n### 3. 图片",
/root/work/filestorage/test_toolkits/self-built-data/chinese/images/1.jpeg
这个书法是什么书体,有什么典型的特征?
"content": "### 1. 书体判断\n\n这幅书法作品属于**楷书**(Regular Script),具体风格上属于**魏碑**(Wei Bei)或**北碑**风格。\n\n从图片中的文字内容(“九成宫泉铭”、“侍中钜鹿郡”、“公臣魏徵奉”)可以判断,这是唐代著名碑刻《**九成宫醴泉铭**》的局部拓片。\n\n### 2. 典型特征分析\n\n虽然《九成宫醴泉铭》通常被归类为“唐楷”的典范(由欧阳询书写),但",
"content": "### 1. 书体判断\n\n这幅书法作品属于**楷书**(Regular Script),具体风格上属于**魏碑**(Wei Bei)或**北碑**风格。\n\n从图片中的文字内容(“九成宫泉铭”、“侍中钜鹿郡”、“公臣魏徵奉”)可以判断,这是唐代著名碑刻《**九成宫醴泉铭**》的局部拓片。\n\n### 2. 典型特征分析\n\n虽然《九成宫醴泉铭》通常被归类为“唐楷”的典范(由欧阳询书写),但",
"content": "### 1. 书体判断\n\n这幅书法作品属于**楷书**(Regular Script),具体风格上属于**魏碑**(Wei Bei)或**北碑**风格。\n\n从图片中的文字内容(“九成宫泉铭”、“侍中钜鹿郡”、“公臣魏徵奉”)可以判断,这是唐代著名碑刻《**九成宫醴泉铭**》的局部拓片。\n\n### 2. 典型特征分析\n\n虽然《九成宫醴泉铭》通常被归类为“唐楷”的典范(由欧阳询书写),但",
/root/work/filestorage/test_toolkits/self-built-data/chinese/images/1.jpeg
这幅作品为什么在书法史上有这么高的地位?
"content": "这幅作品是唐代著名书法家**颜真卿**的代表作之一——《**颜勤礼碑**》(全称《唐故秘书省著作郎夔州都督府长史上护军颜君神道碑》)。\n\n它在书法史上享有极高的地位,主要基于以下几个核心原因:\n\n### 1. “颜体”成熟期的巅峰之作\n《颜勤礼碑》创作于颜真卿71岁(唐大历十四年,公元779年),此时他的书法艺术已经炉火纯青,完全摆脱了早期的秀逸风格,形成了",
"content": "这幅作品是唐代著名书法家**颜真卿**的代表作之一——《**颜勤礼碑**》(全称《唐故秘书省著作郎夔州都督府长史上护军颜君神道碑》)。\n\n它在书法史上享有极高的地位,主要基于以下几个核心原因:\n\n### 1. “颜体”成熟期的巅峰之作\n《颜勤礼碑》创作于颜真卿71岁(唐大历十四年,公元779年),此时他的书法艺术已经炉火纯青,完全摆脱了早期的秀逸风格,形成了",
"content": "这幅作品是唐代著名书法家**颜真卿**的代表作之一——《**颜勤礼碑**》(全称《唐故秘书省著作郎夔州都督府长史上护军颜君神道碑》)。\n\n它在书法史上享有极高的地位,主要基于以下几个核心原因:\n\n### 1. “颜体”成熟期的巅峰之作\n《颜勤礼碑》创作于颜真卿71岁(唐大历十四年,公元779年),此时他的书法艺术已经炉火纯青,完全摆脱了早期的秀逸风格,形成了",
/root/work/filestorage/test_toolkits/self-built-data/chinese/images/2.png
这幅画叫什么名字,是哪个朝代的作品?
"content": "这幅画是**《千里江山图》**,是**北宋**时期的作品。\n\n---\n\n### 补充说明:\n\n- **作者**:传为北宋画家**王希孟**所作(一说为宋徽宗赵佶指导或参与创作)。\n- **材质与形制**:绢本设色,长卷形式,纵51.5厘米,横1191.5厘米。\n- **艺术特色**:\n - 采用“青绿山水”技法,以石青、石绿为主色调,色彩浓丽而不失雅致。\n - 山",
"content": "这幅画是**《千里江山图》**,是**北宋**时期的作品。\n\n---\n\n### 补充说明:\n\n- **作者**:传为北宋画家**王希孟**所作(一说为宋徽宗赵佶指导或参与创作)。\n- **材质与形制**:绢本设色,长卷形式,纵51.5厘米,横1191.5厘米。\n- **艺术特色**:\n - 采用“青绿山水”技法,以石青、石绿为主色调,色彩浓丽而不失雅致。\n - 山",
"content": "这幅画是**《千里江山图》**,是**北宋**时期的作品。\n\n---\n\n### 补充说明:\n\n- **作者**:传为北宋画家**王希孟**所作(一说为宋徽宗赵佶指导或参与创作)。\n- **材质与形制**:绢本设色,长卷形式,纵51.5厘米,横1191.5厘米。\n- **艺术特色**:\n - 采用“青绿山水”技法,以石青、石绿为主色调,色彩浓丽而不失雅致。\n - 山",
/root/work/filestorage/test_toolkits/self-built-data/chinese/images/2.png
这种国画属于什么画科,用的是什么典型绘画技法?
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面特征来看,它极有可能是北宋王希孟的传世名作《千里江山图》(或其局部/摹本)。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下几种典型的国画技法:\n\n* **青绿设色(Blue-Green Coloring)**:\n 这是该画科最核心的技法",
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面特征来看,它极有可能是北宋王希孟的传世名作《千里江山图》(或其局部/摹本)。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下几种典型的国画技法:\n\n* **青绿设色(Blue-Green Coloring)**:\n 这是该画科最核心的技法",
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面特征来看,它极有可能是北宋王希孟的传世名作《千里江山图》(或其局部/摹本)。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下几种典型的国画技法:\n\n* **青绿设色(Blue-Green Coloring)**:\n 这是该画科最核心的技法",
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面特征来看,它极有可能是北宋王希孟的传世名作《千里江山图》(或其局部/摹本)。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下几种典型的国画技法:\n\n* **青绿设色(Blue-Green Coloring)**:\n 这是该画科最核心的技法",
"content": "### 1. 画科归属\n这幅画属于**青绿山水**(或称“大青绿”)画科。\n\n### 2. 典型绘画技法\n这幅画最典型的技法是**“勾填法”**(或称“勾勒填色”),并结合了**“三青三绿”**的设色传统。\n\n具体技法细节如下:\n* **勾勒(Outline):** 画家先用墨线(或赭石色线)细致地勾勒出山石、树木、建筑的轮廓。线条刚劲有力,这是",
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面特征来看,它极有可能是北宋王希孟的传世名作《千里江山图》(或其摹本/局部)。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下两种核心技法:\n\n* **青绿设色(Blue-Green Coloring)**:\n 这是该画科最显著的特征。画家",
"content": "### 1. 画科归属\n这幅画属于**青绿山水**(或称“大青绿”)画科。\n\n### 2. 典型绘画技法\n这幅画最典型的技法是**“勾填法”**(或称“勾勒填色”),并结合了**“三青三绿”**的设色传统。\n\n具体技法细节如下:\n* **勾勒(Outline):** 画家先用墨线(或赭石色线)细致地勾勒出山石、树木、建筑的轮廓。线条刚劲有力,这是",
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面特征来看,它极有可能是北宋王希孟的传世名作《千里江山图》(或其摹本/局部)。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下两种核心技法:\n\n* **青绿设色(Blue-Green Coloring)**:\n 这是该画科最显著的特征。画家",
"content": "### 1. 画科归属\n这幅画属于**青绿山水**(或称“大青绿”)画科。\n\n### 2. 典型绘画技法\n这幅画最典型的技法是**“勾填法”**(或称“勾勒填色”),并结合了**“三青三绿”**的设色传统。\n\n具体技法细节如下:\n* **勾勒(Outline):** 画家先用墨线(或赭石色线)细致地勾勒出山石、树木、建筑的轮廓。线条刚劲有力,这是",
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面特征来看,它极有可能是北宋王希孟的传世名作《千里江山图》(或其摹本/局部)。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下两种核心技法:\n\n* **青绿设色(Blue-Green Coloring)**:\n 这是该画科最显著的特征。画家",
"content": "### 1. 画科归属\n这幅画属于**青绿山水**(或称“大青绿”)画科。\n\n### 2. 典型绘画技法\n这幅画最典型的技法是**“勾填法”**(或称“勾勒填色”),并结合了**“三青三绿”**的设色传统。\n\n具体技法细节如下:\n* **勾勒(Outline):** 画家先用墨线(或赭石色线)细致地勾勒出山石、树木、建筑的轮廓。线条刚劲有力,这是",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿等矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿渐变的山体就是该技法的典型体现,矿物颜料的厚重",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿等矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿渐变的山体就是该技法的典型体现,矿物颜料的厚重",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿等矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿渐变的山体就是该技法的典型体现,矿物颜料的厚重",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿等矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿渐变的山体就是该技法的典型体现,矿物颜料的厚重",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是山水画中极具辨识度的类别。\n\n### 典型绘画技法\n1. **石青石绿设色技法**\n这是青绿山水最核心的技法,使用天然矿物颜料石青(蓝色)、石绿(绿色)进行晕染,色彩厚重鲜亮、不易褪色,画面呈现出浓郁的装饰质感,和图中大面积的蓝绿色山",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石青石绿设色技法**\n这是青绿山水最核心的技法,使用天然矿物颜料石青(蓝色)、石绿(绿色)进行晕染,色彩饱和度高、覆盖力强,历经千年也不易褪色,画面呈现出厚重华贵的质感,和图",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿等矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿色的山体就是该技法的典型呈现,矿物颜料的厚重质感也让",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿等矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿色的山体就是该技法的典型呈现,矿物颜料的厚重质感也让",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿等矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿渐变的山体就是该技法的典型体现,矿物颜料的特性",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿等矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿色的山体就是该技法的典型呈现,矿物颜料的厚重质感也让",
"content": "### 所属画科\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是山水画中极具辨识度的类别。\n\n### 典型绘画技法\n1. **石青石绿设色技法**\n这是青绿山水最核心的技法,使用天然矿物颜料石青(蓝色)、石绿(绿色)进行晕染,色彩饱和度高、覆盖力强,历经千年也不易褪色,画面呈现出厚重华贵的质感",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿两种矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿渐变的山体就是该技法的典型体现,矿物颜料的特性",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石青石绿设色技法**\n这是青绿山水最核心的技法,使用天然矿物颜料石青(蓝色)、石绿(绿色)进行晕染,色彩饱和度高、覆盖力强,历经千年也不易褪色,画面呈现出厚重华贵的质感,和图",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石青石绿设色技法**\n这是青绿山水最核心的技法,使用天然矿物颜料石青(蓝色)、石绿(绿色)进行晕染,色彩饱和度高、覆盖力强,历经千年也不易褪色,画面呈现出厚重华贵的质感,和图",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿等矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿色的山体就是该技法的典型呈现,矿物颜料的厚重质感也让",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石青石绿设色技法**\n这是青绿山水最核心的技法,使用天然矿物颜料石青(蓝色)、石绿(绿色)进行晕染,色彩饱和度高、覆盖力强,历经千年也不易褪色,画面呈现出厚重华贵的质感,和图",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿等矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿渐变的山体就是该技法的典型体现,矿物颜料的厚重",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿等矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿色的山体就是该技法的典型呈现,矿物颜料的厚重质感也让",
"content": "### 画科归属\n这幅作品属于**青绿山水画**,是中国传统山水画的重要分支,以矿物颜料石青、石绿作为主色调描绘山川景物,风格富丽典雅,是古代山水画的典型代表类型。\n\n### 典型绘画技法\n1. **石色晕染技法**\n这是青绿山水的核心技法,以石青、石绿等矿物颜料为核心,通过分层晕染的方式表现山石的体积感与色彩层次,画面中蓝绿渐变的山体就是该技法的典型体现,矿物颜料的厚重",
### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面风格来看,它具有典型的**金碧山水**(Gold and Blue-Green Landscape)特征,即在青绿设色的基础上,大量使用泥金(金粉)来描绘山石的轮廓、水纹或建筑,以增强画面的富丽堂皇之感。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下几种典型的
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面风格来看,它具有典型的**金碧山水**(Gold and Blue-Green Landscape)特征,即在青绿设色的基础上,大量使用泥金(金粉)来描绘山石的轮廓、水纹或建筑,以增强画面的富丽堂皇之感。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下几种典型的",
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面风格来看,它具有典型的**金碧山水**(Gold and Blue-Green Landscape)特征,即在青绿设色的基础上,大量使用泥金(金粉)来描绘山石的轮廓、水纹或建筑,以增强画面的富丽堂皇之感。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下几种典型的",
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面风格来看,它具有典型的**金碧山水**(Gold and Blue-Green Landscape)特征,即在青绿设色的基础上,大量使用泥金(金粉)来描绘山石的轮廓、水纹或建筑,以增强画面的富丽堂皇之感。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下几种典型",
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面风格来看,它具有典型的**金碧山水**(Gold and Blue-Green Landscape)特征,即在青绿设色的基础上,大量使用泥金(金粉)来描绘山石的轮廓、水纹或建筑,以增强画面的富丽堂皇之感。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下几种典型的",
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面特征来看,它极有可能是北宋王希孟的传世名作《千里江山图》(或其局部/摹本)。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下两种核心技法:\n\n* **青绿设色(Blue-Green Coloring)**:\n 这是该画科最显著的特征。画家",
"content": "### 1. 画科归属\n这幅画属于**山水画**(Shanshui Painting)。\n\n具体来说,它属于山水画中的**青绿山水**(Blue-Green Landscape)画科。从画面风格来看,它具有典型的**金碧山水**(Gold and Blue-Green Landscape)特征,即在青绿设色的基础上,大量使用泥金(金粉)来描绘山石的轮廓、水纹或建筑,以增强画面的富丽堂皇之感。\n\n### 2. 典型绘画技法\n这幅画主要运用了以下几种典型的",