|
Download stackgo/stackbuild/README.md from s0duku/the-stack-go: direct link, hf CLI and curl.
- Browser
- Download file 3.56 kB
-
https://huggingface.co/datasets/s0duku/the-stack-go/resolve/main/stackgo/stackbuild/README.md
- Command line
-
hf download hf://datasets/s0duku/the-stack-go/stackgo/stackbuild/README.md
-
curl -L -o README.md https://huggingface.co/datasets/s0duku/the-stack-go/resolve/main/stackgo/stackbuild/README.md
3.56 kB
| # stackbuild | |
| `stackbuild` is the single repository-context data tool. It scans an immutable | |
| `Repo` snapshot, builds its dependency graph, and emits budgeted pretraining | |
| samples. The same package exposes the repository models and scanner; importing | |
| ```python | |
| from stackbuild import BuildConfig, Repo, RepoFile, build_samples, write_parquet | |
| repo = Repo("owner/project", "revision", ( | |
| RepoFile("lib.py", "VALUE = 1\n", "Python"), | |
| RepoFile("main.py", "import lib\nprint(lib.VALUE)\n", "Python"), | |
| )) | |
| samples = build_samples( | |
| repo, | |
| config=BuildConfig(max_tokens=8_192), | |
| ) | |
| write_parquet(samples, "samples.parquet") | |
| ``` | |
| By default one sample kind is emitted: | |
| - `dependency`: hard-dependency components in dependency-first order. Files with | |
| no hard edges are packed together under the same repository boundary. | |
| For an additional target-oriented view, enable bounded deterministic target | |
| sampling: | |
| ```python | |
| config = BuildConfig( | |
| max_tokens=8_192, | |
| target_context=True, | |
| max_targets_per_repo=32, | |
| max_dependency_depth=3, | |
| ) | |
| ``` | |
| This adds `target_context` samples for a stable hash-ranked uniform sample of | |
| eligible source files; target selection is not ranked by reference count. | |
| Resolved dependencies are selected nearest-first and rendered dependency-first, | |
| then small local or root documentation/build context is added when budget | |
| allows. The target is last. Target-only samples are skipped because they add no | |
| context beyond the default repository samples. Metadata distinguishes target, | |
| dependency, and repository-context files. | |
| Each sample uses the six native DeepSeek V4 repository/file boundary tokens: | |
| ```text | |
| <|begin▁of▁repo▁name|>owner/project<|end▁of▁repo▁name|> | |
| <|begin▁of▁file▁name|>lib.py<|end▁of▁file▁name|> | |
| <|begin▁of▁file|> | |
| VALUE = 1 | |
| <|end▁of▁file|> | |
| <|begin▁of▁file▁name|>main.py<|end▁of▁file▁name|> | |
| <|begin▁of▁file|> | |
| import lib | |
| print(lib.VALUE) | |
| <|end▁of▁file|> | |
| ``` | |
| The default tokenizer is pinned to `deepseek-ai/DeepSeek-V4-Flash-Base`, revision | |
| `8855555deef230a27a21a8d6f294b7b7497759b6`. These tokens already have IDs | |
| 128815–128820. No vocabulary extension is required. The local directory | |
| `the-stack-go/tokenizers/deepseek-v4-flash-base` is preferred; an explicit | |
| tokenizer can also be supplied through the API or CLI. | |
| `revision_id`, language, dependency, role, and content-policy information stay | |
| in the structured `Sample` metadata rather than the model text. No literal EOS | |
| marker is written into `Sample.text`; the training collator should append the | |
| model's existing EOS token after tokenization. | |
| Jupyter notebooks are converted into ordered text, code, and output cells. | |
| Binary files and, by default, generated/vendor files are represented by file | |
| metadata without raw content. Every input path is represented by the dependency | |
| sample set, including metadata-only files. | |
| When `tokenizer` is omitted, the pinned tokenizer is loaded and cached. Token | |
| counts are exact encodings of the complete sample with `add_special_tokens=False`. | |
| The 8192 budget applies to `Sample.text`; any BOS/EOS appended by training must | |
| be budgeted separately. Parquet stores nested `files` and `metadata_json` along | |
| with text and token counts, using ZSTD compression and 2048-row groups. | |
| The `stackbuild` CLI performs the same end-to-end operation for a checkout: | |
| ```bash | |
| stackbuild ./repository samples.parquet --info-output repository-info.json | |
| ``` | |
| Use `stackbuild-info` when only the dependency metadata JSON is needed. | |