{"id":81434,"date":"2026-07-25T01:42:16","date_gmt":"2026-07-24T17:42:16","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/81434.html"},"modified":"2026-07-25T01:42:16","modified_gmt":"2026-07-24T17:42:16","slug":"structbert%e4%b8%ad%e6%96%87%e5%8f%a5%e5%90%91%e9%87%8f%e5%b7%a5%e5%85%b7%e9%83%a8%e7%bd%b2%e6%95%99%e7%a8%8b%ef%bc%9anvidia-triton%e6%8e%a8%e7%90%86%e6%9c%8d%e5%8a%a1%e5%99%a8%e9%9b%86%e6%88%90","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/81434.html","title":{"rendered":"StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b\uff1aNVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848"},"content":{"rendered":"<h2>StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b&#xff1a;NVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848<\/h2>\n<h3>1. \u5f15\u8a00<\/h3>\n<p>\u5982\u679c\u4f60\u6b63\u5728\u5bfb\u627e\u4e00\u4e2a\u80fd\u7cbe\u51c6\u7406\u89e3\u4e2d\u6587\u53e5\u5b50\u542b\u4e49&#xff0c;\u5e76\u80fd\u5feb\u901f\u8ba1\u7b97\u5b83\u4eec\u4e4b\u95f4\u76f8\u4f3c\u5ea6\u7684\u5de5\u5177&#xff0c;\u90a3\u4e48StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u7edd\u5bf9\u503c\u5f97\u4f60\u6df1\u5165\u4e86\u89e3\u3002\u8fd9\u4e2a\u5de5\u5177\u57fa\u4e8e\u963f\u91cc\u8fbe\u6469\u9662\u5f00\u6e90\u7684\u5f3a\u5927\u6a21\u578b&#xff0c;\u80fd\u591f\u5c06\u4efb\u4f55\u4e2d\u6587\u53e5\u5b50\u8f6c\u6362\u6210\u4e00\u4e2a\u9ad8\u7ef4\u5ea6\u7684\u201c\u6570\u5b57\u6307\u7eb9\u201d&#xff08;\u6211\u4eec\u79f0\u4e4b\u4e3a\u5411\u91cf&#xff09;&#xff0c;\u7136\u540e\u901a\u8fc7\u8ba1\u7b97\u8fd9\u4e9b\u6307\u7eb9\u7684\u76f8\u4f3c\u5ea6&#xff0c;\u6765\u5224\u65ad\u4e24\u4e2a\u53e5\u5b50\u5728\u610f\u601d\u4e0a\u6709\u591a\u63a5\u8fd1\u3002<\/p>\n<p>\u60f3\u8c61\u4e00\u4e0b&#xff0c;\u4f60\u9700\u8981\u4ece\u6d77\u91cf\u6587\u6863\u4e2d\u627e\u51fa\u610f\u601d\u76f8\u8fd1\u7684\u53e5\u5b50&#xff0c;\u6216\u8005\u4e3a\u667a\u80fd\u5ba2\u670d\u7cfb\u7edf\u5339\u914d\u6700\u5408\u9002\u7684\u7b54\u6848&#xff0c;\u53c8\u6216\u8005\u53ea\u662f\u60f3\u68c0\u67e5\u4e24\u6bb5\u6587\u672c\u662f\u5426\u5728\u8bf4\u540c\u4e00\u4ef6\u4e8b\u3002\u624b\u52a8\u53bb\u505a\u8fd9\u4e9b\u5de5\u4f5c\u4e0d\u4ec5\u8017\u65f6&#xff0c;\u800c\u4e14\u5bb9\u6613\u51fa\u9519\u3002StructBERT\u5de5\u5177\u5c31\u662f\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e9b\u95ee\u9898\u800c\u751f\u7684&#xff0c;\u5b83\u80fd\u81ea\u52a8\u5316\u3001\u9ad8\u7cbe\u5ea6\u5730\u5b8c\u6210\u8bed\u4e49\u5339\u914d\u4efb\u52a1\u3002<\/p>\n<p>\u672c\u6559\u7a0b\u5c06\u5e26\u4f60\u8d70\u4e00\u6761\u66f4\u4e13\u4e1a\u3001\u66f4\u9ad8\u6548\u7684\u90e8\u7f72\u4e4b\u8def&#xff1a;\u5c06StructBERT\u6a21\u578b\u90e8\u7f72\u5230NVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u4e0a\u3002\u4e0e\u76f4\u63a5\u8fd0\u884cPython\u811a\u672c\u76f8\u6bd4&#xff0c;Triton\u670d\u52a1\u5668\u80fd\u63d0\u4f9b\u66f4\u7a33\u5b9a\u7684\u670d\u52a1\u3001\u66f4\u9ad8\u7684\u5e76\u53d1\u5904\u7406\u80fd\u529b&#xff0c;\u4ee5\u53ca\u66f4\u4fbf\u6377\u7684\u6a21\u578b\u7248\u672c\u7ba1\u7406\u3002\u65e0\u8bba\u4f60\u662f\u60f3\u642d\u5efa\u4e00\u4e2a\u4f9b\u56e2\u961f\u5185\u90e8\u4f7f\u7528\u7684\u8bed\u4e49\u641c\u7d22\u670d\u52a1&#xff0c;\u8fd8\u662f\u60f3\u5c06\u5176\u96c6\u6210\u5230\u66f4\u590d\u6742\u7684\u5e94\u7528\u6d41\u6c34\u7ebf\u4e2d&#xff0c;\u8fd9\u5957\u65b9\u6848\u90fd\u80fd\u6ee1\u8db3\u4f60\u7684\u9700\u6c42\u3002\u63a5\u4e0b\u6765&#xff0c;\u6211\u4eec\u5c31\u4ece\u96f6\u5f00\u59cb&#xff0c;\u4e00\u6b65\u6b65\u5b8c\u6210\u90e8\u7f72\u3002<\/p>\n<h3>2. \u73af\u5883\u51c6\u5907\u4e0e\u6a21\u578b\u83b7\u53d6<\/h3>\n<p>\u5728\u5f00\u59cb\u90e8\u7f72\u4e4b\u524d&#xff0c;\u6211\u4eec\u9700\u8981\u51c6\u5907\u597d\u8fd0\u884c\u73af\u5883&#xff0c;\u5e76\u83b7\u53d6\u5230\u6838\u5fc3\u7684\u6a21\u578b\u6587\u4ef6\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u5c31\u50cf\u76d6\u623f\u5b50\u524d\u8981\u6253\u597d\u5730\u57fa\u548c\u51c6\u5907\u597d\u7816\u74e6\u3002<\/p>\n<h4>2.1 \u7cfb\u7edf\u4e0e\u8f6f\u4ef6\u73af\u5883<\/h4>\n<p>\u9996\u5148&#xff0c;\u786e\u4fdd\u4f60\u7684\u670d\u52a1\u5668\u6216\u672c\u5730\u5f00\u53d1\u73af\u5883\u6ee1\u8db3\u4ee5\u4e0b\u57fa\u672c\u8981\u6c42&#xff1a;<\/p>\n<ul>\n<li>\u64cd\u4f5c\u7cfb\u7edf&#xff1a;\u63a8\u8350 Ubuntu 20.04 \u6216 22.04 LTS&#xff0c;\u5176\u4ed6Linux\u53d1\u884c\u7248\u6216Windows&#xff08;\u901a\u8fc7WSL2&#xff09;\u4e5f\u53ef\u884c&#xff0c;\u4f46\u672c\u6559\u7a0b\u4ee5Ubuntu\u4e3a\u4f8b\u3002<\/li>\n<li>Python&#xff1a;\u7248\u672c 3.8 \u6216 3.9\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528 python3 &#8211;version \u547d\u4ee4\u6765\u68c0\u67e5\u3002<\/li>\n<li>CUDA&#xff1a;\u7531\u4e8e\u6211\u4eec\u9700\u8981\u5229\u7528GPU\u8fdb\u884c\u52a0\u901f&#xff0c;\u8bf7\u5b89\u88c5\u4e0e\u4f60\u7684NVIDIA\u663e\u5361\u9a71\u52a8\u5339\u914d\u7684CUDA\u5de5\u5177\u5305&#xff0c;\u7248\u672c11.0\u4ee5\u4e0a\u3002\u63a8\u8350\u4f7f\u7528CUDA 11.8\u3002<\/li>\n<li>Docker&#xff1a;\u8fd9\u662f\u8fd0\u884cTriton\u63a8\u7406\u670d\u52a1\u5668\u7684\u63a8\u8350\u65b9\u5f0f\u3002\u5b89\u88c5Docker\u5e76\u786e\u4fdd\u4f60\u7684\u7528\u6237\u6709\u6743\u9650\u8fd0\u884cDocker\u547d\u4ee4\u3002<\/li>\n<\/ul>\n<p>\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5feb\u901f\u5b89\u88c5Docker&#xff08;Ubuntu\u7cfb\u7edf&#xff09;&#xff1a;<\/p>\n<p>sudo apt-get update<br \/>\nsudo apt-get install docker.io<br \/>\nsudo systemctl start docker<br \/>\nsudo systemctl enable docker<br \/>\n# \u5c06\u5f53\u524d\u7528\u6237\u52a0\u5165docker\u7ec4&#xff0c;\u907f\u514d\u6bcf\u6b21\u4f7f\u7528sudo<br \/>\nsudo usermod -aG docker $USER<br \/>\n# \u9700\u8981\u91cd\u65b0\u767b\u5f55\u6216\u91cd\u542f\u4f7f\u66f4\u6539\u751f\u6548<\/p>\n<h4>2.2 \u83b7\u53d6StructBERT\u6a21\u578b\u6587\u4ef6<\/h4>\n<p>StructBERT\u6a21\u578b\u672c\u8eab\u53ef\u4ee5\u4eceHugging Face Model Hub\u83b7\u53d6\u3002\u4f46\u4e3a\u4e86\u65b9\u4fbf\u540e\u7eedTriton\u90e8\u7f72&#xff0c;\u6211\u4eec\u9700\u8981\u5c06\u5176\u8f6c\u6362\u4e3a\u7279\u5b9a\u7684\u683c\u5f0f\u3002\u8fd9\u91cc\u6709\u4e24\u79cd\u65b9\u5f0f&#xff1a;<\/p>\n<p>\u65b9\u5f0f\u4e00&#xff1a;\u4ece\u539f\u59cb\u4ed3\u5e93\u8f6c\u6362&#xff08;\u63a8\u8350&#xff09;<\/p>\n<li>\u4eceHugging Face\u4e0b\u8f7d iic\/nlp_structbert_sentence-similarity_chinese-large \u6a21\u578b\u3002<\/li>\n<li>\u4f7f\u7528Hugging Face\u7684 transformers \u5e93\u52a0\u8f7d\u6a21\u578b&#xff0c;\u5e76\u5c06\u5176\u4fdd\u5b58\u4e3aPyTorch\u7684 .pt \u6216 .pth \u6587\u4ef6\u683c\u5f0f\u3002\u540c\u65f6&#xff0c;\u9700\u8981\u51c6\u5907\u597d\u6a21\u578b\u7684\u914d\u7f6e\u6587\u4ef6&#xff08;\u5982 config.json&#xff09;\u548c\u5206\u8bcd\u5668\u6587\u4ef6&#xff08;tokenizer.json, vocab.txt\u7b49&#xff09;\u3002<\/li>\n<p>\u65b9\u5f0f\u4e8c&#xff1a;\u4f7f\u7528\u9884\u8f6c\u6362\u7684\u6a21\u578b&#xff08;\u5982\u679c\u53ef\u7528&#xff09; \u6709\u65f6\u793e\u533a\u6216\u6a21\u578b\u63d0\u4f9b\u8005\u4f1a\u76f4\u63a5\u63d0\u4f9b\u9002\u7528\u4e8eTriton\u7684\u6a21\u578b\u5305\u3002\u4f60\u53ef\u4ee5\u641c\u7d22 nlp_structbert_sentence-similarity_chinese-large triton model repository \u6765\u5bfb\u627e\u3002\u5982\u679c\u627e\u5230&#xff0c;\u53ef\u4ee5\u8df3\u8fc7\u8f6c\u6362\u6b65\u9aa4\u3002<\/p>\n<p>\u4e3a\u4e86\u6559\u7a0b\u7684\u5b8c\u6574\u6027&#xff0c;\u6211\u4eec\u7b80\u8981\u4ecb\u7ecd\u8f6c\u6362\u7684\u6838\u5fc3\u601d\u8def\u3002\u4f60\u9700\u8981\u7f16\u5199\u4e00\u4e2aPython\u811a\u672c&#xff0c;\u7c7b\u4f3c\u4e0b\u9762\u8fd9\u6837&#xff1a;<\/p>\n<p>from transformers import AutoModel, AutoTokenizer<br \/>\nimport torch<\/p>\n<p>model_name &#061; &#034;iic\/nlp_structbert_sentence-similarity_chinese-large&#034;<br \/>\nmodel &#061; AutoModel.from_pretrained(model_name)<br \/>\ntokenizer &#061; AutoTokenizer.from_pretrained(model_name)<\/p>\n<p># \u4fdd\u5b58\u6a21\u578b\u6743\u91cd&#xff08;\u4ec5state_dict&#xff09;<br \/>\ntorch.save(model.state_dict(), &#034;structbert_large.pth&#034;)<\/p>\n<p># \u4fdd\u5b58\u5206\u8bcd\u5668\u548c\u914d\u7f6e<br \/>\ntokenizer.save_pretrained(&#034;.\/triton_model_tokenizer&#034;)<br \/>\nmodel.config.save_pretrained(&#034;.\/triton_model_config&#034;)<\/p>\n<p>\u8fd9\u4e2a\u811a\u672c\u4f1a\u5c06\u6a21\u578b\u6743\u91cd\u548c\u914d\u7f6e\u6587\u4ef6\u5206\u5f00\u4fdd\u5b58&#xff0c;\u8fd9\u662f\u4e3a\u540e\u7eed\u6b65\u9aa4\u505a\u51c6\u5907\u3002<\/p>\n<h3>3. \u6784\u5efaTriton\u6a21\u578b\u4ed3\u5e93<\/h3>\n<p>NVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u901a\u8fc7\u4e00\u4e2a\u6e05\u6670\u7684\u76ee\u5f55\u7ed3\u6784\u6765\u7ba1\u7406\u6a21\u578b&#xff0c;\u8fd9\u4e2a\u7ed3\u6784\u53eb\u505a\u201c\u6a21\u578b\u4ed3\u5e93\u201d\u3002\u6211\u4eec\u7684\u76ee\u6807\u5c31\u662f\u6309\u7167Triton\u7684\u89c4\u5219&#xff0c;\u628aStructBERT\u6a21\u578b\u201c\u5305\u88c5\u201d\u597d&#xff0c;\u653e\u8fdb\u53bb\u3002<\/p>\n<h4>3.1 \u7406\u89e3Triton\u6a21\u578b\u4ed3\u5e93\u7ed3\u6784<\/h4>\n<p>\u4e00\u4e2a\u5178\u578b\u7684Triton\u6a21\u578b\u4ed3\u5e93\u76ee\u5f55\u7ed3\u6784\u5982\u4e0b&#xff1a;<\/p>\n<p>model_repository\/<br \/>\n\u251c\u2500\u2500 structbert_similarity\/       # \u4f60\u7684\u6a21\u578b\u540d\u79f0<br \/>\n\u2502   \u251c\u2500\u2500 1\/                       # \u7248\u672c\u53f7&#xff0c;Triton\u53ef\u4ee5\u7ba1\u7406\u591a\u4e2a\u7248\u672c<br \/>\n\u2502   \u2502   \u2514\u2500\u2500 model.pt             # \u6a21\u578b\u6743\u91cd\u6587\u4ef6&#xff08;PyTorch\u683c\u5f0f&#xff09;<br \/>\n\u2502   \u251c\u2500\u2500 config.pbtxt             # \u6a21\u578b\u914d\u7f6e\u6587\u4ef6&#xff08;\u6700\u91cd\u8981&#xff01;&#xff09;<br \/>\n\u2502   \u2514\u2500\u2500 tokenizer\/               # \u5206\u8bcd\u5668\u76f8\u5173\u6587\u4ef6&#xff08;\u53ef\u9009&#xff0c;\u53ef\u5185\u5d4c\u5728\u4ee3\u7801\u4e2d&#xff09;<br \/>\n\u2502       \u251c\u2500\u2500 tokenizer.json<br \/>\n\u2502       \u251c\u2500\u2500 vocab.txt<br \/>\n\u2502       \u2514\u2500\u2500 config.json<\/p>\n<ul>\n<li>structbert_similarity&#xff1a;\u8fd9\u662f\u4f60\u7684\u6a21\u578b\u5728Triton\u4e2d\u7684\u540d\u5b57&#xff0c;\u5ba2\u6237\u7aef\u8bf7\u6c42\u65f6\u4f1a\u7528\u5230\u3002<\/li>\n<li>1&#xff1a;\u6a21\u578b\u7248\u672c\u53f7\u3002\u4f60\u53ef\u4ee5\u90e8\u7f72v1, v2\u7b49\u4e0d\u540c\u7248\u672c&#xff0c;Triton\u53ef\u4ee5\u540c\u65f6\u670d\u52a1\u6216\u8fdb\u884c\u7248\u672c\u5207\u6362\u3002<\/li>\n<li>config.pbtxt&#xff1a;\u8fd9\u662f\u6a21\u578b\u7684\u201c\u8bf4\u660e\u4e66\u201d&#xff0c;\u544a\u8bc9Triton\u6a21\u578b\u7684\u8f93\u5165\u8f93\u51fa\u662f\u4ec0\u4e48\u3001\u7528\u4ec0\u4e48\u540e\u7aef\u3001\u5982\u4f55\u9884\u5904\u7406\u548c\u540e\u5904\u7406\u7b49\u3002<\/li>\n<\/ul>\n<h4>3.2 \u521b\u5efa\u6a21\u578b\u914d\u7f6e\u6587\u4ef6<\/h4>\n<p>config.pbtxt \u6587\u4ef6\u662f\u6838\u5fc3\u3002\u5bf9\u4e8e\u6211\u4eec\u7684StructBERT\u53e5\u5411\u91cf\u6a21\u578b&#xff0c;\u4e00\u4e2a\u7b80\u5316\u7684\u914d\u7f6e\u53ef\u80fd\u5982\u4e0b\u6240\u793a\u3002\u6211\u4eec\u9700\u8981\u4f7f\u7528Python\u540e\u7aef&#xff0c;\u56e0\u4e3a\u6d89\u53ca\u5206\u8bcd\u548c\u6c60\u5316\u7b49\u590d\u6742\u64cd\u4f5c\u3002<\/p>\n<p>name: &#034;structbert_similarity&#034;<br \/>\nbackend: &#034;python&#034;<br \/>\nmax_batch_size: 8 # \u6839\u636e\u4f60\u7684GPU\u663e\u5b58\u8c03\u6574&#xff0c;\u8868\u793a\u4e00\u6b21\u6700\u591a\u5904\u74068\u4e2a\u53e5\u5b50\u5bf9<\/p>\n<p>input [<br \/>\n  {<br \/>\n    name: &#034;TEXT&#034;<br \/>\n    data_type: TYPE_STRING<br \/>\n    dims: [ -1 ] # -1 \u8868\u793a\u53ef\u53d8\u957f\u5ea6<br \/>\n  }<br \/>\n]<\/p>\n<p>output [<br \/>\n  {<br \/>\n    name: &#034;EMBEDDING&#034;<br \/>\n    data_type: TYPE_FP32<br \/>\n    dims: [ 768 ] # StructBERT-large \u9690\u85cf\u5c42\u5927\u5c0f\u662f768<br \/>\n  }<br \/>\n]<\/p>\n<p>instance_group [{ kind: KIND_GPU }] # \u6307\u5b9a\u5728GPU\u4e0a\u8fd0\u884c<\/p>\n<p>parameters: {<br \/>\n  key: &#034;EXECUTION_ENV_PATH&#034;,<br \/>\n  value: {string_value: &#034;$$TRITON_MODEL_DIRECTORY\/py_env.tar.gz&#034;}<br \/>\n}<\/p>\n<p>\u8fd9\u4e2a\u914d\u7f6e\u544a\u8bc9Triton&#xff1a;\u6a21\u578b\u540d\u53eb structbert_similarity&#xff0c;\u4f7f\u7528Python\u540e\u7aef&#xff1b;\u5b83\u63a5\u53d7\u4e00\u4e2a\u53ef\u53d8\u957f\u5ea6\u7684\u5b57\u7b26\u4e32\u8f93\u5165&#xff08;TEXT&#xff09;&#xff0c;\u5e76\u8f93\u51fa\u4e00\u4e2a768\u7ef4\u7684\u6d6e\u70b9\u6570\u5411\u91cf&#xff08;EMBEDDING&#xff09;&#xff1b;\u5728GPU\u4e0a\u8fd0\u884c\u3002<\/p>\n<h4>3.3 \u7f16\u5199Python\u6a21\u578b\u63a8\u7406\u811a\u672c<\/h4>\n<p>\u63a5\u4e0b\u6765&#xff0c;\u6211\u4eec\u9700\u8981\u7f16\u5199\u4e00\u4e2aPython\u6587\u4ef6&#xff08;\u4f8b\u5982 model.py&#xff09;&#xff0c;\u653e\u5728\u7248\u672c\u76ee\u5f55&#xff08;1\/&#xff09;\u4e0b\u3002\u8fd9\u4e2a\u6587\u4ef6\u5fc5\u987b\u5305\u542b\u4e00\u4e2a TritonPythonModel \u7c7b&#xff0c;Triton\u4f1a\u5728\u52a0\u8f7d\u6a21\u578b\u65f6\u8c03\u7528\u5b83\u3002<\/p>\n<p>\u8fd9\u4e2a\u811a\u672c\u7684\u4e3b\u8981\u4efb\u52a1\u662f&#xff1a;<\/p>\n<li>\u521d\u59cb\u5316&#xff1a;\u5728 initialize \u65b9\u6cd5\u4e2d\u52a0\u8f7d\u6211\u4eec\u4e4b\u524d\u4fdd\u5b58\u7684PyTorch\u6a21\u578b\u548c\u5206\u8bcd\u5668\u3002<\/li>\n<li>\u6267\u884c&#xff1a;\u5728 execute \u65b9\u6cd5\u4e2d&#xff0c;\u5bf9\u8f93\u5165\u7684\u6587\u672c\u8fdb\u884c\u5206\u8bcd\u3001\u8f6c\u6362\u4e3a\u6a21\u578b\u8f93\u5165\u3001\u8fd0\u884c\u6a21\u578b\u63a8\u7406\u3001\u8fdb\u884c\u5747\u503c\u6c60\u5316\u5f97\u5230\u53e5\u5411\u91cf\u3002<\/li>\n<li>\u6e05\u7406&#xff1a;\u5728 finalize \u65b9\u6cd5\u4e2d\u91ca\u653e\u8d44\u6e90\u3002<\/li>\n<p>\u5173\u952e\u90e8\u5206 execute \u51fd\u6570\u7684\u903b\u8f91\u5982\u4e0b&#xff1a;<\/p>\n<p>import torch<br \/>\nimport numpy as np<br \/>\nimport triton_python_backend_utils as pb_utils<br \/>\nfrom transformers import AutoTokenizer, AutoModel<\/p>\n<p>class TritonPythonModel:<br \/>\n    def initialize(self, args):<br \/>\n        # \u52a0\u8f7d\u5206\u8bcd\u5668\u548c\u6a21\u578b<br \/>\n        model_dir &#061; args[&#039;model_repository&#039;] &#043; &#039;\/&#039; &#043; args[&#039;model_version&#039;]<br \/>\n        self.tokenizer &#061; AutoTokenizer.from_pretrained(f&#034;{model_dir}\/tokenizer&#034;)<br \/>\n        self.model &#061; AutoModel.from_pretrained(f&#034;{model_dir}\/config&#034;)<br \/>\n        # \u52a0\u8f7d\u6211\u4eec\u4e4b\u524d\u4fdd\u5b58\u7684\u6743\u91cd<br \/>\n        state_dict &#061; torch.load(f&#034;{model_dir}\/model.pt&#034;)<br \/>\n        self.model.load_state_dict(state_dict)<br \/>\n        self.model.to(&#039;cuda&#039;).eval()<br \/>\n        print(&#034;Model loaded successfully.&#034;)<\/p>\n<p>    def execute(self, requests):<br \/>\n        responses &#061; []<br \/>\n        for request in requests:<br \/>\n            # 1. \u83b7\u53d6\u8f93\u5165<br \/>\n            in_text &#061; pb_utils.get_input_tensor_by_name(request, &#034;TEXT&#034;)<br \/>\n            sentences &#061; in_text.as_numpy().astype(str).tolist() # \u5047\u8bbe\u6bcf\u4e2a\u8bf7\u6c42\u4e00\u4e2a\u53e5\u5b50<\/p>\n<p>            # 2. \u5206\u8bcd\u4e0e\u7f16\u7801<br \/>\n            encoded_input &#061; self.tokenizer(<br \/>\n                sentences,<br \/>\n                padding&#061;True,<br \/>\n                truncation&#061;True,<br \/>\n                max_length&#061;512,<br \/>\n                return_tensors&#061;&#039;pt&#039;<br \/>\n            ).to(&#039;cuda&#039;)<\/p>\n<p>            # 3. \u6a21\u578b\u63a8\u7406<br \/>\n            with torch.no_grad():<br \/>\n                model_output &#061; self.model(**encoded_input)<br \/>\n                # 4. \u5747\u503c\u6c60\u5316 (Mean Pooling)<br \/>\n                token_embeddings &#061; model_output.last_hidden_state<br \/>\n                attention_mask &#061; encoded_input[&#039;attention_mask&#039;]<br \/>\n                input_mask_expanded &#061; attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()<br \/>\n                sentence_embeddings &#061; torch.sum(token_embeddings * input_mask_expanded, 1) \/ torch.clamp(input_mask_expanded.sum(1), min&#061;1e-9)<br \/>\n                sentence_embeddings &#061; sentence_embeddings.cpu().numpy()<\/p>\n<p>            # 5. \u6784\u9020\u8f93\u51fa<br \/>\n            out_tensor &#061; pb_utils.Tensor(&#034;EMBEDDING&#034;, sentence_embeddings.astype(np.float32))<br \/>\n            inference_response &#061; pb_utils.InferenceResponse(output_tensors&#061;[out_tensor])<br \/>\n            responses.append(inference_response)<br \/>\n        return responses<\/p>\n<p>    def finalize(self):<br \/>\n        self.model &#061; None<br \/>\n        torch.cuda.empty_cache()<\/p>\n<p>\u8fd9\u4e2a\u811a\u672c\u5c06\u5b8c\u6574\u7684\u53e5\u5b50\u5230\u5411\u91cf\u7684\u6d41\u7a0b\u5c01\u88c5\u4e86\u8d77\u6765\u3002\u4f60\u9700\u8981\u786e\u4fdd tokenizer \u76ee\u5f55\u548c config \u76ee\u5f55&#xff08;\u5305\u542bconfig.json&#xff09;\u4ee5\u53ca model.pt \u6587\u4ef6\u90fd\u653e\u5728\u6a21\u578b\u7684\u7248\u672c\u76ee\u5f55\u4e0b\u3002<\/p>\n<h3>4. \u542f\u52a8Triton\u670d\u52a1\u5668\u5e76\u6d4b\u8bd5<\/h3>\n<p>\u6a21\u578b\u4ed3\u5e93\u51c6\u5907\u597d\u540e&#xff0c;\u6211\u4eec\u5c31\u53ef\u4ee5\u542f\u52a8Triton\u670d\u52a1\u5668\u4e86\u3002<\/p>\n<h4>4.1 \u4f7f\u7528Docker\u542f\u52a8Triton<\/h4>\n<p>\u8fd9\u662f\u6700\u7b80\u5355\u7684\u65b9\u5f0f\u3002\u786e\u4fdd\u4f60\u7684\u6a21\u578b\u4ed3\u5e93\u8def\u5f84&#xff08;\u4f8b\u5982 \/home\/user\/model_repository&#xff09;\u5df2\u7ecf\u5305\u542b\u5b8c\u6574\u7684 structbert_similarity \u6a21\u578b\u3002<\/p>\n<p>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4&#xff1a;<\/p>\n<p>docker run &#8211;gpus&#061;all &#8211;rm -p 8000:8000 -p 8001:8001 -p 8002:8002 -v \/home\/user\/model_repository:\/models nvcr.io\/nvidia\/tritonserver:23.10-py3 tritonserver &#8211;model-repository&#061;\/models<\/p>\n<p>\u547d\u4ee4\u89e3\u91ca&#xff1a;<\/p>\n<ul>\n<li>&#8211;gpus&#061;all&#xff1a;\u5c06\u4e3b\u673a\u6240\u6709GPU\u5206\u914d\u7ed9\u5bb9\u5668\u3002<\/li>\n<li>-p 8000:8000 &#8230;&#xff1a;\u6620\u5c04\u7aef\u53e3\u30028000\u662fHTTP\u7aef\u53e3&#xff0c;8001\u662fgRPC\u7aef\u53e3&#xff0c;8002\u662f\u6027\u80fd\u76d1\u63a7\u7aef\u53e3\u3002<\/li>\n<li>-v \/home\/user\/model_repository:\/models&#xff1a;\u5c06\u672c\u5730\u7684\u6a21\u578b\u4ed3\u5e93\u76ee\u5f55\u6302\u8f7d\u5230\u5bb9\u5668\u5185\u7684 \/models \u8def\u5f84\u3002<\/li>\n<li>nvcr.io\/nvidia\/tritonserver:23.10-py3&#xff1a;Triton\u670d\u52a1\u5668\u7684Docker\u955c\u50cf\u3002<\/li>\n<li>&#8211;model-repository&#061;\/models&#xff1a;\u544a\u8bc9Triton\u670d\u52a1\u5668\u6a21\u578b\u4ed3\u5e93\u7684\u4f4d\u7f6e\u3002<\/li>\n<\/ul>\n<p>\u5982\u679c\u4e00\u5207\u987a\u5229&#xff0c;\u4f60\u4f1a\u5728\u65e5\u5fd7\u7684\u6700\u540e\u770b\u5230\u7c7b\u4f3c\u8fd9\u6837\u7684\u8f93\u51fa&#xff1a;<\/p>\n<p>&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#043;&#8212;&#8212;&#8211;&#043;<br \/>\n| Model                | Version | Status |<br \/>\n&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#043;&#8212;&#8212;&#8211;&#043;<br \/>\n| structbert_similarity | 1       | READY  |<br \/>\n&#043;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-&#043;&#8212;&#8212;&#8212;&#043;&#8212;&#8212;&#8211;&#043;<\/p>\n<p>\u8fd9\u8868\u660e\u4f60\u7684StructBERT\u6a21\u578b\u5df2\u7ecf\u6210\u529f\u52a0\u8f7d\u5e76\u5904\u4e8e\u5c31\u7eea\u72b6\u6001\u3002<\/p>\n<h4>4.2 \u4f7f\u7528\u5ba2\u6237\u7aef\u8fdb\u884c\u6d4b\u8bd5<\/h4>\n<p>\u670d\u52a1\u5668\u8dd1\u8d77\u6765\u4e86&#xff0c;\u6211\u4eec\u600e\u4e48\u7528\u5462&#xff1f;\u9700\u8981\u5199\u4e00\u4e2a\u5ba2\u6237\u7aef\u7a0b\u5e8f\u6765\u8c03\u7528\u5b83\u3002\u8fd9\u91cc\u63d0\u4f9b\u4e00\u4e2a\u4f7f\u7528Python tritonclient \u5e93\u7684\u7b80\u5355\u793a\u4f8b\u3002<\/p>\n<p>\u9996\u5148\u5b89\u88c5\u5ba2\u6237\u7aef\u5e93&#xff1a;<\/p>\n<p>pip install tritonclient[all]<\/p>\n<p>\u7136\u540e\u7f16\u5199\u6d4b\u8bd5\u811a\u672c test_client.py&#xff1a;<\/p>\n<p>import tritonclient.http as httpclient<br \/>\nimport numpy as np<\/p>\n<p># \u8fde\u63a5\u5230Triton\u670d\u52a1\u5668<br \/>\nclient &#061; httpclient.InferenceServerClient(url&#061;&#039;localhost:8000&#039;)<\/p>\n<p># \u51c6\u5907\u8f93\u5165\u6570\u636e<br \/>\nsentences &#061; [&#034;\u4eca\u5929\u5929\u6c14\u771f\u597d&#034;, &#034;\u9633\u5149\u660e\u5a9a\u7684\u4e00\u5929&#034;]<br \/>\n# Triton\u671f\u671b\u7684\u8f93\u5165\u683c\u5f0f<br \/>\ninput_data &#061; np.array(sentences, dtype&#061;object).reshape((-1, 1))<\/p>\n<p># \u8bbe\u7f6e\u8f93\u5165<br \/>\ninputs &#061; [httpclient.InferInput(&#034;TEXT&#034;, input_data.shape, &#034;BYTES&#034;)]<br \/>\ninputs[0].set_data_from_numpy(input_data)<\/p>\n<p># \u8bbe\u7f6e\u8f93\u51fa<br \/>\noutputs &#061; [httpclient.InferRequestedOutput(&#034;EMBEDDING&#034;)]<\/p>\n<p># \u53d1\u9001\u8bf7\u6c42<br \/>\nresponse &#061; client.infer(model_name&#061;&#034;structbert_similarity&#034;, inputs&#061;inputs, outputs&#061;outputs)<\/p>\n<p># \u83b7\u53d6\u7ed3\u679c<br \/>\nresult &#061; response.as_numpy(&#034;EMBEDDING&#034;)<br \/>\nprint(&#034;\u751f\u6210\u7684\u53e5\u5411\u91cf\u5f62\u72b6&#xff1a;&#034;, result.shape) # \u5e94\u8be5\u662f (2, 768)<br \/>\nprint(&#034;\u7b2c\u4e00\u4e2a\u53e5\u5b50\u7684\u5411\u91cf&#xff08;\u524d10\u7ef4&#xff09;&#xff1a;&#034;, result[0][:10])<\/p>\n<p># \u8ba1\u7b97\u4e24\u4e2a\u53e5\u5b50\u7684\u4f59\u5f26\u76f8\u4f3c\u5ea6<br \/>\nfrom numpy.linalg import norm<br \/>\nvec1, vec2 &#061; result[0], result[1]<br \/>\ncosine_sim &#061; np.dot(vec1, vec2) \/ (norm(vec1) * norm(vec2))<br \/>\nprint(f&#034;\u53e5\u5b501\u4e0e\u53e5\u5b502\u7684\u4f59\u5f26\u76f8\u4f3c\u5ea6&#xff1a;{cosine_sim:.4f}&#034;)<\/p>\n<p>\u8fd0\u884c\u8fd9\u4e2a\u811a\u672c&#xff0c;\u5982\u679c\u6210\u529f&#xff0c;\u4f60\u4f1a\u770b\u5230\u8f93\u51fa\u7684\u5411\u91cf\u548c\u8ba1\u7b97\u51fa\u7684\u76f8\u4f3c\u5ea6\u5206\u6570\u3002\u8fd9\u8bc1\u660e\u6574\u4e2aTriton\u63a8\u7406\u670d\u52a1\u94fe\u8def\u5df2\u7ecf\u5b8c\u5168\u6253\u901a\u3002<\/p>\n<h3>5. \u603b\u7ed3<\/h3>\n<p>\u901a\u8fc7\u672c\u6559\u7a0b&#xff0c;\u6211\u4eec\u5b8c\u6210\u4e86\u4e00\u4ef6\u5f88\u6709\u4ef7\u503c\u7684\u4e8b\u60c5&#xff1a;\u5c06\u5f3a\u5927\u7684StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u6a21\u578b&#xff0c;\u4ece\u4e00\u4e2a\u666e\u901a\u7684Python\u811a\u672c&#xff0c;\u90e8\u7f72\u6210\u4e86\u4e00\u4e2a\u4e13\u4e1a\u7684\u3001\u53ef\u901a\u8fc7\u7f51\u7edc\u8c03\u7528\u7684\u63a8\u7406\u670d\u52a1\u3002\u8ba9\u6211\u4eec\u56de\u987e\u4e00\u4e0b\u5173\u952e\u6b65\u9aa4\u548c\u5b83\u7684\u4ef7\u503c&#xff1a;<\/p>\n<p>\u90e8\u7f72\u6d41\u7a0b\u56de\u987e<\/p>\n<li>\u51c6\u5907\u9636\u6bb5&#xff1a;\u642d\u5efa\u597d\u5305\u542bCUDA\u548cDocker\u7684\u57fa\u7840\u73af\u5883&#xff0c;\u5e76\u83b7\u53d6\u6216\u8f6c\u6362\u597dStructBERT\u6a21\u578b\u6587\u4ef6\u3002<\/li>\n<li>\u6a21\u578b\u5c01\u88c5&#xff1a;\u6309\u7167Triton\u7684\u89c4\u8303&#xff0c;\u521b\u5efa\u6a21\u578b\u4ed3\u5e93&#xff0c;\u7f16\u5199\u5173\u952e\u7684 config.pbtxt \u914d\u7f6e\u6587\u4ef6&#xff0c;\u5e76\u5f00\u53d1\u5305\u542b\u6a21\u578b\u52a0\u8f7d\u3001\u63a8\u7406\u3001\u6c60\u5316\u903b\u8f91\u7684Python\u540e\u7aef\u811a\u672c\u3002<\/li>\n<li>\u670d\u52a1\u542f\u52a8&#xff1a;\u4f7f\u7528Docker\u4e00\u952e\u542f\u52a8Triton\u63a8\u7406\u670d\u52a1\u5668&#xff0c;\u5b83\u4f1a\u81ea\u52a8\u52a0\u8f7d\u5e76\u7ba1\u7406\u6211\u4eec\u7684\u6a21\u578b\u3002<\/li>\n<li>\u670d\u52a1\u8c03\u7528&#xff1a;\u901a\u8fc7\u7f16\u5199\u7b80\u5355\u7684\u5ba2\u6237\u7aef\u4ee3\u7801&#xff0c;\u5373\u53ef\u901a\u8fc7\u7f51\u7edcAPI\u7684\u65b9\u5f0f&#xff0c;\u9ad8\u6548\u5730\u83b7\u53d6\u53e5\u5411\u91cf\u5e76\u8ba1\u7b97\u76f8\u4f3c\u5ea6\u3002<\/li>\n<p>\u65b9\u6848\u6838\u5fc3\u4f18\u52bf<\/p>\n<ul>\n<li>\u9ad8\u6027\u80fd\u4e0e\u9ad8\u5e76\u53d1&#xff1a;Triton\u670d\u52a1\u5668\u4e13\u4e3a\u63a8\u7406\u4f18\u5316&#xff0c;\u652f\u6301\u52a8\u6001\u6279\u5904\u7406&#xff0c;\u80fd\u540c\u65f6\u5904\u7406\u591a\u4e2a\u8bf7\u6c42&#xff0c;\u6781\u5927\u63d0\u5347\u4e86GPU\u5229\u7528\u7387\u548c\u541e\u5410\u91cf\u3002<\/li>\n<li>\u6807\u51c6\u5316\u4e0e\u53ef\u6269\u5c55&#xff1a;\u63d0\u4f9b\u4e86\u7edf\u4e00\u7684HTTP\/gRPC\u63a5\u53e3\u3002\u672a\u6765\u5982\u679c\u4f60\u60f3\u589e\u52a0\u65b0\u7684\u6a21\u578b&#xff08;\u5982\u5176\u4ed6NLP\u6a21\u578b\u751a\u81f3\u89c6\u89c9\u6a21\u578b&#xff09;&#xff0c;\u53ea\u9700\u6309\u76f8\u540c\u683c\u5f0f\u653e\u5165\u6a21\u578b\u4ed3\u5e93\u5373\u53ef&#xff0c;\u65e0\u9700\u6539\u52a8\u670d\u52a1\u6846\u67b6\u3002<\/li>\n<li>\u751f\u4ea7\u5c31\u7eea&#xff1a;\u652f\u6301\u6a21\u578b\u7248\u672c\u7ba1\u7406\u3001\u5065\u5eb7\u68c0\u67e5\u3001\u6027\u80fd\u76d1\u63a7&#xff0c;\u975e\u5e38\u9002\u5408\u96c6\u6210\u5230\u5fae\u670d\u52a1\u67b6\u6784\u6216\u4e91\u539f\u751f\u73af\u5883\u4e2d\u3002<\/li>\n<li>\u8d44\u6e90\u9694\u79bb&#xff1a;\u901a\u8fc7Docker\u5bb9\u5668\u5316\u90e8\u7f72&#xff0c;\u73af\u5883\u5e72\u51c0&#xff0c;\u4f9d\u8d56\u660e\u786e&#xff0c;\u907f\u514d\u4e86\u201c\u5728\u6211\u673a\u5668\u4e0a\u80fd\u8dd1\u201d\u7684\u95ee\u9898\u3002<\/li>\n<\/ul>\n<p>\u4f60\u73b0\u5728\u62e5\u6709\u7684\u662f\u4e00\u4e2a\u4f01\u4e1a\u7ea7\u7684\u8bed\u4e49\u76f8\u4f3c\u5ea6\u8ba1\u7b97\u670d\u52a1\u3002\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u5c06\u5176\u96c6\u6210\u5230\u4f60\u7684\u641c\u7d22\u7cfb\u7edf\u3001\u5185\u5bb9\u53bb\u91cd\u6a21\u5757\u6216\u667a\u80fd\u5bf9\u8bdd\u5e94\u7528\u4e2d&#xff0c;\u4eab\u53d7\u7a33\u5b9a\u3001\u9ad8\u6548\u4e14\u4e13\u4e1a\u7684AI\u80fd\u529b\u3002\u4e0b\u4e00\u6b65&#xff0c;\u4f60\u53ef\u4ee5\u63a2\u7d22\u5982\u4f55\u7ed3\u5408Faiss\u6216Milvus\u7b49\u5411\u91cf\u6570\u636e\u5e93&#xff0c;\u6784\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684\u8bed\u4e49\u68c0\u7d22\u7cfb\u7edf&#xff0c;\u8ba9\u5e94\u7528\u53d8\u5f97\u66f4\u52a0\u667a\u80fd\u3002<\/p>\n<hr \/>\n<p>\u83b7\u53d6\u66f4\u591aAI\u955c\u50cf<\/p>\n<p>\u60f3\u63a2\u7d22\u66f4\u591aAI\u955c\u50cf\u548c\u5e94\u7528\u573a\u666f&#xff1f;\u8bbf\u95ee CSDN\u661f\u56fe\u955c\u50cf\u5e7f\u573a&#xff0c;\u63d0\u4f9b\u4e30\u5bcc\u7684\u9884\u7f6e\u955c\u50cf&#xff0c;\u8986\u76d6\u5927\u6a21\u578b\u63a8\u7406\u3001\u56fe\u50cf\u751f\u6210\u3001\u89c6\u9891\u751f\u6210\u3001\u6a21\u578b\u5fae\u8c03\u7b49\u591a\u4e2a\u9886\u57df&#xff0c;\u652f\u6301\u4e00\u952e\u90e8\u7f72\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b&#xff1a;NVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848<br \/>\n1. \u5f15\u8a00<br \/>\n\u5982\u679c\u4f60\u6b63\u5728\u5bfb\u627e\u4e00\u4e2a\u80fd\u7cbe\u51c6\u7406\u89e3\u4e2d\u6587\u53e5\u5b50\u542b\u4e49&#xff0c;\u5e76\u80fd\u5feb\u901f\u8ba1\u7b97\u5b83\u4eec\u4e4b\u95f4\u76f8\u4f3c\u5ea6\u7684\u5de5\u5177&#xff0c;\u90a3\u4e48StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u7edd\u5bf9\u503c\u5f97\u4f60\u6df1\u5165\u4e86\u89e3\u3002\u8fd9\u4e2a\u5de5\u5177\u57fa\u4e8e\u963f\u91cc\u8fbe\u6469\u9662\u5f00\u6e90\u7684\u5f3a\u5927\u6a21\u578b&#xff0c;\u80fd\u591f\u5c06\u4efb\u4f55\u4e2d\u6587\u53e5\u5b50\u8f6c\u6362\u6210\u4e00\u4e2a\u9ad8\u7ef4\u5ea6\u7684\u201c\u6570\u5b57\u6307\u7eb9\u201d&#xff08;\u6211\u4eec\u79f0\u4e4b\u4e3a\u5411\u91cf&#xff09;&#xff0c;\u7136\u540e\u901a\u8fc7\u8ba1\u7b97\u8fd9\u4e9b\u6307\u7eb9\u7684\u76f8\u4f3c\u5ea6&amp;#xf<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9113,9114,2068,2112],"topic":[],"class_list":["post-81434","post","type-post","status-publish","format-standard","hentry","category-server","tag-9113","tag-9114","tag-nlp","tag-triton"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b\uff1aNVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/81434.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b\uff1aNVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b&#xff1a;NVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848 1. \u5f15\u8a00 \u5982\u679c\u4f60\u6b63\u5728\u5bfb\u627e\u4e00\u4e2a\u80fd\u7cbe\u51c6\u7406\u89e3\u4e2d\u6587\u53e5\u5b50\u542b\u4e49&#xff0c;\u5e76\u80fd\u5feb\u901f\u8ba1\u7b97\u5b83\u4eec\u4e4b\u95f4\u76f8\u4f3c\u5ea6\u7684\u5de5\u5177&#xff0c;\u90a3\u4e48StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u7edd\u5bf9\u503c\u5f97\u4f60\u6df1\u5165\u4e86\u89e3\u3002\u8fd9\u4e2a\u5de5\u5177\u57fa\u4e8e\u963f\u91cc\u8fbe\u6469\u9662\u5f00\u6e90\u7684\u5f3a\u5927\u6a21\u578b&#xff0c;\u80fd\u591f\u5c06\u4efb\u4f55\u4e2d\u6587\u53e5\u5b50\u8f6c\u6362\u6210\u4e00\u4e2a\u9ad8\u7ef4\u5ea6\u7684\u201c\u6570\u5b57\u6307\u7eb9\u201d&#xff08;\u6211\u4eec\u79f0\u4e4b\u4e3a\u5411\u91cf&#xff09;&#xff0c;\u7136\u540e\u901a\u8fc7\u8ba1\u7b97\u8fd9\u4e9b\u6307\u7eb9\u7684\u76f8\u4f3c\u5ea6&amp;#xf\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/81434.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-24T17:42:16+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/81434.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/81434.html\",\"name\":\"StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b\uff1aNVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-24T17:42:16+00:00\",\"dateModified\":\"2026-07-24T17:42:16+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/81434.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/81434.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/81434.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b\uff1aNVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b\uff1aNVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/81434.html","og_locale":"zh_CN","og_type":"article","og_title":"StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b\uff1aNVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b&#xff1a;NVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848 1. \u5f15\u8a00 \u5982\u679c\u4f60\u6b63\u5728\u5bfb\u627e\u4e00\u4e2a\u80fd\u7cbe\u51c6\u7406\u89e3\u4e2d\u6587\u53e5\u5b50\u542b\u4e49&#xff0c;\u5e76\u80fd\u5feb\u901f\u8ba1\u7b97\u5b83\u4eec\u4e4b\u95f4\u76f8\u4f3c\u5ea6\u7684\u5de5\u5177&#xff0c;\u90a3\u4e48StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u7edd\u5bf9\u503c\u5f97\u4f60\u6df1\u5165\u4e86\u89e3\u3002\u8fd9\u4e2a\u5de5\u5177\u57fa\u4e8e\u963f\u91cc\u8fbe\u6469\u9662\u5f00\u6e90\u7684\u5f3a\u5927\u6a21\u578b&#xff0c;\u80fd\u591f\u5c06\u4efb\u4f55\u4e2d\u6587\u53e5\u5b50\u8f6c\u6362\u6210\u4e00\u4e2a\u9ad8\u7ef4\u5ea6\u7684\u201c\u6570\u5b57\u6307\u7eb9\u201d&#xff08;\u6211\u4eec\u79f0\u4e4b\u4e3a\u5411\u91cf&#xff09;&#xff0c;\u7136\u540e\u901a\u8fc7\u8ba1\u7b97\u8fd9\u4e9b\u6307\u7eb9\u7684\u76f8\u4f3c\u5ea6&amp;#xf","og_url":"https:\/\/www.wsisp.com\/helps\/81434.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-24T17:42:16+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/81434.html","url":"https:\/\/www.wsisp.com\/helps\/81434.html","name":"StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b\uff1aNVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-24T17:42:16+00:00","dateModified":"2026-07-24T17:42:16+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/81434.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/81434.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/81434.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"StructBERT\u4e2d\u6587\u53e5\u5411\u91cf\u5de5\u5177\u90e8\u7f72\u6559\u7a0b\uff1aNVIDIA Triton\u63a8\u7406\u670d\u52a1\u5668\u96c6\u6210\u65b9\u6848"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/81434","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=81434"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/81434\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=81434"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=81434"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=81434"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=81434"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}