speedy-utils 1.1.45__tar.gz → 1.1.47__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- speedy_utils-1.1.47/.github/skills/dataset-processing-multiprocessing/CONFIG_REFERENCE.md +217 -0
- speedy_utils-1.1.47/.github/skills/dataset-processing-multiprocessing/SKILL.md +797 -0
- speedy_utils-1.1.47/.github/skills/dataset-processing-multiprocessing/example_tokenize_pack.py +323 -0
- speedy_utils-1.1.47/.github/skills/edit-llm-inference-style/SKILL.md +133 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/skills/multi-threading-processing/SKILL.md +38 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/PKG-INFO +1 -1
- speedy_utils-1.1.47/docs/SKILL.md +415 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/pyproject.toml +10 -1
- speedy_utils-1.1.47/scripts/bug.py +16 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/llm.py +41 -12
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/__init__.py +4 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/multi_worker/__init__.py +4 -0
- speedy_utils-1.1.47/src/speedy_utils/multi_worker/_multi_process.py +425 -0
- speedy_utils-1.1.47/src/speedy_utils/multi_worker/_multi_process_ray.py +308 -0
- speedy_utils-1.1.47/src/speedy_utils/multi_worker/common.py +879 -0
- speedy_utils-1.1.47/src/speedy_utils/multi_worker/dataset_sharding.py +203 -0
- speedy_utils-1.1.47/src/speedy_utils/multi_worker/process.py +128 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/multi_worker/progress.py +71 -1
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/multi_worker/thread.py +45 -0
- speedy_utils-1.1.47/src/speedy_utils/scripts/kill_mpython.py +58 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/scripts/mpython.py +63 -16
- speedy_utils-1.1.47/test.py +8 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/llm_utils/test_llm_mixins.py +13 -2
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/test_memoize_typing.py +9 -2
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/test_process.py +19 -15
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/test_process_update.py +5 -8
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/test_pytorch_sharing.py +9 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/test_shared_kwargs.py +11 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/test_thread.py +2 -3
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/test_tokenization.py +8 -1
- speedy_utils-1.1.45/scripts/bug.py +0 -12
- speedy_utils-1.1.45/src/speedy_utils/multi_worker/process.py +0 -1309
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.githooks/pre-push +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/copilot-instructions.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/prompts/improveParallelErrorHandling.prompt.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/skills/caching-utilities/SKILL.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/skills/caching-utilities/examples/caching_example.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/skills/io-utilities/SKILL.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/skills/io-utilities/examples/io_example.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/skills/llm-integration/SKILL.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/skills/llm-integration/examples/llm_example.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/skills/ray-distributed-computing/SKILL.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/skills/skill-creation/SKILL.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/skills/vision-utilities/SKILL.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/skills/vision-utilities/examples/vision_example.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.github/workflows/publish.yml +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.gitignore +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/.pre-commit-config.yaml +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/AGENTS.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/README.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/bumpversion.sh +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/debug/debug_generate_response.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/debug/debug_n_param.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/debug/debug_n_structure.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/debug/integration_test.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/debug/test_decode_api.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/debug/test_endpoints.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/debug/test_generate.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/debug/test_generate_endpoint.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/docs/GENERATE_QUICKREF.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/docs/IMPLEMENTATION.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/docs/QUICKSTART.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/docs/TOKENIZATION.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/docs/TOKENIZATION_IMPLEMENTATION.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/docs/zero_copy_sharing.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/examples/generate_example.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/examples/llm_ray_example.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/examples/pytorch_large_model.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/examples/shared_kwargs_example.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/examples/temperature_range_example.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/examples/test_parallel_gpu.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/examples/test_share_ray.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/examples/tokenization_example.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/examples/vision_utils_example.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/experiments/exp1/dockerfile +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/experiments/exp1/run_in_docker.sh +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/experiments/exp1/test.png +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/experiments/test_read_image.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/notebooks/README.ipynb +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/notebooks/llm_utils/llm_as_a_judge.ipynb +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/notebooks/parallel_gpu_pool.ipynb +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/notebooks/ray_tutorial.ipynb +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/notebooks/test_multi_thread.ipynb +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/ruff.toml +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/scripts/bug_simple.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/scripts/debug_import_time.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/scripts/deploy.sh +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/scripts/imports.sh +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/scripts/test.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/scripts/test_both_backends.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/scripts/test_error_handling.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/scripts/test_import_time_vision.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/scripts/test_locals.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/scripts/test_ray_locals.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/scripts/test_ray_mp.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/setup.cfg +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/datasets_utils/convert_to_arrow.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/__init__.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/chat_format/__init__.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/chat_format/display.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/chat_format/transform.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/chat_format/utils.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/group_messages.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/llm_ray.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/__init__.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/async_lm/__init__.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/async_lm/_utils.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/async_lm/async_llm_task.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/async_lm/async_lm.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/async_lm/async_lm_base.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/async_lm/lm_specific.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/base_prompt_builder.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/llm_signature.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/lm_base.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/mixins.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/openai_memoize.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/signature.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/lm/utils.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/scripts/README.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/scripts/fast_vllm.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/scripts/vllm_load_balancer.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/scripts/vllm_serve.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/vector_cache/__init__.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/vector_cache/cli.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/vector_cache/core.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/vector_cache/types.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/llm_utils/vector_cache/utils.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/__imports.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/common/__init__.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/common/clock.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/common/function_decorator.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/common/logger.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/common/notebook_utils.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/common/patcher.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/common/report_manager.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/common/utils_cache.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/common/utils_error.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/common/utils_io.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/common/utils_misc.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/common/utils_print.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/multi_worker/dataset_ray.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/multi_worker/parallel_gpu_pool.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/scripts/__init__.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/speedy_utils/scripts/openapi_client_codegen.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/vision_utils/README.md +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/vision_utils/__init__.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/vision_utils/io_utils.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/src/vision_utils/plot.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/import_all.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/import_time_report.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/integration_test.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/sample_objects.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/test.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/test_logger.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/test_logger_format.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/test_mpython.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/tests/test_multithread_error_trace.py +0 -0
- {speedy_utils-1.1.45 → speedy_utils-1.1.47}/uv.lock +0 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Dataset Processing Configuration Reference
|
|
2
|
+
|
|
3
|
+
This document provides configuration templates for common dataset processing scenarios.
|
|
4
|
+
|
|
5
|
+
## Configuration 1: Standard Tokenization (GPT2 Tokenizer)
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
python example_tokenize_pack.py \
|
|
9
|
+
--src /path/to/raw/dataset \
|
|
10
|
+
--dst /path/to/tokenized/dataset \
|
|
11
|
+
--tokenizer gpt2 \
|
|
12
|
+
--seq_len 2048 \
|
|
13
|
+
--workers 4 \
|
|
14
|
+
--backend mp
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Use for:** Simple text tokenization for LLM fine-tuning
|
|
18
|
+
|
|
19
|
+
**Key parameters:**
|
|
20
|
+
- `seq_len=2048`: Standard context length
|
|
21
|
+
- `workers=4`: Adjust based on CPU cores
|
|
22
|
+
- `backend=mp`: Multiprocessing for CPU-bound work
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Configuration 2: Large-Scale Dataset (Ray Distributed)
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
python example_tokenize_pack.py \
|
|
30
|
+
--src /path/to/huge/dataset \
|
|
31
|
+
--dst /path/to/output/dataset \
|
|
32
|
+
--tokenizer meta-llama/Llama-2-7b-hf \
|
|
33
|
+
--seq_len 4096 \
|
|
34
|
+
--workers 16 \
|
|
35
|
+
--backend ray
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Use for:** 10M+ row datasets across multiple machines with Ray
|
|
39
|
+
|
|
40
|
+
**Key parameters:**
|
|
41
|
+
- `seq_len=4096`: Larger context for modern models
|
|
42
|
+
- `workers=16`: Can exceed local CPU count with Ray
|
|
43
|
+
- `backend=ray`: Distributed computing across cluster
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Configuration 3: Debug Mode (Small Test Run)
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
python example_tokenize_pack.py \
|
|
51
|
+
--src /path/to/dataset \
|
|
52
|
+
--dst /path/to/output/test \
|
|
53
|
+
--tokenizer gpt2 \
|
|
54
|
+
--seq_len 2048 \
|
|
55
|
+
--workers 1 \
|
|
56
|
+
--debug
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Use for:** Testing the pipeline before full run
|
|
60
|
+
|
|
61
|
+
**Key parameters:**
|
|
62
|
+
- `--debug`: Process only first 1000 rows
|
|
63
|
+
- `workers=1`: Single worker for easier debugging
|
|
64
|
+
- No output size limit for validation
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Configuration 4: Memory-Constrained Environment
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
python example_tokenize_pack.py \
|
|
72
|
+
--src /path/to/dataset \
|
|
73
|
+
--dst /path/to/output \
|
|
74
|
+
--tokenizer gpt2 \
|
|
75
|
+
--seq_len 512 \
|
|
76
|
+
--workers 2 \
|
|
77
|
+
--backend mp
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Use for:** Machines with limited RAM
|
|
81
|
+
|
|
82
|
+
**Key parameters:**
|
|
83
|
+
- `seq_len=512`: Smaller sequences use less memory per worker
|
|
84
|
+
- `workers=2`: Fewer workers = less memory overhead
|
|
85
|
+
- Each worker uses ~1-2GB typically
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Configuration 5: Fast Processing (High Throughput)
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
python example_tokenize_pack.py \
|
|
93
|
+
--src /path/to/dataset \
|
|
94
|
+
--dst /path/to/output \
|
|
95
|
+
--tokenizer gpt2 \
|
|
96
|
+
--seq_len 2048 \
|
|
97
|
+
--workers $(nproc) \
|
|
98
|
+
--backend mp
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Use for:** Maximum throughput, CPU cores fully saturated
|
|
102
|
+
|
|
103
|
+
**Key parameters:**
|
|
104
|
+
- `workers=$(nproc)`: Match exact CPU count
|
|
105
|
+
- `backend=mp`: Multiprocessing for CPU optimization
|
|
106
|
+
- Expect 1000-10000 sequences/sec depending on tokenizer
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Worker Count Guidelines
|
|
111
|
+
|
|
112
|
+
| Scenario | Workers | Backend |
|
|
113
|
+
|----------|---------|---------|
|
|
114
|
+
| **Laptop (4 cores)** | 2-3 | mp |
|
|
115
|
+
| **Workstation (16 cores)** | 12-15 | mp |
|
|
116
|
+
| **Server (32 cores)** | 28-31 | mp |
|
|
117
|
+
| **Large cluster** | 100+ | ray |
|
|
118
|
+
|
|
119
|
+
**Rule of thumb:** `workers = cpu_count - 1` for good performance
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Sequence Length Recommendations
|
|
124
|
+
|
|
125
|
+
| Use Case | Seq Length | Memory/Worker |
|
|
126
|
+
|----------|------------|---------------|
|
|
127
|
+
| **Short text (summaries)** | 512 | ~400MB |
|
|
128
|
+
| **Medium text (articles)** | 2048 | ~800MB |
|
|
129
|
+
| **Long context (code)** | 4096 | ~1.5GB |
|
|
130
|
+
| **Very long (books)** | 8192 | ~3GB |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Performance Tuning
|
|
135
|
+
|
|
136
|
+
### If you run out of memory:
|
|
137
|
+
1. Reduce `seq_len` by 50%
|
|
138
|
+
2. Reduce `workers` by 50%
|
|
139
|
+
3. Add swap space (fallback, slower)
|
|
140
|
+
|
|
141
|
+
### If processing is too slow:
|
|
142
|
+
1. Increase `workers` (up to CPU count)
|
|
143
|
+
2. Check if I/O is bottleneck (`--debug` for quick check)
|
|
144
|
+
3. Use `--backend ray` for distributed processing
|
|
145
|
+
|
|
146
|
+
### If some shards fail:
|
|
147
|
+
1. Check temp directory for partial files
|
|
148
|
+
2. Reduce `workers` (less memory pressure)
|
|
149
|
+
3. Add error logging (already implemented)
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Platform-Specific Notes
|
|
154
|
+
|
|
155
|
+
### Linux/Mac
|
|
156
|
+
```bash
|
|
157
|
+
# Full parallelism
|
|
158
|
+
--workers $(nproc) --backend mp
|
|
159
|
+
|
|
160
|
+
# With Ray cluster
|
|
161
|
+
--workers 64 --backend ray
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Windows
|
|
165
|
+
```bash
|
|
166
|
+
# Use fewer workers (GIL limitations)
|
|
167
|
+
--workers 2-4 --backend mp
|
|
168
|
+
|
|
169
|
+
# Consider WSL2 + Linux for better parallelism
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Docker/Container
|
|
173
|
+
```bash
|
|
174
|
+
# Respect container limits
|
|
175
|
+
--workers 2-4 # Even if host has more cores
|
|
176
|
+
|
|
177
|
+
# Set memory limits safely
|
|
178
|
+
--seq_len 1024 # Conservative
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## Monitoring Metrics
|
|
184
|
+
|
|
185
|
+
Track these during processing:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
Time per shard: <time_per_shard>
|
|
189
|
+
Tokens/second: len(output) * seq_len / total_time
|
|
190
|
+
Memory/worker: Watch via `top` or Docker stats
|
|
191
|
+
Failed shards: Count of None results
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Healthy run:**
|
|
195
|
+
- ✅ Tokens/sec > 1000
|
|
196
|
+
- ✅ Memory < 80% of available
|
|
197
|
+
- ✅ Failed shards = 0
|
|
198
|
+
- ✅ Total time = dataset_size / throughput
|
|
199
|
+
|
|
200
|
+
**Concerning run:**
|
|
201
|
+
- ⚠️ Tokens/sec < 100
|
|
202
|
+
- ⚠️ Memory > 90%
|
|
203
|
+
- ⚠️ Failed shards > 0
|
|
204
|
+
- ⚠️ Very uneven shard times
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Common Errors & Fixes
|
|
209
|
+
|
|
210
|
+
| Error | Cause | Fix |
|
|
211
|
+
|-------|-------|-----|
|
|
212
|
+
| `OOM Killed` | Too large seq_len or workers | Reduce both by 50% |
|
|
213
|
+
| `Pickle error` | Large object in args | Pass paths, not objects |
|
|
214
|
+
| `Timeout` | Shard too large | Increase workers or reduce seq_len |
|
|
215
|
+
| `Permission denied` | Temp directory | Use `sudo rm -rf ...` or `--debug` |
|
|
216
|
+
| `Empty result` | All examples filtered | Check transform logic |
|
|
217
|
+
|