使用 PyTorch 將模型定型並匯出至 ONNXTrain a model with PyTorch and export to ONNX

透過 PyTorch 架構和 Azure Machine Learning,您可以在雲端中將模型定型,將其下載為 ONNX 檔案,以在本機使用 Windows Machine Learning 執行。With the PyTorch framework and Azure Machine Learning, you can train a model in the cloud and download it as an ONNX file to run locally with Windows Machine Learning.

定型模型Train the model

透過 Azure ML,您可以在雲端中將 PyTorch 模型定型,以取得快速相應放大、部署等等的優點。With Azure ML, you can train a PyTorch model in the cloud, getting the benefits of rapid scale-out, deployment, and more. 如需詳細資訊,請參閱使用 Azure Machine Learning 大規模針對 PyTorch 模型進行定型和註冊See Train and register PyTorch models at scale with Azure Machine Learning for more information.

匯出至 ONNXExport to ONNX

將模型定型之後,您可以將其匯出為 ONNX 檔案,以便您可以在本機使用 Windows ML 執行。Once you've trained the model, you can export it as an ONNX file so you can run it locally with Windows ML. 如需如何從 PyTorch 以原生方式匯出的指示,請參閱匯出 Windows ML 的 PyTorch 模型See Export PyTorch models for Windows ML for instructions on how to natively export from PyTorch.

與 Windows ML 整合Integrate with Windows ML

將模型匯出至 ONNX 之後,您就可以將其整合到 Windows ML 應用程式中。After you've exported the model to ONNX, you're ready to integrate it into a Windows ML application. Windows ML 提供數種不同的程式設計語言,因此請查看您最熟悉語言的教學課程。Windows ML is available in several different programming languages, so check out a tutorial in the language you're most comfortable with.

注意

使用下列資源取得 Windows ML 的說明:Use the following resources for help with Windows ML:

  • 如需詢問或回答有關 Windows ML 的技術問題,請使用 Stack Overflow 上的 windows-machine-learning 標籤。To ask or answer technical questions about Windows ML, please use the windows-machine-learning tag on Stack Overflow.
  • 如需回報錯誤 (bug),請在 GitHub 上提出問題。To report a bug, please file an issue on our GitHub.
  • 如需要求功能,請前往 Windows 開發人員意見反應To request a feature, please head over to Windows Developer Feedback.