Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/bump_strata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
# upstream publishes with its releases. Upstream versions each platform on its
# own and does not attach every package to every release, so the Makefile pins
# every package separately: its release tag, its version and its SHA-256. There
# are two families of packages: the engine (strata-engine-...) and the Hy4-Flash
# engine (strata-hy4-...), each with its own pins. This
# are three families of packages: the engine (strata-engine-...), the Hy4-Flash
# engine (strata-hy4-...) and the Inkling engine (strata-inkling-...), each with
# its own pins. This
# script moves those pins, plus STRATA_VERSION and STRATA_COMMIT (the newest
# release and its commit; the Python modules come from it). bump_deps.sh only
# handles one commit variable, hence this script.
Expand Down Expand Up @@ -56,7 +57,7 @@ if not releases:
sys.exit("Refusing to bump: no release found")

text = open(makefile).read()
families = {"ENGINE": "strata-engine", "HY4": "strata-hy4"}
families = {"ENGINE": "strata-engine", "HY4": "strata-hy4", "INKLING": "strata-inkling"}
plan, tags = [], [releases[0]["tag_name"]]
for fam, prefix in families.items():
for pkg in re.findall(rf"^STRATA_{fam}_SHA256_([a-z0-9_]+)\?=", text, re.M):
Expand Down Expand Up @@ -137,7 +138,7 @@ for row in open(f"{work}/plan.tsv").read().splitlines():
sys.exit(f"Refusing to bump: SHA256SUMS.txt and the GitHub asset digest disagree for {name} ({sha} vs '{digest}')")
old = (get(f"STRATA_{fam}_TAG_{pkg}"), get(f"STRATA_{fam}_VERSION_{pkg}"), get(f"STRATA_{fam}_SHA256_{pkg}"))
if old != (tag, ver, sha):
label = "Hy4 engine" if fam == "HY4" else "engine"
label = {"HY4": "Hy4 engine", "INKLING": "Inkling engine"}.get(fam, "engine")
changes.append(f"- {label} `{pkg}`: {old[0]} / {old[1]} -> {tag} / {ver}")
put(f"STRATA_{fam}_TAG_{pkg}", tag)
put(f"STRATA_{fam}_VERSION_{pkg}", ver)
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/bump_deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,8 @@ jobs:
# release tag, version and SHA-256 (see backend/go/strata/Makefile), and a
# bump takes each package from the newest release that has it. The newest
# release and its commit are pinned too: the Python modules come from it.
# The engine has three package families (strata-engine, strata-hy4 and
# strata-inkling), each with its own pins; the script moves all of them.
# bump_deps.sh handles one commit variable only. Releases, not main.
# If a release changes Strata's Python requirements, regenerate
# backend/go/strata/requirements.txt by hand in the bump PR.
Expand Down
171 changes: 108 additions & 63 deletions backend/go/strata/Makefile

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions backend/go/strata/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,40 @@ picture and the engine expands it, so there is no encoder program and no `GENI`.
the helper uses Strata's `serve/hy4_dialect.py` and the parser class the Strata server uses for this template. `logprobs`
are refused: the engine has none. The Qwen options (`pack`, `pack_gguf`, `mmproj`, `vision_exe`, `ple_gguf`, ...) do not apply to this family.

## Inkling 2 Mini

Thinking Machines Inkling 2 Mini (26.4B parameters, 3.4B active, text and image input, no thinking mode) runs on a third
engine program, `strata-inkling`, with the same `--serve` line protocol and a strict parser. Set `family:inkling`. The image
carries its packages in `engines-inkling/`; the `strata-engine` launcher uses them when `STRATA_ENGINE_FAMILY=inkling`, which
the backend sets for this family.

