Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix: conda README references non-existent requirements_base.txt #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
Fix: conda README references non-existent requirements_base.txt #108
Changes from all commits
e574bcaFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Local Environment with Conda
Our preferred method for running the code locally is through a version-controlled environment with Conda.
1. Installing Miniconda
To setup a conda environment that contains both Python and all the necessary dependencies, we advise you to use a minimal version of conda, aptly named miniconda.
Here, based on your operating system, we choose an installer that has python 3.10 pre-installed. To illustrate, we would install the following on Windows:
and the following on Linux:
2. Setting up a Conda Environment
After installation, you will need to open up your terminal and create your environment as follows:
We will need to activate the environment first before we can use it:
2. Installing Dependencies
After creating our environment, we will need to install all the dependencies. If you created your environment using the
environment.ymlfile, you can skip over this.There are two methods that you can follow to install the dependencies:
requirements.txtwhich requires Microsoft Visual C++ 14.0requirements_base.txtrequirements_min.txtwhich requires specific installations in certain chaptersThe first method, is to directly install all dependencies (aside from Chapter 11) using the
requirements.txtby running the following from the root of this repository:This should install all necessary dependencies in the environment we just created.
Tip
If pip install -r requirements.txt is throwing an error, run this which will resolve the error
Tip
The
requirements.txtfile pins versions of dependencies for reproducibility. However, this might mean you are missing out on new features of many of the packages. You can also userequirements_min.txtinstead that will install all the latest versions. Do note that this might break certain examples as the API of these packages can change over time.Warning
If you get the following error
error: Microsoft Visual C++ 14.0 or greater is required.then you will need to install C++. Follow the instructions here for an installation guide before you can install your environment.[OPTIONAL] Installing dependencies with conda
If you run into issues with the
requirements.txtfile, you can also install a base set of dependencies that are installed throughout the book:The missing dependencies can be installed by following the instructions in the README in each chapter's folder. Or you can install them all at once:
This allows you to have more flexibility over supported packages and some that might go out of support at some point.
3. Installing PyTorch
Now that we have installed all necessary dependencies, you might want to update one specific dependency, namely PyTorch. Depending on your system, PyTorch might install a CPU-based version and for most of the example, we will need to make use of the GPU.
If you go to the official PyTorch website, then you'll find on the frontpage the current guideline for installing the package:
There, you can choose which CUDA version you need (it is typically advised to choose the default). Copy the lines for pip installation and run them in your terminal:
Note that wes added the
--upgradetag here to make sure the CPU-version of PyTorch is overwritten with the GPU-version.4. Starting Jupyter Lab
After having installed all necessary packages, you can then use Jupyter Lab (or any other notebook backend) to run all of the notebooks associated with each chapter. You can start Jupyter Lab directly from the terminal:
When you start running each notebook, make sure to check whether you have selected the correct environment. You can do so by selecting the "ipykernel" on the top right:
You will then see a screen that allows you to select the "thellmbook" environment from the list:
To validate whether this worked, you can check if the selected environment has access to a GPU:
or by checking the name of the current conda environment: