simplify requirements file (#76)

This commit is contained in:
Sebastian Raschka
2024-03-18 08:00:49 -05:00
committed by GitHub
parent 3e122fa656
commit 329d046b5d
6 changed files with 28 additions and 49 deletions

View File

@@ -2,18 +2,9 @@
This document provides more information on double-checking your installed Python version and packages. (Please see the [../01_optional-python-setup-preferences](../01_optional-python-setup-preferences) folder for more information on installing Python and Python packages.)
I used the following main libraries in this book. Newer versions of these libraries are likely compatible as well. However, if you experience any problems with the code, you can try these library versions as a fallback:
I used the following libraries listed [here](https://github.com/rasbt/LLMs-from-scratch/blob/main/requirements.txt) for this book. Newer versions of these libraries are likely compatible as well. However, if you experience any problems with the code, you can try these library versions as a fallback.
- numpy 1.24.3
- scipy 1.10.1
- pandas 2.0.2
- matplotlib 3.7.1
- jupyterlab 4.0
- watermark 2.4.2
- torch 2.0.1
- tiktoken 0.5.1
To install these requirements most conveniently, you can use the `requirements.txt` file:
To install these requirements most conveniently, you can use the `requirements.txt` file in the root directory for this code repository and execute the following command:
```
pip install -r requirements.txt
@@ -36,7 +27,6 @@ If you see the following issues, it's likely that your JupyterLab instance is co
<img src="figures/jupyter-issues.jpg" width="450px">
In this case, you may want to use `watermark` to check if you opened the JupyterLab instance in the right conda environment using the `--conda` flag:
<img src="figures/watermark.jpg" width="350px">

View File

@@ -10,15 +10,14 @@
"name": "stdout",
"output_type": "stream",
"text": [
"[OK] Your Python version is 3.11.4\n",
"[OK] numpy 1.25.2\n",
"[OK] scipy 1.11.1\n",
"[OK] pandas 2.0.3\n",
"[OK] matplotlib 3.7.2\n",
"[OK] jupyterlab 4.0.4\n",
"[OK] watermark 2.4.3\n",
"[OK] torch 2.0.1\n",
"[OK] tiktoken 0.5.1\n"
"[OK] Your Python version is 3.10.12\n",
"numpy >= 1.24.3 \n",
"matplotlib >= 3.7.1. \n",
"jupyterlab >= 4.0. \n",
"tensorflow >= 2.15.0 \n",
"torch >= 2.0.1 \n",
"tqdm >= 4.66.1 \n",
"tiktoken >= 0.5.1 \n"
]
}
],
@@ -28,14 +27,6 @@
"d = get_requirements_dict()\n",
"check_packages(d)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d5ca05fc-98e0-4bba-a95e-350e1764a12c",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
@@ -54,7 +45,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.4"
"version": "3.10.12"
}
},
"nbformat": 4,

View File

@@ -42,11 +42,18 @@ def get_packages(pkgs):
def get_requirements_dict():
PROJECT_ROOT = dirname(realpath(__file__))
REQUIREMENTS_FILE = join(PROJECT_ROOT, "requirements.txt")
PROJECT_ROOT_UP_TWO = dirname(dirname(PROJECT_ROOT))
REQUIREMENTS_FILE = join(PROJECT_ROOT_UP_TWO, "requirements.txt")
d = {}
with open(REQUIREMENTS_FILE) as f:
for line in f:
if not line.strip():
continue
line = line.split("#")[0]
print(line)
line = line.split(" ")
if not line[0].strip() or not line[-1].strip():
continue
d[line[0]] = line[-1]
return d

View File

@@ -1,8 +0,0 @@
numpy >= 1.24.3
scipy >= 1.10.1
pandas >= 2.0.2
matplotlib >= 3.7.1
jupyterlab >= 4.0
watermark >= 2.4.2
torch >= 2.0.1
tiktoken >= 0.5.1

View File

@@ -1,8 +1,7 @@
numpy >= 1.24.3
scipy >= 1.10.1
pandas >= 2.0.2
matplotlib >= 3.7.1
jupyterlab >= 4.0
watermark >= 2.4.2
torch >= 2.0.1
tiktoken >= 0.5.1
numpy >= 1.24.3 # ch05
matplotlib >= 3.7.1. # ch04, ch05
jupyterlab >= 4.0. # all
tensorflow >= 2.15.0 # ch05
torch >= 2.0.1 # all
tqdm >= 4.66.1 # ch05
tiktoken >= 0.5.1 # ch02, ch04, ch05