An Inkling model is one file: a Strata build (`Inkling-2-Mini-SQ-10.strata`, `-SQ-15` or `-SQ-20`) or an Unsloth GGUF
(`Inkling-2-Mini-UD-Q4_K_XL.gguf` and the other UD quants), plus an optional vision file (`Inkling-2-Mini-Vision.strata`) and,
for a GGUF, the DSpark drafter file (`dspark-Inkling-2-Mini-Q8_0.gguf`). A Strata build carries its drafter. There is no pack.
The tokenizer (o200k byte-level BPE) and the chat template come from the manifest at the end of a Strata build and from the
`tokenizer.json` and `chat_template.jinja` files that Strata publishes beside its builds; a Strata build has the template but not
the tokenizer, and a GGUF has neither, so both files are needed in the model directory. On the first load the backend runs
Strata's `tools/inkling_tokenizer.py` and keeps the result next to the model file (`<model>.tokenizer/`, made again if a source
file changes). The engine is started as
`<engine_path> --native <file> --max-context N [--vision <file>] [--dspark <file>] [--vram-experts-gb X] [--ram-experts-gb Y] [--gpu N] [--draft dspark|off] [engine_args] --serve`.
Before that the backend runs `<engine_path> --info <file> [--vision <file>] [--dspark <file>]` and asks for `--draft dspark` and
`--vision` only when the engine reports `drafter=dspark` and `images=1`; if it cannot be asked it starts without both and logs why.

| Option (family `inkling`) | Required | Meaning |
|---|---|---|
| `native` | yes | The model file. |
| `vision` | no | The vision file, `on` (default file, must exist), `off`, or a path. With no option, the default file is used when it exists. |
| `drafter` | no | `dspark` or `auto` (default), or `off`. |
| `dspark` | no | The drafter file of a GGUF model. Default `dspark-Inkling-2-Mini-Q8_0.gguf` next to the model; a GGUF model without it starts without a drafter. |
| `tokenizer_json`, `chat_template` | no | The tokenizer sources. Defaults `tokenizer.json` and `chat_template.jinja` next to the model. |
| `vram_experts_gb`, `ram_experts_gb` | no | Caps for the experts held on the card and in RAM. Not set by default. |

`context_size` defaults to 32768 (the model reads up to 1M tokens; the KV cache grows with the context). Pictures are files, as for
Hy4-Flash: one `image=<path>` key per picture on the `GEN` line. The model writes its output as channel tokens; the prompt gets
Strata's explicit answer opener and the helper uses Strata's `InklingOutputParser` (`serve/inkling_dialect.py`) to read content and
tool calls. The model has no thinking mode, so a reasoning effort in a request changes nothing. `logprobs` are refused: the engine
has none. The Qwen options (`pack`, `pack_gguf`, `mmproj`, `vision_exe`, ...) do not apply to this family.

## Model files

A Strata model is not one file. The directory LocalAI points at holds, or the options name:
Expand Down
8 changes: 7 additions & 1 deletion backend/go/strata/hy4.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,10 +479,16 @@ func encodeHy4Path(p string) string {
// the GEN keys that name them, in prompt order. release removes the files; the
// engine has read them by the end of the request.
func hy4ImageKeys(sources []string) (keys []string, release func(), err error) {
return directImageKeys("strata-hy4-images-", sources)
}

// directImageKeys is hy4ImageKeys for any engine that reads picture files
// itself; dirPrefix names the temporary directory.
func directImageKeys(dirPrefix string, sources []string) (keys []string, release func(), err error) {
if len(sources) == 0 {
return nil, func() {}, nil
}
dir, err := os.MkdirTemp("", "strata-hy4-images-")
dir, err := os.MkdirTemp("", dirPrefix)
if err != nil {
return nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion backend/go/strata/hy4_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ var _ = Describe("hy4 family options", func() {

It("keeps the family list honest", func() {
_, err := parseLoad(&pb.ModelOptions{Options: []string{"family:other", "engine_path:/x"}})
Expect(err).To(MatchError(ContainSubstring("qwen or hy4")))
Expect(err).To(MatchError(ContainSubstring("qwen, hy4 or inkling")))
})
})

Expand Down
Loading
Loading