Repository navigation
transformers-0.8.0
·
2 commits
to main
since this release
- Breaking: transformers asks for Agentica 0.40.0 and keeps its modules in
src/:pkg/transformers/NAMEimports are unchanged, andpkg/transformers/src/NAME(Llama) becomespkg/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;Servingpads batches to the next power of two, up to the rows that can be active, and counts them inpadded_runs(ml#477). - A prompt step compiles as
Trace.Phase.Promptand every step over a cache asTrace.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 shapewhen 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.agctakesBATCH=n(ml#375, ml#476). Generateofpkg/transformers/generate_qwen4_expgenerates 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'sgenerate;KvDecoder.Steppertakesinputsthe host makes from the ids fed so far (ml#436).Qwen4Expreads the configs Hugging Face accepts (nolayer_types, no expert sizes, noindexer_*fields without indexed layers, an emptyeos_token_idwithout 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 isqwen3_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.Statscountsreused_tokensandprefilled_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-blocksand--kv-block-size(ml#92).Generate.step_batch_pageddecodes many sequences of one pool in one graph, with the ids ofstep_batchover their contiguous caches, on the reference backend, ggml's CPU engine and Vulkan (ml#92).Generate.prefill_pagedreuses the published blocks a prompt starts with and feeds the rest in one step;KvDecoder.fork_pagedshares 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, andGenerate.step_pagedandstep_paged_logitsstep 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 andPlacement.Kv.Hostare refused (ml#92). LlamaGguf.opentakesllama.rope.scaling.typedefaultlikenone, and allama.rope.dimension_countother than the head size is an error (ml#303).LlamaGguf.openreads the GGUF files of llama.cpp's converter: the reordered query and key rows andrope_freqs.weight(thellama3scaling); before, such a file gave wrong ids. Breaking: thellama.rope.scaling.*keys are no longer read, and allama.rope.scaling.typeother thannoneis an error (ml#303).tools/generate_llama_check.agcchecks 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 abfloat16checkpoint's big matrices as they are stored, and gives the logits of the same checkpoint read asF32.tools/bench_qwen.agctakesxla; 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.agctakestorch, which fine-tunes MiniLM on libtorch, every weight (ml#203, ml#394).WordPiecereads a tokenizer file with a fixed padding ("strategy": {"Fixed": 128}) as the padding to the longest, sosentence-transformers/all-MiniLM-L6-v2opens; no tokenizer here pads (ml#377).tools/fetch_minilm.shfetches all-MiniLM-L6-v2 at a pinned revision and sha256, andtools/minilm_finetune.agcloads 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 andTrain.fit_batcheslowers the loss, andtools/minilm_finetune.agctakesxla(all-MiniLM-L6-v2: the loss falls from 0.01137 to 0.00236 in six steps, as on ggml) (ml#243). tools/finetune_stsb.agcfine-tunes all-MiniLM-L6-v2 on the scored pairs of STS-B oncpu,vulkan,xlaortorch, withtools/fetch_stsb.shfor the pinned files; the guide is the pagetrain/finetune-minilm.md. It trains every weight on libtorch too (ml#394).tools/finetune_stsb.agcand its guide train throughLoop(aLoop.spearmanmetric 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).Generateof Qwen3 runs onBackend.Xla(Device.Cpu): the steps of the cache are compiled by XLA, andLift.stagedcompiles 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_weightsandBert.pooledname the weights of a BERT as the checkpoint does and run its mean embedding inside a trace, soTrain.fitandParamsfine-tune it (sentence-transformers/all-MiniLM-L6-v2sized models);DistilBertshares the helpers (ml#377).GraniteMoe.open(dir, backend, weights, layers_on_device): the layers from thenth 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 thenth 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 thenth 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_fitandQwen3.layers_withintakekv: Placement.Kv.Hostand then count no KV cache on the card (ml#331).Qwen3.layers_that_fit(dir, backend, weights, max_device_bytes)gives thelayers_on_devicethat fills the free memory of a Vulkan device (less a reserve, up to a cap), andAGENTICA_ML_MAX_DEVICE_BYTESsets the cap forbench_qwen(ml#331).Placement.footprint(c, ...)counts theFootprintof a model from its checkpoint (ml#331).Placement.fit(footprint, budget)gives the largestlayers_on_devicewhose layout fits a budget in bytes, andPlacement.budget(free, reserve, cap)the budget; both are pure, the first step of a memory budget forlayers_on_device(ml#331).