11.10 モデル・サマリー
モデル・サマリーは、モデルの簡潔な概要を示します。モデルのエクスポート後にサマリーを取得するには、summary()関数をコールします。
モデル・サマリーは、
export2db()またはexport2file()の実行後にsummary()関数をコールすることで、ONNXパイプラインから取得できます。サマリーには、次のような詳細が含まれます:
- モデルが量子化されたかどうか
- 外部データが使用されたかどうか
- 適用されたトークナイザ・タイプ、プリプロセッサおよびポストプロセッサ
- その他の関連メタデータ
from oml.utils import ONNXPipeline,ONNXPipelineConfig
model_name="sentence-transformers/all-MiniLM-L6-v2"
em = ONNXPipeline(model_name=model_name,settings={"logging_level":"ERROR"})
em.export2db("allminil6v2")
em.summary()
{'description': "Original model sentence-transformers/all-MiniLM-L6-v2 augmented with pre/post processors. Generated by OML4Py ver. 2.1.
Generated model is not quantized. Generated model doesn't use external data. Model tokenizer is <class 'transformers.models.bert.tokenization_bert.BertTokenizer'>.
Model post processors include: mean_pooling,mean_pooling.", 'producer': 'OML4Py 2.1'}
モデルがデータベースにエクスポートされた場合、サマリーもONNXメタデータ情報を格納するビューに含まれます:
SQL> select * from DM$VJALLMINIL6V2;
METADATA
--------------------------------------------------------------------------------
{"function":"embedding","embeddingOutput":"embedding","input":{"input":["DATA"]}
,"pooling":"mean","normalization":true,"maxSequenceLength":256,"suitableDistance
Metrics":["COSINE","DOT","EUCLIDEAN"],"languages":["us"],"modelDescription":{"de
scription":"Original model sentence-transformers/all-MiniLM-L6-v2 augmented with
pre/post processors. Generated by OML4Py ver. 2.1. Generated model is not quant
ized. Generated model doesn't use external data. Model tokenizer is <class 'tran
sformers.models.bert.tokenization_bert.BertTokenizer'>. Model post processors in
clude: mean_pooling,mean_pooling.","producer":"OML4Py 2.1"}}
親トピック: ONNX形式での事前トレーニング済モデルのインポート