Skip to content

Commit 9ccdbea

Browse files
committed
Fix: ValueError: filedescriptor out of range in select()
1 parent 4bcee99 commit 9ccdbea

3 files changed

Lines changed: 12 additions & 33 deletions

File tree

src/MaxText/examples/rl_llama3_demo.ipynb

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@
144144
"source": [
145145
"import datetime\n",
146146
"import os\n",
147-
"import sys\n",
148-
"from pathlib import Path\n",
147+
"import subprocess\n",
149148
"import MaxText\n",
150149
"from huggingface_hub import login\n",
151150
"import jax\n",
@@ -244,16 +243,9 @@
244243
"source": [
245244
"if not os.path.exists(MODEL_CHECKPOINT_PATH):\n",
246245
" # install torch for the conversion script\n",
247-
" !python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu\n",
248-
"\n",
249-
" !JAX_PLATFORMS=cpu PYTHONPATH={MAXTEXT_REPO_ROOT} {sys.executable} -m MaxText.utils.ckpt_conversion.to_maxtext \\\n",
250-
" {MAXTEXT_REPO_ROOT}/configs/base.yml \\\n",
251-
" model_name={MODEL_NAME} \\\n",
252-
" base_output_directory={MODEL_CHECKPOINT_PATH} \\\n",
253-
" hf_access_token={HF_TOKEN} \\\n",
254-
" use_multimodal=false \\\n",
255-
" scan_layers=true \\\n",
256-
" skip_jax_distributed_system=True\n",
246+
" subprocess.run('uv pip install torch --index-url https://download.pytorch.org/whl/cpu', shell=True, check=True)\n",
247+
"\n",
248+
" subprocess.run(f'JAX_PLATFORMS=cpu PYTHONPATH={MAXTEXT_REPO_ROOT} {sys.executable} -m MaxText.utils.ckpt_conversion.to_maxtext {MAXTEXT_REPO_ROOT}/configs/base.yml model_name={MODEL_NAME} base_output_directory={MODEL_CHECKPOINT_PATH} hf_access_token={HF_TOKEN} use_multimodal=false scan_layers=true skip_jax_distributed_system=True', shell=True, check=True)\n",
257249
"\n",
258250
"if not os.path.exists(MODEL_CHECKPOINT_PATH):\n",
259251
" raise ValueError(\"Model checkpoint conversion failed. Check the logs above.\")"

src/MaxText/examples/sft_llama3_demo.ipynb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@
173173
"cell_type": "code",
174174
"execution_count": null,
175175
"metadata": {},
176+
"outputs": [],
176177
"source": [
177178
"if IN_COLAB:\n",
178179
" HF_TOKEN = userdata.get(\"HF_TOKEN\")\n",
@@ -234,16 +235,9 @@
234235
"source": [
235236
"if not os.path.exists(MODEL_CHECKPOINT_PATH):\n",
236237
" # install torch for the conversion script\n",
237-
" !python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu\n",
238-
"\n",
239-
" !JAX_PLATFORMS=cpu PYTHONPATH={MAXTEXT_REPO_ROOT} {sys.executable} -m MaxText.utils.ckpt_conversion.to_maxtext \\\n",
240-
" {MAXTEXT_REPO_ROOT}/configs/base.yml \\\n",
241-
" model_name={MODEL_NAME} \\\n",
242-
" base_output_directory={MODEL_CHECKPOINT_PATH} \\\n",
243-
" hf_access_token={HF_TOKEN} \\\n",
244-
" use_multimodal=false \\\n",
245-
" scan_layers=true \\\n",
246-
" skip_jax_distributed_system=True\n",
238+
" subprocess.run('uv pip install torch --index-url https://download.pytorch.org/whl/cpu', shell=True, check=True)\n",
239+
"\n",
240+
" subprocess.run(f'JAX_PLATFORMS=cpu PYTHONPATH={MAXTEXT_REPO_ROOT} {sys.executable} -m MaxText.utils.ckpt_conversion.to_maxtext {MAXTEXT_REPO_ROOT}/configs/base.yml model_name={MODEL_NAME} base_output_directory={MODEL_CHECKPOINT_PATH} hf_access_token={HF_TOKEN} use_multimodal=false scan_layers=true skip_jax_distributed_system=True', shell=True, check=True)\n",
247241
"\n",
248242
"if not os.path.exists(MODEL_CHECKPOINT_PATH):\n",
249243
" raise ValueError(\"Model checkpoint conversion failed. Check the logs above.\")"

src/MaxText/examples/sft_qwen3_demo.ipynb

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,10 @@
195195
"import jax\n",
196196
"import os\n",
197197
"import sys\n",
198+
"import subprocess\n",
198199
"import transformers\n",
199200
"\n",
200201
"import MaxText\n",
201-
"from MaxText import pyconfig\n",
202202
"from MaxText.examples.sft_train_and_evaluate import evaluate_model, get_test_dataset\n",
203203
"from MaxText.integration.tunix.tunix_adapter import TunixMaxTextAdapter\n",
204204
"from MaxText.sft import sft_trainer\n",
@@ -312,16 +312,9 @@
312312
"source": [
313313
"if not os.path.exists(MODEL_CHECKPOINT_PATH):\n",
314314
" # install torch for the conversion script\n",
315-
" !python3 -m pip install torch --index-url https://download.pytorch.org/whl/cpu\n",
316-
"\n",
317-
" !JAX_PLATFORMS=cpu PYTHONPATH={MAXTEXT_REPO_ROOT} {sys.executable} -m MaxText.utils.ckpt_conversion.to_maxtext \\\n",
318-
" {MAXTEXT_REPO_ROOT}/configs/base.yml \\\n",
319-
" model_name={MODEL_NAME} \\\n",
320-
" base_output_directory={MODEL_CHECKPOINT_PATH} \\\n",
321-
" hf_access_token={HF_TOKEN} \\\n",
322-
" use_multimodal=false \\\n",
323-
" scan_layers=true \\\n",
324-
" skip_jax_distributed_system=True\n",
315+
" subprocess.run('uv pip install torch --index-url https://download.pytorch.org/whl/cpu', shell=True, check=True)\n",
316+
"\n",
317+
" subprocess.run(f'JAX_PLATFORMS=cpu PYTHONPATH={MAXTEXT_REPO_ROOT} {sys.executable} -m MaxText.utils.ckpt_conversion.to_maxtext {MAXTEXT_REPO_ROOT}/configs/base.yml model_name={MODEL_NAME} base_output_directory={MODEL_CHECKPOINT_PATH} hf_access_token={HF_TOKEN} use_multimodal=false scan_layers=true skip_jax_distributed_system=True', shell=True, check=True)\n",
325318
"\n",
326319
"if not os.path.exists(MODEL_CHECKPOINT_PATH):\n",
327320
" raise ValueError(\"Model checkpoint conversion failed. Check the logs above.\")"

0 commit comments

Comments
 (0)