Skip to content

Commit 72443fc

Browse files
authored
Merge pull request #5 from HaroldLeo/fix-local-notebook-setup
Improve local notebook setup instructions
2 parents 7df3cd4 + 52bc267 commit 72443fc

3 files changed

Lines changed: 49 additions & 2 deletions

File tree

README-CN.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,32 @@ Modern LLM Notebook 选择中间路线:把现代 LLM 当成一个可以拆解
136136
```bash
137137
git clone https://github.com/walkinglabs/modern-llm-notebook.git
138138
cd modern-llm-notebook
139-
pip install -r requirements.txt
139+
140+
# 创建独立 Python 环境,避免把依赖直接装进系统 Python。
141+
python3 -m venv .venv
142+
source .venv/bin/activate
143+
144+
python -m pip install --upgrade pip
145+
python -m pip install -r requirements.txt
146+
python -m ipykernel install --user \
147+
--name modern-llm-notebook \
148+
--display-name "Python (modern-llm-notebook)"
149+
140150
jupyter notebook notebooks/part1-foundation/01-tokenizer-basics.ipynb
141151
```
142152

153+
如果出现 `jupyter: command not found`,通常是因为还没有激活虚拟环境。先运行:
154+
155+
```bash
156+
source .venv/bin/activate
157+
```
158+
159+
也可以直接调用虚拟环境里的 Jupyter:
160+
161+
```bash
162+
.venv/bin/jupyter notebook notebooks/part1-foundation/01-tokenizer-basics.ipynb
163+
```
164+
143165
语言说明:
144166

145167
- 中文版 Notebook:`notebooks/`

README.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,32 @@ comparison or utility work, but the teaching path keeps the core algorithms expl
166166
```bash
167167
git clone https://github.com/walkinglabs/modern-llm-notebook.git
168168
cd modern-llm-notebook
169-
pip install -r requirements.txt
169+
170+
# Create an isolated Python environment instead of installing into the system Python.
171+
python3 -m venv .venv
172+
source .venv/bin/activate
173+
174+
python -m pip install --upgrade pip
175+
python -m pip install -r requirements.txt
176+
python -m ipykernel install --user \
177+
--name modern-llm-notebook \
178+
--display-name "Python (modern-llm-notebook)"
179+
170180
jupyter notebook notebooks-en/part1-foundation/01-tokenizer-basics.ipynb
171181
```
172182

183+
If `jupyter: command not found` appears, the virtual environment is probably not active. Run:
184+
185+
```bash
186+
source .venv/bin/activate
187+
```
188+
189+
Or call Jupyter directly from the environment:
190+
191+
```bash
192+
.venv/bin/jupyter notebook notebooks-en/part1-foundation/01-tokenizer-basics.ipynb
193+
```
194+
173195
Language note:
174196

175197
- Chinese notebooks live in `notebooks/`

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ transformers>=4.30.0
99
datasets>=2.12.0
1010
accelerate>=0.20.0
1111
modelscope>=1.9.0
12+
tiktoken>=0.5.0
13+
jupyter>=1.0.0
14+
ipykernel>=6.0.0

0 commit comments

Comments
 (0)