Instructions TD4
User Manual: Pdf
Open the PDF directly: View PDF .
Page Count: 2
Download | |
Open PDF In Browser | View PDF |
TD4 : Style Transfer This exercise has been designed to be run in a virtual environment , with a IPython Notebook (web page with embedded code). However, if you already have Python, PyTorch, Numpy and a preferred IDE, you can run the code in your own environment, go to page 2 for the details. 1 IPython setup To run this exercise, you will need to have Python 3.5/3.6 and Anaconda/Miniconda (package manager) installed on your computer. Once you have extracted the archive, get to the /code folder using the cd command. Run the following : conda create --name .env source activate .env pip install -r requirements.txt This should set up a virtual environment with the required packages, that you can delete after you are done with this exercise. Now run the following to launch the IPython notebook which will guide you : jupyter notebook You should now have a page of your web browser open showing the notebook with this exercise : StyleTransfer-PyTorch Click on it and follow the instructions. You will find blocks of text, with blocks of code in between, these are called cells. To run a cell, either click on it and select “Run Cells” in the “Cell” menu, or click on it and press Shift+Enter. You can run a cell as many times as you want, but you should run them in the order they are displayed when you open the notebook. When you have finished the notebook, close your browser, go to the terminal you used to launch the IPython environment, press “Ctrl” + “C” and type “y” to shutdown the server, and run the following to deactivate and delete the environment (you can also keep it if you want to go further). source deactivate conda remove --name .env --all 2 Using your own environment If you want to run this exercise on your own, you will have to install the dependencies found in the file requirements.txt in the /code folder. Make sure that the files in the /src folder are accessible by your project if you use an IDE. To run the code, open the PDF version of the notebook, StyleTransfer-PyTorch.pdf, and copy-paste the code from the cells in your Python script. A few precautions : • The “%matplotlib inline” function has to be removed (will throw an error). To see the images generated with matplotlib, you can either save them with command plt.savefig(‘name.png’) (will output an image in your working folder), or define an interactive backend with the command (replace backend with your canvas name, visit https://matplotlib.org/tutorials/introductory/usage.html#what-is-a-backend for more details, example ‘Qt5Agg’) : import matplotlib matplotlib.use(‘backend’) this command has to be executed before you import matplotlib.pyplot. If you go this way, don’t forget plt.show() to display. • The indentation will probably be impacted when you paste the code, make sure that it stays coherent. • You can write separate Python scripts to avoid running precedent exercises as you move forward, but be careful with the import lines and the utility functions that are used for all the exercises. 3 Submission For IPython users, simply save the StyleTransfer-PyTorch.ipynb in the Pédagogie→Travaux section of your Environnement Numérique de Travail. For the others, put all your scripts in an archive, and upload it to the Pédagogie→Travaux section of your Environnement Numérique de Travail.
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.4 Linearized : No Page Count : 2 Language : en-US Creator : Writer Producer : LibreOffice 5.1 Create Date : 2018:03:16 17:38:23+01:00EXIF Metadata provided by EXIF.tools