Skip to content

transformers-0.8.0

Choose a tag to compare

@sonic182 sonic182 released this 30 Nov 23:35
· 2 commits to main since this release
38de454
  • Breaking: transformers asks for Agentica 0.40.0 and keeps its modules in src/: pkg/transformers/NAME imports are unchanged, and pkg/transformers/src/NAME (Llama) becomes pkg/transformers/NAME (ml#302).
  • On XLA a step's plan is one per batch width and KV room: caches grow to their room before a step, and Generate.step_batch(g, rows, width:) pads a batch with dropped rows; Serving pads batches to the next power of two, up to the rows that can be active, and counts them in padded_runs (ml#477).
  • A prompt step compiles as Trace.Phase.Prompt and every step over a cache as Trace.Phase.Decode, so a NeuronCore compiles each with its own flags (ml#490).
  • Generate.counters(g) reports what the compiled steps of a generator cost: compiles, plan hits, and the ms of compiling, running, uploading, fetching and picking (Stepping.Counters, ml#477).
  • Fix: speculative decoding no longer fails with add needs two tensors of one shape when a verification step grew the KV cache and a rejected draft rolled it back under the old capacity (ml#478).
  • Generation runs on Backend.Xla(Device.Neuron(0)), batched rows included; tools/bench_qwen.agc takes BATCH=n (ml#375, ml#476).
  • Generate of pkg/transformers/generate_qwen4_exp generates with Qwen4-Exp over a cache (attention and QSA indexer keys, delta and PLE states, the n-gram context), with the greedy ids of Hugging Face's generate; KvDecoder.Stepper takes inputs the host makes from the ids fed so far (ml#436).
  • Qwen4Exp reads the configs Hugging Face accepts (no layer_types, no expert sizes, no indexer_* fields without indexed layers, an empty eos_token_id without PLE, n-gram shards of any sizes), and is tested on XLA and libtorch (ml#466).
  • Qwen4Exp (pkg/transformers/qwen4_exp) loads and runs the text model of a Qwen4-Exp checkpoint (the architecture of Qwen3.8-Flash-Next), with QSA, the hashed n-gram PLE, the hyper-connections and the experts, matching Hugging Face's logits (ml#436).
  • Qwen3.8-27B loads with Qwen3_5.open: its config is qwen3_5, and the fields it adds (output_gate_type, the multi-token-prediction fields) change nothing, as in Hugging Face (ml#436).
  • Serving.Limits(reuse_prefixes: true) names the full blocks of each sequence that ends, so a later prompt that starts with them prefills only the rest; Serving.Stats counts reused_tokens and prefilled_tokens (ml#422).
  • Serving.Limits(kv_blocks:, kv_block_size:) serves every sequence from one paged pool, with the ids of a cache per sequence; a request waits for the blocks it may hold and fails when the pool could never hold it; the server takes --kv-blocks and --kv-block-size (ml#92).
  • Generate.step_batch_paged decodes many sequences of one pool in one graph, with the ids of step_batch over their contiguous caches, on the reference backend, ggml's CPU engine and Vulkan (ml#92).
  • Generate.prefill_paged reuses the published blocks a prompt starts with and feeds the rest in one step; KvDecoder.fork_paged shares a sequence, a shared or published block is copied before a write, and a paged cache on XLA or libtorch is refused until it is tested (ml#92).
  • A paged KV cache for Qwen3: Generate.open_pool(g, blocks, size) makes one pool for many sequences, and Generate.step_paged and step_paged_logits step a sequence through its block table with the logits of the contiguous cache exactly, on the reference backend, ggml's CPU engine and Vulkan; a model with recurrent states and Placement.Kv.Host are refused (ml#92).
  • LlamaGguf.open takes llama.rope.scaling.type default like none, and a llama.rope.dimension_count other than the head size is an error (ml#303).
  • LlamaGguf.open reads the GGUF files of llama.cpp's converter: the reordered query and key rows and rope_freqs.weight (the llama3 scaling); before, such a file gave wrong ids. Breaking: the llama.rope.scaling.* keys are no longer read, and a llama.rope.scaling.type other than none is an error (ml#303).
  • tools/generate_llama_check.agc checks the greedy ids of Llama 3.2 1B Instruct against Hugging Face, from safetensors and GGUF, on ggml CPU and Vulkan (ml#303).
  • Qwen3.open(dir, xla, BF16) keeps a bfloat16 checkpoint's big matrices as they are stored, and gives the logits of the same checkpoint read as F32. tools/bench_qwen.agc takes xla; on an RTX 4060 the estimated unique weight storage of Qwen3-0.6B is 1.19 GB against 2.38 GB, at the same decode speed (benchmarks/README.md).
  • tools/minilm_finetune.agc takes torch, which fine-tunes MiniLM on libtorch, every weight (ml#203, ml#394).
  • WordPiece reads a tokenizer file with a fixed padding ("strategy": {"Fixed": 128}) as the padding to the longest, so sentence-transformers/all-MiniLM-L6-v2 opens; no tokenizer here pads (ml#377).
  • tools/fetch_minilm.sh fetches all-MiniLM-L6-v2 at a pinned revision and sha256, and tools/minilm_finetune.agc loads it and fine-tunes it for a few steps on ggml CPU or Vulkan (ml#377).
  • A BERT fine-tunes on Backend.Xla(Device.Cpu): the gradients of the cosine loss match the reference and Train.fit_batches lowers the loss, and tools/minilm_finetune.agc takes xla (all-MiniLM-L6-v2: the loss falls from 0.01137 to 0.00236 in six steps, as on ggml) (ml#243).
  • tools/finetune_stsb.agc fine-tunes all-MiniLM-L6-v2 on the scored pairs of STS-B on cpu, vulkan, xla or torch, with tools/fetch_stsb.sh for the pinned files; the guide is the page train/finetune-minilm.md. It trains every weight on libtorch too (ml#394).
  • tools/finetune_stsb.agc and its guide train through Loop (a Loop.spearman metric on a seeded validation sample, a step-and-loss handler) and take the epochs, the validation sample size and an optional time budget in seconds as arguments (ml#397).
  • Generate of Qwen3 runs on Backend.Xla(Device.Cpu): the steps of the cache are compiled by XLA, and Lift.staged compiles the forward there too (ml#243). Checked on the tiny model of the tests; the check against Hugging Face on Qwen3-0.6B and the speed are not done yet.
  • Bert.weights, Bert.with_weights and Bert.pooled name the weights of a BERT as the checkpoint does and run its mean embedding inside a trace, so Train.fit and Params fine-tune it (sentence-transformers/all-MiniLM-L6-v2 sized models); DistilBert shares the helpers (ml#377).
  • GraniteMoe.open(dir, backend, weights, layers_on_device): the layers from the nth on, with their experts and keys, run on the CPU under a Vulkan device, as for Qwen3 (ml#331).
  • Lfm3.open(dir, backend, weights, layers_on_device): the layers from the nth on, with their convolution states and keys, run on the CPU under a Vulkan device, as for Qwen3 (ml#331).
  • Qwen3_5.open(dir, backend, weights, layers_on_device): the layers from the nth on, with their keys and states, run on the CPU under a Vulkan device, with the table and the head placed as for Qwen3 (ml#331).
  • Qwen3.layers_that_fit and Qwen3.layers_within take kv: Placement.Kv.Host and then count no KV cache on the card (ml#331).
  • Qwen3.layers_that_fit(dir, backend, weights, max_device_bytes) gives the layers_on_device that fills the free memory of a Vulkan device (less a reserve, up to a cap), and AGENTICA_ML_MAX_DEVICE_BYTES sets the cap for bench_qwen (ml#331).
  • Placement.footprint(c, ...) counts the Footprint of a model from its checkpoint (ml#331).
  • Placement.fit(footprint, budget) gives the largest layers_on_device whose layout fits a budget in bytes, and Placement.budget(free, reserve, cap) the budget; both are pure, the first step of a memory budget for layers_on_device (ml#331).