Skip to main content

kohakugbc-data

The data side of KohakuGBC (Graph-Based Captioning), without the captioning machine: GBC graphs (store, resolution, prompt rendering) and the GBC dataset format. Depends on numpy, pillow, pyarrow and kohakuvault only; one wheel per platform for CPython 3.11+.

pip install kohakugbc-data

Graphs

from kohakugbc_data import GbcGraph

g = GbcGraph.from_json(line)  # one GBC graph (ml-gbc JSON), or from_msgpack
blob = g.to_msgpack()  # typed msgpack + zstd: ~7.6x smaller than JSON
g = GbcGraph.from_msgpack(blob)
text = g.prompt(width=1024, height=1024)  # the GBC prompt text (boxes in MOSS layout space)

GbcGraph.prompt / prompt_dag render natively; kohakugbc_data.prompt holds the Python renderers (from_gbc, render, parse, to_moss for the MOSS-Image layout draft, detail levels in kohakugbc_data.prompt.detail), equal to the native ones.

Datasets

A GBC dataset: images, graphs and a metadata dict per image, joined by a sample key, in self-contained shards.

<root>/dataset.json             format, version, the shard list, the dataset header
<root>/shards/shard_XXXXX/
    images.zip                  KohakuClip image shard: stored zip + __index__.bin
    graphs.db                   KohakuVault "graphs": key -> GbcGraph msgpack (zstd)
    meta.db                     KohakuVault "meta": key -> dict (any content)
    manifest.parquet            key, index, w, h, codec, sizes, extra columns
from kohakugbc_data.dataset import DatasetWriter, GbcDataset, read_info, split

ds = GbcDataset(root, image="pil")  # or "bytes" / None; graphs=, meta=, shards=
s = ds[0]  # or ds["<key>"]: key, w, h, codec, image, graph, meta
ds = GbcDataset(root, transform=lambda s: (s.image, s.graph.prompt(width=s.w, height=s.h)))

with DatasetWriter(out, shard_bytes=4 << 30, header={"name": "my-set"}) as w:
    w.add(key, image_bytes, width, height, "webp", graph_line, {"tags": tags})

images.zip is byte-identical to what KohakuClip writes for the same images, so kohakuclip.ImageReader reads it directly. Shards close at shard_bytes and / or per_shard; distributed jobs take whole shards (split(names, rank, world)). The full format: docs/guides/dataset.md.

License

Apache-2.0.

Metadata

Release files for kohakugbc-data 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kohakugbc-data 0.2.0
File Size Uploaded Provenance Actions
kohakugbc_data-0.2.0.tar.gz 49.8 kB With provenance Details for kohakugbc_data-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for kohakugbc-data 0.2.0
File Actions
kohakugbc_data-0.2.0-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for kohakugbc_data-0.2.0-cp311-abi3-win_amd64.whl
kohakugbc_data-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.28+ x86-64 Details for kohakugbc_data-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl
kohakugbc_data-0.2.0-cp311-abi3-manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64 Details for kohakugbc_data-0.2.0-cp311-abi3-manylinux_2_28_aarch64.whl
kohakugbc_data-0.2.0-cp311-abi3-macosx_11_0_arm64.whl CPython 3.11 abi3 macOS 11.0+ ARM64 Details for kohakugbc_data-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
kohakugbc_data-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl CPython 3.11 abi3 macOS 10.12+ x86-64 Details for kohakugbc_data-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl

Total release size: 7.4 MB

Release files / kohakugbc_data-0.2.0.tar.gz

Download URL kohakugbc_data-0.2.0.tar.gz
Size 49.8 kB
Tags Source
SHA-256 checksum
How to use checksums
14bc011d1720260ba3f04222f1c8717805f225bcd94fbf19267abd43d12534fc
BLAKE2b-256 checksum
How to use checksums
e1c04d02d1f8c1d657be7b98d201ed4959fcec2c859458854bf4fbf4eb946526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / kohakugbc_data-0.2.0-cp311-abi3-win_amd64.whl

Download URL kohakugbc_data-0.2.0-cp311-abi3-win_amd64.whl
Size 1.3 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
2951be2e2b63a5f2ad1d6e909b9e075ad05c188a0bf012fe1e3f2a87cc4ac618
BLAKE2b-256 checksum
How to use checksums
ac1e5cd3b4fda18c23e40722e997e061906435e9ebdcd0df6b92893797c82dd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / kohakugbc_data-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl

Download URL kohakugbc_data-0.2.0-cp311-abi3-manylinux_2_28_x86_64.whl
Size 1.6 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
6bd307c7f386baa5e2901a4a2f605647baa1a914fb228da23021eeb64f57858c
BLAKE2b-256 checksum
How to use checksums
7e8ef8005c3b097ea15804630130299491b8d64dadc68ccc7d009e3499db376d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / kohakugbc_data-0.2.0-cp311-abi3-manylinux_2_28_aarch64.whl

Download URL kohakugbc_data-0.2.0-cp311-abi3-manylinux_2_28_aarch64.whl
Size 1.5 MB
Tags CPython 3.11 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
7272da93974b01df0854e89b672f44bb01c0e8c1e0b1f33614b71d880804d977
BLAKE2b-256 checksum
How to use checksums
2ab88913cd9aa01dba75f10b4f622c2ad7e9a5c997933569ad5f53f6353582f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / kohakugbc_data-0.2.0-cp311-abi3-macosx_11_0_arm64.whl

Download URL kohakugbc_data-0.2.0-cp311-abi3-macosx_11_0_arm64.whl
Size 1.3 MB
Tags CPython 3.11 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2b56ffc8b57ea4e84c247cd5b9e03587911b0ae4d15d019ee05ba3b138e52156
BLAKE2b-256 checksum
How to use checksums
096d585bf603d2745cf9c85ea57d4f5807dca86a0d8dbe865a827914ab4fc937
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Release files / kohakugbc_data-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl

Download URL kohakugbc_data-0.2.0-cp311-abi3-macosx_10_12_x86_64.whl
Size 1.5 MB
Tags CPython 3.11 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
2d6681c7669480ce694f6415f8294ef7394afd5b47f975d771da98c06c6cbb6f
BLAKE2b-256 checksum
How to use checksums
51e4c7d8f4b3ac1542e96977bc5fd07795e91a4312489d7c3ae715848db51c81
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

Security for kohakugbc-data 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for kohakugbc_data-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page