PyTorch Models and Git in MATLAB Online

Create and Clone GitHub Repository
We first created a new GitHub repository with a README file. We cloned this repository in MATLAB Online, which copied all the files from the repository to a folder in our working directory.

Import Model from PyTorch in MATLAB Online
Starting in MATLAB R2023b, you can import models from PyTorch in MATLAB Online. To show this functionality, we reused the code from the doc example Import Network from PyTorch and Classify Image. Once we confirmed that the code runs as expected (that is, the PyTorch model is successfully imported and the test image is correctly classified), in three quick steps we uploaded the code to our GitHub repository.- We added the live script to Source Control.
- We committed the script.
- We pushed the script to the GitHub repository.


Add MATLAB Online Button to Repository
Finally, we added an “Open in MATLAB Online” button to our GitHub repository. By clicking on the button, the GitHub repository opens directly in MATLAB Online (independently from the Git-tracked folder that we previously created). This makes it easy to share your code with your team or community. To learn more, see Open in MATLAB Online from GitHub.
Comments
To leave a comment, please click here to sign in to your MathWorks Account or create a new one.