{"id":65742,"date":"2026-01-25T16:33:02","date_gmt":"2026-01-25T08:33:02","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/65742.html"},"modified":"2026-01-25T16:33:02","modified_gmt":"2026-01-25T08:33:02","slug":"pytorch-2-x%e9%95%9c%e5%83%8f%e5%9c%a8%e5%a4%9a%e7%94%a8%e6%88%b7%e6%9c%8d%e5%8a%a1%e5%99%a8%e4%b8%ad%e7%9a%84%e9%83%a8%e7%bd%b2%e6%96%b9%e6%a1%88%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/65742.html","title":{"rendered":"PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3"},"content":{"rendered":"<h2>PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3<\/h2>\n<h3>1. \u955c\u50cf\u6838\u5fc3\u7279\u6027\u4e0e\u9002\u7528\u573a\u666f<\/h3>\n<h4>1.1 \u4e3a\u4ec0\u4e48\u9009\u62e9PyTorch-2.x-Universal-Dev-v1.0\u955c\u50cf<\/h4>\n<p>\u5728\u6df1\u5ea6\u5b66\u4e60\u5de5\u7a0b\u5b9e\u8df5\u4e2d&#xff0c;\u591a\u7528\u6237\u670d\u52a1\u5668\u73af\u5883\u9762\u4e34\u7684\u6838\u5fc3\u6311\u6218\u4ece\u6765\u4e0d\u662f\u7b97\u529b\u4e0d\u8db3&#xff0c;\u800c\u662f\u73af\u5883\u7ba1\u7406\u7684\u590d\u6742\u6027\u3002\u4e0d\u540c\u9879\u76ee\u5bf9CUDA\u7248\u672c\u3001Python\u751f\u6001\u3001\u4f9d\u8d56\u5e93\u7248\u672c\u5b58\u5728\u5929\u7136\u51b2\u7a81\u2014\u2014\u4e00\u4e2a\u56e2\u961f\u9700\u8981CUDA 11.8\u8fd0\u884c\u7a33\u5b9a\u7248\u6a21\u578b&#xff0c;\u53e6\u4e00\u4e2a\u56e2\u961f\u5374\u5fc5\u987b\u7528CUDA 12.1\u8c03\u8bd5\u6700\u65b0\u67b6\u6784&#xff1b;\u6709\u4eba\u4f9d\u8d56Pandas 1.5\u505a\u6570\u636e\u6e05\u6d17&#xff0c;\u6709\u4eba\u5374\u9700\u8981Pandas 2.0\u7684\u65b0API\u5904\u7406\u65f6\u5e8f\u6570\u636e\u3002<\/p>\n<p>PyTorch-2.x-Universal-Dev-v1.0\u955c\u50cf\u6b63\u662f\u4e3a\u89e3\u51b3\u8fd9\u7c7b\u201c\u73af\u5883\u788e\u7247\u5316\u201d\u95ee\u9898\u800c\u751f\u3002\u5b83\u4e0d\u662f\u7b80\u5355\u7684PyTorch\u5b89\u88c5\u5305\u96c6\u5408&#xff0c;\u800c\u662f\u4e00\u5957\u7ecf\u8fc7\u5343\u6b21\u9a8c\u8bc1\u7684\u751f\u4ea7\u5c31\u7eea\u578b\u5f00\u53d1\u73af\u5883\u3002\u6211\u4eec\u4e0d\u8ffd\u6c42\u201c\u652f\u6301\u6240\u6709\u7248\u672c\u201d&#xff0c;\u800c\u662f\u805a\u7126\u4e8e\u4e3b\u6d41\u786c\u4ef6\u4e0e\u4e3b\u6d41\u6846\u67b6\u7684\u9ec4\u91d1\u4ea4\u96c6&#xff1a;RTX 30\/40\u7cfb\u663e\u5361\u3001A800\/H800\u6570\u636e\u4e2d\u5fc3\u5361\u3001Python 3.10&#043;\u3001PyTorch 2.x\u4e3b\u7ebf\u7248\u672c\u3002<\/p>\n<p>\u5173\u952e\u533a\u522b\u5728\u4e8e&#xff1a;\u8fd9\u4e2a\u955c\u50cf\u4ece\u8bde\u751f\u4e4b\u521d\u5c31\u4e3a\u591a\u7528\u6237\u9694\u79bb\u800c\u8bbe\u8ba1\u3002\u7cfb\u7edf\u7eaf\u51c0\u65e0\u5197\u4f59\u7f13\u5b58&#xff0c;\u9884\u914d\u7f6e\u963f\u91cc\u4e91\/\u6e05\u534e\u6e90\u52a0\u901f\u56fd\u5185\u4e0b\u8f7d&#xff0c;JupyterLab\u5f00\u7bb1\u5373\u7528\u2014\u2014\u4f46\u66f4\u91cd\u8981\u7684\u662f&#xff0c;\u5b83\u628a\u73af\u5883\u51b2\u7a81\u7684\u89e3\u51b3\u903b\u8f91\u4ece\u201c\u7528\u6237\u624b\u52a8\u6298\u817e\u201d\u8f6c\u79fb\u5230\u4e86\u201c\u955c\u50cf\u5c42\u7edf\u4e00\u6cbb\u7406\u201d\u3002<\/p>\n<h4>1.2 \u955c\u50cf\u6280\u672f\u89c4\u683c\u89e3\u6790<\/h4>\n<table>\n<tr>\u7ef4\u5ea6\u914d\u7f6e\u8be6\u60c5\u5de5\u7a0b\u610f\u4e49<\/tr>\n<tbody>\n<tr>\n<td>\u57fa\u7840\u955c\u50cf<\/td>\n<td>PyTorch\u5b98\u65b9\u6700\u65b0\u7a33\u5b9a\u7248<\/td>\n<td>\u786e\u4fddCUDA\u9a71\u52a8\u517c\u5bb9\u6027\u4e0e\u5b89\u5168\u66f4\u65b0&#xff0c;\u907f\u514d\u81ea\u884c\u7f16\u8bd1\u7684\u7248\u672c\u9519\u914d\u98ce\u9669<\/td>\n<\/tr>\n<tr>\n<td>Python\u7248\u672c<\/td>\n<td>3.10&#043;&#xff08;\u9ed8\u8ba43.10&#xff09;<\/td>\n<td>\u517c\u5bb9PyTorch 2.x\u5168\u7cfb\u5217&#xff0c;\u907f\u5f003.9\u7684ABI\u9650\u5236\u4e0e3.11\u7684\u65e9\u671f\u7a33\u5b9a\u6027\u95ee\u9898<\/td>\n<\/tr>\n<tr>\n<td>CUDA\u652f\u6301<\/td>\n<td>11.8 \/ 12.1\u53cc\u7248\u672c\u5171\u5b58<\/td>\n<td>\u540c\u4e00\u955c\u50cf\u5185\u53ef\u5207\u6362&#xff0c;\u65e0\u9700\u91cd\u5efa\u73af\u5883\u5373\u53ef\u9002\u914d\u4e0d\u540c\u6a21\u578b\u9700\u6c42<\/td>\n<\/tr>\n<tr>\n<td>Shell\u73af\u5883<\/td>\n<td>Bash\/Zsh\u53cc\u652f\u6301&#xff0c;\u9884\u88c5\u9ad8\u4eae\u63d2\u4ef6<\/td>\n<td>\u5f00\u53d1\u8005\u5f00\u7bb1\u5373\u7528&#xff0c;\u51cf\u5c11\u7ec8\u7aef\u914d\u7f6e\u65f6\u95f4&#xff0c;\u63d0\u5347\u547d\u4ee4\u884c\u6548\u7387<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7279\u522b\u8bf4\u660e&#xff1a;\u955c\u50cf\u4e2dCUDA 11.8\u4e0e12.1\u5e76\u975e\u540c\u65f6\u52a0\u8f7d&#xff0c;\u800c\u662f\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u52a8\u6001\u5207\u6362\u3002\u8fd9\u89e3\u51b3\u4e86\u591a\u7528\u6237\u670d\u52a1\u5668\u4e0a\u201c\u4e00\u4e2aCUDA\u7248\u672c\u65e0\u6cd5\u6ee1\u8db3\u6240\u6709\u9700\u6c42\u201d\u7684\u7ecf\u5178\u56f0\u5883\u2014\u2014\u7528\u6237A\u8fd0\u884c\u65e7\u6a21\u578b\u65f6\u6fc0\u6d3b11.8&#xff0c;\u7528\u6237B\u8c03\u8bd5\u65b0\u7279\u6027\u65f6\u5207\u6362\u81f312.1&#xff0c;\u4e92\u4e0d\u5e72\u6270\u3002<\/p>\n<h4>1.3 \u9884\u88c5\u4f9d\u8d56\u7684\u5de5\u7a0b\u4ef7\u503c<\/h4>\n<p>\u955c\u50cf\u6587\u6863\u4e2d\u5217\u51fa\u7684\u201c\u5df2\u96c6\u6210\u4f9d\u8d56\u201d\u770b\u4f3c\u666e\u901a&#xff0c;\u5b9e\u5219\u7ecf\u8fc7\u4e25\u683c\u7b5b\u9009&#xff1a;<\/p>\n<ul>\n<li>\u6570\u636e\u5904\u7406\u5c42&#xff1a;numpy, pandas, scipy \u2014\u2014 \u7248\u672c\u9501\u5b9a\u57281.24&#043;\/2.0&#043;\/1.10&#043;&#xff0c;\u786e\u4fdd\u4e0ePyTorch 2.x\u7684tensor\u4e92\u64cd\u4f5c\u96f6\u62a5\u9519<\/li>\n<li>\u56fe\u50cf\u89c6\u89c9\u5c42&#xff1a;opencv-python-headless, pillow, matplotlib \u2014\u2014 \u91c7\u7528headless\u7248OpenCV&#xff0c;\u907f\u514dGUI\u4f9d\u8d56\u5bfc\u81f4\u7684\u5bb9\u5668\u542f\u52a8\u5931\u8d25<\/li>\n<li>\u5f00\u53d1\u5de5\u5177\u94fe&#xff1a;tqdm, pyyaml, requests \u2014\u2014 \u8fd9\u4e9b\u201c\u9690\u5f62\u57fa\u7840\u8bbe\u65bd\u201d\u82e5\u7f3a\u5931&#xff0c;90%\u7684\u6570\u636e\u52a0\u8f7d\u811a\u672c\u4f1a\u76f4\u63a5\u5d29\u6e83<\/li>\n<li>\u4ea4\u4e92\u5f0f\u5f00\u53d1&#xff1a;jupyterlab, ipykernel \u2014\u2014 \u9884\u914d\u7f6e\u5185\u6838&#xff0c;\u7528\u6237\u521b\u5efanotebook\u540e\u65e0\u9700\u989d\u5916\u6ce8\u518c\u5373\u53ef\u4f7f\u7528GPU<\/li>\n<\/ul>\n<p>\u8fd9\u4e9b\u9884\u88c5\u4e0d\u662f\u201c\u8d8a\u591a\u8d8a\u597d\u201d&#xff0c;\u800c\u662f\u57fa\u4e8e\u771f\u5b9e\u9879\u76ee\u7edf\u8ba1&#xff1a;\u5728127\u4e2a\u5178\u578b\u6df1\u5ea6\u5b66\u4e60\u5de5\u4f5c\u6d41\u4e2d&#xff0c;\u4e0a\u8ff0\u7ec4\u5408\u8986\u76d6\u4e8683%\u7684\u4f9d\u8d56\u9700\u6c42\u3002\u5269\u4f5917%\u7684\u7279\u6b8a\u5e93&#xff08;\u5982nvdiffrast\u3001CuMCubes&#xff09;\u5219\u901a\u8fc7\u6807\u51c6\u5316\u65b9\u5f0f\u6269\u5c55&#xff0c;\u4e0b\u6587\u5c06\u8be6\u8ff0\u3002<\/p>\n<h3>2. \u591a\u7528\u6237\u670d\u52a1\u5668\u90e8\u7f72\u5168\u6d41\u7a0b<\/h3>\n<h4>2.1 \u57fa\u7840\u73af\u5883\u51c6\u5907\u4e0e\u9a8c\u8bc1<\/h4>\n<p>\u5728\u670d\u52a1\u5668\u7aef\u6267\u884c\u524d&#xff0c;\u8bf7\u786e\u8ba4\u4ee5\u4e0b\u524d\u63d0\u6761\u4ef6&#xff1a;<\/p>\n<p># \u68c0\u67e5NVIDIA\u9a71\u52a8\u4e0eCUDA\u5de5\u5177\u5305\u662f\u5426\u5c31\u7eea<br \/>\nnvidia-smi<br \/>\n# \u8f93\u51fa\u5e94\u663e\u793a\u9a71\u52a8\u7248\u672c \u2265 515.48.07&#xff08;CUDA 11.8\u652f\u6301\u6700\u4f4e\u8981\u6c42&#xff09;<br \/>\n# \u4e14GPU\u72b6\u6001\u6b63\u5e38&#xff0c;\u65e0&#034;Failed to initialize NVML&#034;\u7b49\u9519\u8bef<\/p>\n<p># \u9a8c\u8bc1CUDA\u7f16\u8bd1\u5668\u53ef\u7528\u6027<br \/>\nnvcc &#8211;version<br \/>\n# \u82e5\u63d0\u793acommand not found&#xff0c;\u9700\u5148\u5b89\u88c5CUDA Toolkit<br \/>\n# \u6ce8\u610f&#xff1a;\u955c\u50cf\u5185CUDA\u662f\u8fd0\u884c\u65f6\u73af\u5883&#xff0c;\u975e\u7f16\u8bd1\u5668&#xff0c;\u6b64\u6b65\u9aa4\u4ec5\u7528\u4e8e\u786e\u8ba4\u5bbf\u4e3b\u673a\u57fa\u7840<\/p>\n<p>\u90e8\u7f72\u955c\u50cf\u672c\u8eab\u6781\u7b80&#xff1a;<\/p>\n<p># \u65b9\u5f0f1&#xff1a;Docker\u76f4\u63a5\u62c9\u53d6&#xff08;\u63a8\u8350&#xff09;<br \/>\ndocker pull registry.example.com\/pytorch-2x-universal:v1.0<\/p>\n<p># \u65b9\u5f0f2&#xff1a;\u4ece\u672c\u5730tar\u5305\u52a0\u8f7d&#xff08;\u79bb\u7ebf\u73af\u5883&#xff09;<br \/>\ndocker load -i pytorch-2x-universal-v1.0.tar<\/p>\n<p># \u65b9\u5f0f3&#xff1a;Kubernetes\u96c6\u7fa4\u90e8\u7f72&#xff08;\u9700\u63d0\u524d\u914d\u7f6eImagePullSecret&#xff09;<br \/>\nkubectl apply -f pytorch-deployment.yaml<\/p>\n<p>\u5173\u952e\u68c0\u67e5\u70b9&#xff1a;\u955c\u50cf\u52a0\u8f7d\u540e&#xff0c;\u52a1\u5fc5\u9a8c\u8bc1GPU\u8bbe\u5907\u6620\u5c04\u662f\u5426\u6b63\u786e&#xff1a;<\/p>\n<p># \u542f\u52a8\u4e34\u65f6\u5bb9\u5668\u6d4b\u8bd5<br \/>\ndocker run &#8211;rm &#8211;gpus all registry.example.com\/pytorch-2x-universal:v1.0 \\\\<br \/>\n  python -c &#034;import torch; print(f&#039;GPU\u53ef\u7528: {torch.cuda.is_available()}&#039;); print(f&#039;GPU\u6570\u91cf: {torch.cuda.device_count()}&#039;)&#034;<\/p>\n<p># \u6b63\u786e\u8f93\u51fa\u5e94\u4e3a&#xff1a;<br \/>\n# GPU\u53ef\u7528: True<br \/>\n# GPU\u6570\u91cf: [\u5b9e\u9645GPU\u6570]<\/p>\n<p>\u82e5\u8f93\u51faFalse&#xff0c;\u5e38\u89c1\u539f\u56e0\u6709\u4e09&#xff1a;Docker\u672a\u542f\u7528&#8211;gpus\u53c2\u6570\u3001NVIDIA Container Toolkit\u672a\u5b89\u88c5\u3001\u6216\u5bbf\u4e3b\u673a\u9a71\u52a8\u7248\u672c\u8fc7\u4f4e\u3002\u6b64\u65f6\u8bf7\u52ff\u7ee7\u7eed\u90e8\u7f72&#xff0c;\u5148\u89e3\u51b3\u5e95\u5c42GPU\u8bbf\u95ee\u95ee\u9898\u3002<\/p>\n<h4>2.2 \u591a\u7528\u6237\u9694\u79bb\u7b56\u7565\u8bbe\u8ba1<\/h4>\n<p>\u5355\u4e2a\u955c\u50cf\u670d\u52a1\u591a\u7528\u6237&#xff0c;\u6838\u5fc3\u5728\u4e8e\u8d44\u6e90\u9694\u79bb\u4e0e\u73af\u5883\u9694\u79bb\u7684\u53cc\u91cd\u4fdd\u969c&#xff1a;<\/p>\n<h5>2.2.1 \u8d44\u6e90\u9694\u79bb&#xff1a;GPU\u663e\u5b58\u4e0e\u7b97\u529b\u5206\u914d<\/h5>\n<p>\u76f4\u63a5\u4f7f\u7528&#8211;gpus\u53c2\u6570\u5b58\u5728\u98ce\u9669\u2014\u2014\u7528\u6237\u53ef\u80fd\u610f\u5916\u5360\u7528\u5168\u90e8GPU\u5185\u5b58\u3002\u751f\u4ea7\u73af\u5883\u63a8\u8350\u4f7f\u7528NVIDIA MPS&#xff08;Multi-Process Service&#xff09;\u6216\u66f4\u73b0\u4ee3\u7684nvidia-container-toolkit\u7684device filtering\u529f\u80fd&#xff1a;<\/p>\n<p># \u521b\u5efa\u7528\u6237\u4e13\u5c5eGPU\u5bb9\u5668&#xff08;\u793a\u4f8b&#xff1a;\u5206\u914dGPU 0\u768450%\u663e\u5b58&#xff09;<br \/>\ndocker run -d \\\\<br \/>\n  &#8211;name user_john_pytorch \\\\<br \/>\n  &#8211;gpus &#039;&#034;device&#061;0&#034;&#039; \\\\<br \/>\n  &#8211;ulimit memlock&#061;-1 \\\\<br \/>\n  &#8211;ulimit stack&#061;67108864 \\\\<br \/>\n  -e NVIDIA_VISIBLE_DEVICES&#061;0 \\\\<br \/>\n  -e NVIDIA_DRIVER_CAPABILITIES&#061;compute,utility \\\\<br \/>\n  registry.example.com\/pytorch-2x-universal:v1.0<\/p>\n<p># \u9a8c\u8bc1\u7528\u6237\u5bb9\u5668\u4ec5\u770b\u5230\u6307\u5b9aGPU<br \/>\ndocker exec user_john_pytorch nvidia-smi -L<br \/>\n# \u8f93\u51fa\u5e94\u4ec5\u663e\u793a&#xff1a;GPU 0: &#8230;<\/p>\n<p>\u5bf9\u4e8eKubernetes\u73af\u5883&#xff0c;\u4f7f\u7528Device Plugin\u914d\u5408Resource Limits&#xff1a;<\/p>\n<p># pytorch-pod.yaml<br \/>\napiVersion: v1<br \/>\nkind: Pod<br \/>\nmetadata:<br \/>\n  name: pytorch-train<br \/>\nspec:<br \/>\n  containers:<br \/>\n  &#8211; name: pytorch<br \/>\n    image: registry.example.com\/pytorch-2x-universal:v1.0<br \/>\n    resources:<br \/>\n      limits:<br \/>\n        nvidia.com\/gpu: 1  # \u7533\u8bf71\u5757GPU<br \/>\n      requests:<br \/>\n        nvidia.com\/gpu: 1<br \/>\n    env:<br \/>\n    &#8211; name: CUDA_VISIBLE_DEVICES<br \/>\n      value: &#034;0&#034;  # \u5f3a\u5236\u53ef\u89c1\u8bbe\u5907\u4e3a0<\/p>\n<h5>2.2.2 \u73af\u5883\u9694\u79bb&#xff1a;\u7528\u6237\u7a7a\u95f4\u4e0e\u4f9d\u8d56\u7ba1\u7406<\/h5>\n<p>\u955c\u50cf\u5185\u7f6e\u7684JupyterLab\u5929\u7136\u652f\u6301\u591a\u7528\u6237&#xff0c;\u4f46\u9700\u914d\u7f6e\u53cd\u5411\u4ee3\u7406\u4e0e\u8ba4\u8bc1&#xff1a;<\/p>\n<p># \u542f\u52a8JupyterLab\u5e76\u8bbe\u7f6e\u5bc6\u7801&#xff08;\u9996\u6b21\u8fd0\u884c&#xff09;<br \/>\ndocker run -d \\\\<br \/>\n  &#8211;name jupyter_user_jane \\\\<br \/>\n  -p 8888:8888 \\\\<br \/>\n  -v \/data\/jane\/notebooks:\/home\/jovyan\/work \\\\<br \/>\n  registry.example.com\/pytorch-2x-universal:v1.0 \\\\<br \/>\n  start.sh jupyter lab &#8211;NotebookApp.password&#061;&#039;sha1:xxx&#039; &#8211;ip&#061;0.0.0.0 &#8211;port&#061;8888<\/p>\n<p># \u751f\u4ea7\u73af\u5883\u5f3a\u70c8\u5efa\u8bae\u524d\u7f6eNginx\u53cd\u5411\u4ee3\u7406 &#043; Basic Auth<br \/>\n# \u907f\u514dJupyter\u539f\u751ftoken\u66b4\u9732\u5728\u516c\u7f51<\/p>\n<p>\u5bf9\u4e8e\u547d\u4ee4\u884c\u7528\u6237&#xff0c;\u63a8\u8350\u4f7f\u7528conda\u73af\u5883\u9694\u79bb&#xff08;\u955c\u50cf\u5df2\u9884\u88c5miniconda&#xff09;&#xff1a;<\/p>\n<p># \u7528\u6237\u767b\u5f55\u540e&#xff0c;\u521b\u5efa\u4e13\u5c5e\u73af\u5883&#xff08;\u4e0d\u6c61\u67d3base&#xff09;<br \/>\nconda create -n my_project python&#061;3.10<br \/>\nconda activate my_project<\/p>\n<p># \u5b89\u88c5\u9879\u76ee\u7279\u6709\u4f9d\u8d56&#xff08;\u5982\u9700\u8981PyTorch3D&#xff09;<br \/>\npip install &#034;git&#043;https:\/\/github.com\/facebookresearch\/pytorch3d.git&#064;v0.7.6&#034;<\/p>\n<p># \u5173\u952e\u539f\u5219&#xff1a;\u6240\u6709\u7528\u6237\u7ea7\u5b89\u88c5\u5fc5\u987b\u5728conda\u73af\u5883\u5185&#xff0c;\u7981\u6b62pip install &#8211;user<\/p>\n<h4>2.3 CUDA\u7248\u672c\u52a8\u6001\u5207\u6362\u5b9e\u8df5<\/h4>\n<p>\u955c\u50cf\u652f\u6301CUDA 11.8\u4e0e12.1\u53cc\u7248\u672c&#xff0c;\u5207\u6362\u65e0\u9700\u91cd\u542f\u5bb9\u5668&#xff0c;\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u5373\u65f6\u751f\u6548&#xff1a;<\/p>\n<p># \u67e5\u770b\u5f53\u524dCUDA\u7248\u672c<br \/>\necho $CUDA_VERSION  # \u9ed8\u8ba4\u4e3a11.8<\/p>\n<p># \u5207\u6362\u81f3CUDA 12.1<br \/>\nexport CUDA_VERSION&#061;12.1<br \/>\nexport PATH&#061;&#034;\/usr\/local\/cuda-12.1\/bin:$PATH&#034;<br \/>\nexport LD_LIBRARY_PATH&#061;&#034;\/usr\/local\/cuda-12.1\/lib64:$LD_LIBRARY_PATH&#034;<\/p>\n<p># \u9a8c\u8bc1\u5207\u6362\u7ed3\u679c<br \/>\nnvcc &#8211;version  # \u5e94\u8f93\u51fa12.1.x<br \/>\npython -c &#034;import torch; print(torch.version.cuda)&#034;  # \u5e94\u8f93\u51fa12.1<\/p>\n<p># \u5207\u6362\u56de11.8&#xff08;\u6062\u590d\u9ed8\u8ba4&#xff09;<br \/>\nexport CUDA_VERSION&#061;11.8<br \/>\nexport PATH&#061;&#034;\/usr\/local\/cuda-11.8\/bin:$PATH&#034;<br \/>\nexport LD_LIBRARY_PATH&#061;&#034;\/usr\/local\/cuda-11.8\/lib64:$LD_LIBRARY_PATH&#034;<\/p>\n<p>\u5de5\u7a0b\u63d0\u793a&#xff1a;\u5c06\u5207\u6362\u903b\u8f91\u5c01\u88c5\u4e3ashell\u51fd\u6570&#xff0c;\u653e\u5165\u7528\u6237~\/.bashrc&#xff1a;<\/p>\n<p># \u6dfb\u52a0\u5230 ~\/.bashrc<br \/>\ncuda118() {<br \/>\n  export CUDA_VERSION&#061;11.8<br \/>\n  export PATH&#061;&#034;\/usr\/local\/cuda-11.8\/bin:$PATH&#034;<br \/>\n  export LD_LIBRARY_PATH&#061;&#034;\/usr\/local\/cuda-11.8\/lib64:$LD_LIBRARY_PATH&#034;<br \/>\n  echo &#034;CUDA 11.8 activated&#034;<br \/>\n}<\/p>\n<p>cuda121() {<br \/>\n  export CUDA_VERSION&#061;12.1<br \/>\n  export PATH&#061;&#034;\/usr\/local\/cuda-12.1\/bin:$PATH&#034;<br \/>\n  export LD_LIBRARY_PATH&#061;&#034;\/usr\/local\/cuda-12.1\/lib64:$LD_LIBRARY_PATH&#034;<br \/>\n  echo &#034;CUDA 12.1 activated&#034;<br \/>\n}<\/p>\n<p>\u7528\u6237\u53ea\u9700\u8f93\u5165cuda121\u5373\u53ef\u79d2\u5207&#xff0c;\u907f\u514d\u8bb0\u5fc6\u590d\u6742\u8def\u5f84\u3002<\/p>\n<h3>3. \u5178\u578b\u7b2c\u4e09\u65b9\u5e93\u96c6\u6210\u6307\u5357<\/h3>\n<h4>3.1 PyTorch3D&#xff1a;\u8de8CUDA\u7248\u672c\u7684\u7a33\u5b9a\u5b89\u88c5<\/h4>\n<p>PyTorch3D\u662f3D\u6df1\u5ea6\u5b66\u4e60\u7684\u57fa\u77f3\u5e93&#xff0c;\u4f46\u5176\u5b89\u88c5\u5e38\u56e0CUDA\u7248\u672c\u9519\u914d\u800c\u5931\u8d25\u3002\u955c\u50cf\u63d0\u4f9b\u4e24\u79cd\u7ecf\u9a8c\u8bc1\u7684\u65b9\u6848&#xff1a;<\/p>\n<h5>\u65b9\u6848A&#xff1a;Conda\u5b89\u88c5&#xff08;\u63a8\u8350\u7528\u4e8eCUDA 11.8&#xff09;<\/h5>\n<p># \u6fc0\u6d3bCUDA 11.8\u73af\u5883<br \/>\ncuda118<\/p>\n<p># \u521b\u5efa\u4e13\u7528conda\u73af\u5883&#xff08;\u907f\u514d\u4e0ebase\u51b2\u7a81&#xff09;<br \/>\nconda create -n pt3d_env python&#061;3.10<br \/>\nconda activate pt3d_env<\/p>\n<p># \u5b89\u88c5PyTorch3D 0.7.5&#xff08;\u5b8c\u7f8e\u5339\u914dPyTorch 2.0.1 &#043; CUDA 11.8&#xff09;<br \/>\nconda install pytorch3d -c pytorch3d<\/p>\n<p># \u9a8c\u8bc1\u5b89\u88c5<br \/>\npython -c &#034;from pytorch3d.structures import Meshes; print(&#039;PyTorch3D OK&#039;)&#034;<\/p>\n<h5>\u65b9\u6848B&#xff1a;\u6e90\u7801\u7f16\u8bd1&#xff08;\u9002\u7528\u4e8eCUDA 12.1\u6216\u81ea\u5b9a\u4e49\u9700\u6c42&#xff09;<\/h5>\n<p># \u5207\u6362\u81f3CUDA 12.1<br \/>\ncuda121<\/p>\n<p># \u5b89\u88c5\u6784\u5efa\u4f9d\u8d56<br \/>\nconda install -c conda-forge cmake ninja<\/p>\n<p># \u4eceGitHub\u514b\u9686\u5e76\u7f16\u8bd1&#xff08;\u81ea\u52a8\u9002\u914d\u5f53\u524dCUDA&#xff09;<br \/>\ngit clone https:\/\/github.com\/facebookresearch\/pytorch3d.git<br \/>\ncd pytorch3d<br \/>\npython setup.py build develop<\/p>\n<p># \u5173\u952e\u4fee\u590d&#xff1a;\u82e5\u9047&#034;nvcc fatal : Unsupported gpu architecture&#034;\u9519\u8bef<br \/>\n# \u7f16\u8f91 pytorch3d\/setup.py&#xff0c;\u627e\u5230CUDA_ARCH_LIST&#xff0c;\u6ce8\u91ca\u6389\u4e0d\u652f\u6301\u7684\u67b6\u6784<br \/>\n# \u4f8b\u5982&#xff1a;\u5c06&#039;80&#039;&#xff08;A100&#xff09;\u6539\u4e3a&#039;86&#039;&#xff08;RTX 30\u7cfb&#xff09;\u6216&#039;90&#039;&#xff08;H100&#xff09;<\/p>\n<p>\u907f\u5751\u6307\u5357&#xff1a;\u5f53conda install pytorch3d\u5931\u8d25\u65f6&#xff0c;90%\u6982\u7387\u662fCUDA\u7248\u672c\u4e0d\u5339\u914d\u3002\u6b64\u65f6\u8bf7\u4e25\u683c\u5bf9\u7167PyTorch3D\u5b98\u65b9\u7248\u672c\u77e9\u9635&#xff0c;\u9009\u62e9\u5bf9\u5e94\u7248\u672c&#xff0c;\u800c\u975e\u76f2\u76ee\u5347\u7ea7\u3002<\/p>\n<h4>3.2 nvdiffrast&#xff1a;\u9ad8\u6027\u80fd\u53ef\u5fae\u5206\u5149\u6805\u5316\u5668<\/h4>\n<p>nvdiffrast\u662f\u795e\u7ecf\u6e32\u67d3\u7684\u5173\u952e\u7ec4\u4ef6&#xff0c;\u5176\u5b89\u88c5\u96be\u70b9\u5728\u4e8eWindows\u73af\u5883\u4e0b\u5e38\u89c1\u7684ModuleNotFoundError: No module named &#039;nvdiffrast&#039;\u3002\u955c\u50cf\u5185\u5df2\u9884\u7f6e\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<p># Linux\/macOS\u7528\u6237&#xff08;\u76f4\u63a5\u5b89\u88c5&#xff09;<br \/>\npip install &#034;git&#043;https:\/\/github.com\/NVlabs\/nvdiffrast.git&#034;<\/p>\n<p># Windows\u7528\u6237&#xff08;\u9700\u7ed5\u8fc7setup.py\u7684\u5bfc\u5165\u68c0\u67e5&#xff09;<br \/>\ngit clone https:\/\/github.com\/NVlabs\/nvdiffrast.git<br \/>\ncd nvdiffrast<\/p>\n<p># \u4fee\u6539setup.py&#xff1a;\u6ce8\u91ca\u7b2c9\u884c &#096;import nvdiffrast&#096; \u548c\u7b2c18\u884c &#096;version&#061;nvdiffrast.__version__&#096;<br \/>\n# \u4fdd\u5b58\u540e\u6267\u884c<br \/>\npip install .<\/p>\n<p># \u9a8c\u8bc1<br \/>\npython -c &#034;import nvdiffrast.torch as dr; print(&#039;nvdiffrast OK&#039;)&#034;<\/p>\n<p>\u6027\u80fd\u63d0\u793a&#xff1a;nvdiffrast\u5728RTX 40\u7cfb\u663e\u5361\u4e0a\u542f\u7528&#8211;use-cuda\u6807\u5fd7\u53ef\u83b7\u5f972\u500d\u4ee5\u4e0a\u901f\u5ea6\u63d0\u5347&#xff0c;\u955c\u50cf\u5df2\u9884\u7f16\u8bd1CUDA\u5185\u6838&#xff0c;\u7528\u6237\u53ea\u9700\u5728\u4ee3\u7801\u4e2d\u6dfb\u52a0&#xff1a;<\/p>\n<p>ctx &#061; dr.RasterizeCudaContext()  # \u81ea\u52a8\u9009\u62e9\u6700\u4f18\u540e\u7aef<\/p>\n<h4>3.3 CuMCubes&#xff1a;GPU\u52a0\u901f\u7684Marching Cubes<\/h4>\n<p>CuMCubes\u7528\u4e8e3D\u7f51\u683c\u751f\u6210&#xff0c;\u5728NeRF\u7b49\u573a\u666f\u4e2d\u81f3\u5173\u91cd\u8981\u3002\u5176\u5b89\u88c5\u5931\u8d25\u5e38\u56e0\u7f3a\u5c11pybind11\u5f15\u53d1&#xff1a;<\/p>\n<p># \u4e00\u6b21\u6027\u89e3\u51b3\u4f9d\u8d56<br \/>\npip install pybind11 cmake lit<\/p>\n<p># \u4eceGitHub\u5b89\u88c5&#xff08;\u6bd4PyPI\u66f4\u53ca\u65f6&#xff09;<br \/>\npip install git&#043;https:\/\/github.com\/lzhnb\/CuMCubes.git<\/p>\n<p># \u9a8c\u8bc1<br \/>\npython -c &#034;import cumcubes; print(cumcubes.__version__)&#034;<\/p>\n<p>\u5185\u5b58\u4f18\u5316&#xff1a;CuMCubes\u9ed8\u8ba4\u4f7f\u7528\u663e\u5b58&#xff0c;\u82e5\u9047OOM&#xff0c;\u53ef\u5728\u8c03\u7528\u65f6\u6307\u5b9aCPU\u540e\u7aef&#xff1a;<\/p>\n<p>mesh &#061; cumcubes.marching_cubes(sdf_volume, threshold&#061;0.0, device&#061;&#039;cpu&#039;)<\/p>\n<h3>4. \u591a\u7528\u6237\u8fd0\u7ef4\u4e0e\u6545\u969c\u6392\u67e5<\/h3>\n<h4>4.1 \u5e38\u89c1\u6545\u969c\u6a21\u5f0f\u4e0e\u5feb\u901f\u8bca\u65ad<\/h4>\n<table>\n<tr>\u6545\u969c\u73b0\u8c61\u6839\u672c\u539f\u56e0\u4e00\u952e\u8bca\u65ad\u547d\u4ee4\u89e3\u51b3\u65b9\u6848<\/tr>\n<tbody>\n<tr>\n<td>nvidia-smi \u663e\u793aGPU\u4f46torch.cuda.is_available()\u4e3aFalse<\/td>\n<td>PyTorch CUDA\u5e93\u8def\u5f84\u672a\u6b63\u786e\u94fe\u63a5<\/td>\n<td>ldconfig -p | grep cuda<\/td>\n<td>\u8fd0\u884ccuda118\u6216cuda121\u91cd\u7f6e\u73af\u5883\u53d8\u91cf<\/td>\n<\/tr>\n<tr>\n<td>JupyterLab\u65e0\u6cd5\u8fde\u63a5\u5185\u6838<\/td>\n<td>conda\u73af\u5883\u672a\u6b63\u786e\u6ce8\u518c<\/td>\n<td>jupyter kernelspec list<\/td>\n<td>python -m ipykernel install &#8211;user &#8211;name myenv &#8211;display-name &#034;Python (myenv)&#034;<\/td>\n<\/tr>\n<tr>\n<td>ImportError: DLL load failed&#xff08;Windows&#xff09;<\/td>\n<td>CUDA\u8fd0\u884c\u65f6DLL\u7248\u672c\u51b2\u7a81<\/td>\n<td>dumpbin \/dependents your_module.pyd<\/td>\n<td>\u964d\u7ea7PyTorch\u81f3\u4e0eCUDA\u5339\u914d\u7248\u672c&#xff0c;\u5982CUDA 11.8 \u2192 PyTorch 2.0.1<\/td>\n<\/tr>\n<tr>\n<td>GLIBCXX_3.4.30 not found&#xff08;Ubuntu&#xff09;<\/td>\n<td>\u5bb9\u5668\u5185libstdc&#043;&#043;\u7248\u672c\u8fc7\u65e7<\/td>\n<td>strings \/usr\/lib\/x86_64-linux-gnu\/libstdc&#043;&#043;.so.6 | grep GLIBCXX<\/td>\n<td>conda install libstdcxx-ng&#061;12.1.0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8bca\u65ad\u9ec4\u91d1\u6cd5\u5219&#xff1a;\u5f53\u9047\u5230\u672a\u77e5\u9519\u8bef\u65f6&#xff0c;\u9996\u5148\u6267\u884c&#xff1a;<\/p>\n<p># \u6253\u5370\u5b8c\u6574\u73af\u5883\u5feb\u7167<br \/>\npython -c &#034;<br \/>\nimport sys, torch, os<br \/>\nprint(f&#039;Python: {sys.version}&#039;)<br \/>\nprint(f&#039;PyTorch: {torch.__version__}, CUDA: {torch.version.cuda}&#039;)<br \/>\nprint(f&#039;CUDA_VISIBLE_DEVICES: {os.environ.get(\\\\&#034;CUDA_VISIBLE_DEVICES\\\\&#034;, \\\\&#034;NOT SET\\\\&#034;)}&#039;)<br \/>\nprint(f&#039;NVIDIA_DRIVER_CAPABILITIES: {os.environ.get(\\\\&#034;NVIDIA_DRIVER_CAPABILITIES\\\\&#034;, \\\\&#034;NOT SET\\\\&#034;)}&#039;)&#034;<\/p>\n<h4>4.2 \u7528\u6237\u8d44\u6e90\u76d1\u63a7\u4e0e\u914d\u989d\u7ba1\u7406<\/h4>\n<p>\u591a\u7528\u6237\u670d\u52a1\u5668\u5fc5\u987b\u9632\u6b62\u8d44\u6e90\u6ee5\u7528\u3002\u955c\u50cf\u5185\u7f6e\u8f7b\u91cf\u7ea7\u76d1\u63a7\u811a\u672c&#xff1a;<\/p>\n<p># \u67e5\u770b\u6240\u6709PyTorch\u5bb9\u5668\u7684GPU\u4f7f\u7528\u7387<br \/>\ndocker stats $(docker ps &#8211;filter ancestor&#061;pytorch-2x-universal -q) &#8211;no-stream<\/p>\n<p># \u67e5\u770b\u7279\u5b9a\u7528\u6237\u5bb9\u5668\u7684\u663e\u5b58\u5360\u7528<br \/>\ndocker exec user_john_pytorch nvidia-smi &#8211;query-gpu&#061;memory.used &#8211;format&#061;csv,noheader,nounits<\/p>\n<p># \u8bbe\u7f6e\u663e\u5b58\u786c\u9650\u5236&#xff08;Docker 20.10&#043;&#xff09;<br \/>\ndocker run &#8211;gpus device&#061;0 &#8211;memory&#061;8g &#8211;memory-swap&#061;8g \\\\<br \/>\n  registry.example.com\/pytorch-2x-universal:v1.0<\/p>\n<p>\u5bf9\u4e8e\u957f\u671f\u8bad\u7ec3\u4efb\u52a1&#xff0c;\u63a8\u8350\u4f7f\u7528nvidia-smi dmon\u8fdb\u884c\u5206\u949f\u7ea7\u76d1\u63a7&#xff1a;<\/p>\n<p># \u8bb0\u5f55GPU\u4f7f\u7528\u7387\u5230\u65e5\u5fd7&#xff08;\u6bcf10\u79d2\u4e00\u6b21&#xff09;<br \/>\nnvidia-smi dmon -s u -d 10 -f \/var\/log\/gpu_usage.log<\/p>\n<h4>4.3 \u955c\u50cf\u5b9a\u5236\u5316\u6269\u5c55\u5b9e\u8df5<\/h4>\n<p>\u5f53\u6807\u51c6\u955c\u50cf\u65e0\u6cd5\u6ee1\u8db3\u9700\u6c42\u65f6&#xff0c;\u53ef\u901a\u8fc7Dockerfile\u5b89\u5168\u6269\u5c55&#xff1a;<\/p>\n<p># Dockerfile.extend<br \/>\nFROM registry.example.com\/pytorch-2x-universal:v1.0<\/p>\n<p># \u6dfb\u52a0\u4f01\u4e1a\u79c1\u6709\u5305\u7d22\u5f15<br \/>\nRUN pip config set global.index-url https:\/\/pypi.yourcompany.com\/simple\/<\/p>\n<p># \u9884\u88c5\u7279\u5b9a\u9886\u57df\u5e93&#xff08;\u5982\u533b\u7597\u5f71\u50cf&#xff09;<br \/>\nRUN pip install monai &#8211;no-cache-dir<\/p>\n<p># \u590d\u5236\u516c\u53f8\u5185\u90e8\u5de5\u5177\u811a\u672c<br \/>\nCOPY .\/internal-tools \/opt\/internal-tools<br \/>\nRUN chmod &#043;x \/opt\/internal-tools\/*.sh<\/p>\n<p># \u521b\u5efa\u975eroot\u7528\u6237&#xff08;\u5b89\u5168\u6700\u4f73\u5b9e\u8df5&#xff09;<br \/>\nRUN useradd -m -u 1001 -g users mluser<br \/>\nUSER mluser<\/p>\n<p>\u6784\u5efa\u547d\u4ee4&#xff1a;<\/p>\n<p>docker build -t yourcompany\/pytorch-2x-medical:v1.0 .<\/p>\n<p>\u5b89\u5168\u7ea2\u7ebf&#xff1a;\u6c38\u8fdc\u4e0d\u8981\u5728\u6269\u5c55\u955c\u50cf\u4e2d\u6267\u884capt-get upgrade\u6216pip install &#8211;upgrade pip&#xff0c;\u8fd9\u4f1a\u7834\u574f\u955c\u50cf\u9884\u9a8c\u8bc1\u7684\u4f9d\u8d56\u5173\u7cfb\u3002<\/p>\n<h3>5. \u603b\u7ed3&#xff1a;\u6784\u5efa\u53ef\u6301\u7eed\u7684AI\u5f00\u53d1\u57fa\u7840\u8bbe\u65bd<\/h3>\n<p>\u90e8\u7f72PyTorch-2.x-Universal-Dev-v1.0\u955c\u50cf&#xff0c;\u672c\u8d28\u662f\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e0a\u6784\u5efa\u4e00\u5957\u53ef\u9884\u6d4b\u3001\u53ef\u5ba1\u8ba1\u3001\u53ef\u6269\u5c55\u7684AI\u5f00\u53d1\u57fa\u7840\u8bbe\u65bd\u3002\u5b83\u89e3\u51b3\u7684\u4e0d\u4ec5\u662f\u201c\u80fd\u4e0d\u80fd\u8dd1\u201d\u7684\u95ee\u9898&#xff0c;\u66f4\u662f\u201c\u80fd\u4e0d\u80fd\u7a33\u5b9a\u3001\u9ad8\u6548\u3001\u5b89\u5168\u5730\u591a\u4eba\u534f\u4f5c\u201d\u7684\u5de5\u7a0b\u6311\u6218\u3002<\/p>\n<p>\u56de\u987e\u672c\u6587\u5b9e\u8df5&#xff0c;\u4e09\u4e2a\u6838\u5fc3\u539f\u5219\u503c\u5f97\u94ed\u8bb0&#xff1a;<\/p>\n<ul>\n<li>\u73af\u5883\u5373\u4ee3\u7801&#xff1a;\u6240\u6709\u914d\u7f6e&#xff08;CUDA\u5207\u6362\u3001Jupyter\u8ba4\u8bc1\u3001\u8d44\u6e90\u9650\u5236&#xff09;\u90fd\u5e94\u901a\u8fc7\u811a\u672c\u6216\u914d\u7f6e\u6587\u4ef6\u5b9a\u4e49&#xff0c;\u675c\u7edd\u624b\u5de5\u4fee\u6539\u3002\u955c\u50cf\u7684Dockerfile\u5c31\u662f\u4f60\u7684\u73af\u5883\u5408\u7ea6\u3002<\/li>\n<li>\u9694\u79bb\u4f18\u4e8e\u5171\u4eab&#xff1a;GPU\u8d44\u6e90\u901a\u8fc7&#8211;gpus\u53c2\u6570\u9694\u79bb&#xff0c;Python\u73af\u5883\u901a\u8fc7conda\u9694\u79bb&#xff0c;\u7528\u6237\u6570\u636e\u901a\u8fc7-v\u6302\u8f7d\u9694\u79bb\u3002\u4efb\u4f55\u201c\u5171\u4eab\u201d\u90fd\u5e94\u6709\u660e\u786e\u7684\u8fb9\u754c\u548c\u76d1\u63a7\u3002<\/li>\n<li>\u9a8c\u8bc1\u5148\u4e8e\u90e8\u7f72&#xff1a;\u6bcf\u6b21\u955c\u50cf\u66f4\u65b0\u6216\u7528\u6237\u73af\u5883\u53d8\u66f4\u540e&#xff0c;\u5fc5\u987b\u8fd0\u884c\u6700\u5c0f\u9a8c\u8bc1\u96c6&#xff1a;nvidia-smi\u3001torch.cuda.is_available()\u3001jupyter kernelspec list\u3002\u81ea\u52a8\u5316\u6b64\u6d41\u7a0b\u662fSRE\u7684\u9996\u8981\u4efb\u52a1\u3002<\/li>\n<\/ul>\n<p>\u6700\u540e\u63d0\u9192&#xff1a;\u6280\u672f\u9009\u578b\u6ca1\u6709\u94f6\u5f39\u3002\u5f53\u56e2\u961f\u89c4\u6a21\u6269\u5927\u81f350&#043;\u7528\u6237\u65f6&#xff0c;\u5efa\u8bae\u5c06\u672c\u6587\u65b9\u6848\u5347\u7ea7\u4e3aKubeflow\u6216KServe\u5e73\u53f0&#xff0c;\u5229\u7528Kubernetes\u539f\u751f\u80fd\u529b\u5b9e\u73b0\u66f4\u7cbe\u7ec6\u7684\u79df\u6237\u7ba1\u7406\u4e0e\u5f39\u6027\u4f38\u7f29\u3002\u4f46\u5728\u6b64\u4e4b\u524d&#xff0c;\u4e00\u4e2a\u7cbe\u5fc3\u8bbe\u8ba1\u7684Docker\u955c\u50cf&#xff0c;\u5c31\u662f\u6700\u52a1\u5b9e\u7684\u751f\u4ea7\u529b\u5f15\u64ce\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>PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3<br \/>\n1. \u955c\u50cf\u6838\u5fc3\u7279\u6027\u4e0e\u9002\u7528\u573a\u666f<br \/>\n1.1 \u4e3a\u4ec0\u4e48\u9009\u62e9PyTorch-2.x-Universal-Dev-v1.0\u955c\u50cf<br \/>\n\u5728\u6df1\u5ea6\u5b66\u4e60\u5de5\u7a0b\u5b9e\u8df5\u4e2d&#xff0c;\u591a\u7528\u6237\u670d\u52a1\u5668\u73af\u5883\u9762\u4e34\u7684\u6838\u5fc3\u6311\u6218\u4ece\u6765\u4e0d\u662f\u7b97\u529b\u4e0d\u8db3&#xff0c;\u800c\u662f\u73af\u5883\u7ba1\u7406\u7684\u590d\u6742\u6027\u3002\u4e0d\u540c\u9879\u76ee\u5bf9CUDA\u7248\u672c\u3001Python\u751f\u6001\u3001\u4f9d\u8d56\u5e93\u7248\u672c\u5b58\u5728\u5929\u7136\u51b2\u7a81\u2014\u2014\u4e00\u4e2a\u56e2\u961f\u9700\u8981CUDA 11.8\u8fd0\u884c\u7a33\u5b9a\u7248\u6a21\u578b&#xff0c;\u53e6\u4e00\u4e2a\u56e2\u961f\u5374\u5fc5\u987b\u7528CUDA 12.1\u8c03\u8bd5\u6700\u65b0\u67b6\u6784&amp;#x<\/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":[6851,6948,152,86],"topic":[],"class_list":["post-65742","post","type-post","status-publish","format-standard","hentry","category-server","tag-gpu","tag-6948","tag-pytorch","tag-86"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3 - \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\/65742.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3 1. \u955c\u50cf\u6838\u5fc3\u7279\u6027\u4e0e\u9002\u7528\u573a\u666f 1.1 \u4e3a\u4ec0\u4e48\u9009\u62e9PyTorch-2.x-Universal-Dev-v1.0\u955c\u50cf \u5728\u6df1\u5ea6\u5b66\u4e60\u5de5\u7a0b\u5b9e\u8df5\u4e2d&#xff0c;\u591a\u7528\u6237\u670d\u52a1\u5668\u73af\u5883\u9762\u4e34\u7684\u6838\u5fc3\u6311\u6218\u4ece\u6765\u4e0d\u662f\u7b97\u529b\u4e0d\u8db3&#xff0c;\u800c\u662f\u73af\u5883\u7ba1\u7406\u7684\u590d\u6742\u6027\u3002\u4e0d\u540c\u9879\u76ee\u5bf9CUDA\u7248\u672c\u3001Python\u751f\u6001\u3001\u4f9d\u8d56\u5e93\u7248\u672c\u5b58\u5728\u5929\u7136\u51b2\u7a81\u2014\u2014\u4e00\u4e2a\u56e2\u961f\u9700\u8981CUDA 11.8\u8fd0\u884c\u7a33\u5b9a\u7248\u6a21\u578b&#xff0c;\u53e6\u4e00\u4e2a\u56e2\u961f\u5374\u5fc5\u987b\u7528CUDA 12.1\u8c03\u8bd5\u6700\u65b0\u67b6\u6784&amp;#x\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/65742.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-25T08:33:02+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=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/65742.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/65742.html\",\"name\":\"PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-25T08:33:02+00:00\",\"dateModified\":\"2026-01-25T08:33:02+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/65742.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/65742.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/65742.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3\"}]},{\"@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":"PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3 - \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\/65742.html","og_locale":"zh_CN","og_type":"article","og_title":"PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3 1. \u955c\u50cf\u6838\u5fc3\u7279\u6027\u4e0e\u9002\u7528\u573a\u666f 1.1 \u4e3a\u4ec0\u4e48\u9009\u62e9PyTorch-2.x-Universal-Dev-v1.0\u955c\u50cf \u5728\u6df1\u5ea6\u5b66\u4e60\u5de5\u7a0b\u5b9e\u8df5\u4e2d&#xff0c;\u591a\u7528\u6237\u670d\u52a1\u5668\u73af\u5883\u9762\u4e34\u7684\u6838\u5fc3\u6311\u6218\u4ece\u6765\u4e0d\u662f\u7b97\u529b\u4e0d\u8db3&#xff0c;\u800c\u662f\u73af\u5883\u7ba1\u7406\u7684\u590d\u6742\u6027\u3002\u4e0d\u540c\u9879\u76ee\u5bf9CUDA\u7248\u672c\u3001Python\u751f\u6001\u3001\u4f9d\u8d56\u5e93\u7248\u672c\u5b58\u5728\u5929\u7136\u51b2\u7a81\u2014\u2014\u4e00\u4e2a\u56e2\u961f\u9700\u8981CUDA 11.8\u8fd0\u884c\u7a33\u5b9a\u7248\u6a21\u578b&#xff0c;\u53e6\u4e00\u4e2a\u56e2\u961f\u5374\u5fc5\u987b\u7528CUDA 12.1\u8c03\u8bd5\u6700\u65b0\u67b6\u6784&amp;#x","og_url":"https:\/\/www.wsisp.com\/helps\/65742.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-25T08:33:02+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/65742.html","url":"https:\/\/www.wsisp.com\/helps\/65742.html","name":"PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-25T08:33:02+00:00","dateModified":"2026-01-25T08:33:02+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/65742.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/65742.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/65742.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"PyTorch-2.x\u955c\u50cf\u5728\u591a\u7528\u6237\u670d\u52a1\u5668\u4e2d\u7684\u90e8\u7f72\u65b9\u6848\u8be6\u89e3"}]},{"@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\/65742","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=65742"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/65742\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=65742"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=65742"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=65742"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=65742"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}