Repository navigation
Conversation
…calls A reply that held complete tool calls was reported with finish_reason "tool_calls" even when max_tokens ended it, so a client took a turn that may have gone on for a finished one. Both branches of the OpenAI reply's call attachment (the shared parser's and the native formats') now keep "length" when that was the reply's finish, whole and streamed alike, and the /v1/responses and /v1/messages translations follow. A call the cap cut already kept "length"; a reply that ends on its own still reports "tool_calls". Generated tokens are unchanged; only the reported finish moves. tool_finish_test.zig (test-tool-finish-host): a complete call at the cap, a complete call plus one the cap cuts, and replies that stop on their own, whole and streamed by characters, at once and at strides 1, 2, 3 and 256; the first fails before this change. The token-stream tests' scripted engine finished every script with "length"; the two that check a tool reply's finish now end their scripts with a stop, as their replies do.
The previous change kept finish_reason "length" for a capped reply with calls but still turned every other end into "tool_calls". With a complete call already written, a reply deadline_s ended said "tool_calls" instead of "deadline", and a cancelled one said "tool_calls" instead of "cancelled", so /v1/responses reported it completed (response.completed) and /v1/messages tool_use. The loop guard's content_filter end was lost the same way. Only a reply that ended on its own now becomes "tool_calls"; length, deadline, cancelled and the loop guard's end stay as they were, whole and streamed, on every API. Generated tokens and the calls returned are unchanged. The session benchmark dropped every call of a reply that finished "length", which assumed the cap had cut a call. A capped reply can now hold complete calls, so it keeps the calls whose arguments are a complete JSON object and drops only one the cap cut; the next turn answers kept calls with tool messages, as for any call. tool_finish_routes_test.zig (test-tool-finish-host): the finish helper's reasons; a complete call ended by deadline_s; a complete call in a cancelled reply on chat, Messages and Responses; and an EOS exactly at max_tokens (still tool_calls), whole and streamed through the HTTP dispatcher. The first three fail before this change. The benchmark's fake server gains capped complete and cut calls; the complete case fails before this change.
A capped reply's tensorfold metadata now lists only calls whose envelopes closed. Object identity keeps that mapping intact when Cortheon removes server-side calls. The session benchmark requires both this completion signal and JSON-object arguments, so it no longer answers an open-envelope cut with valid arguments. Fail before: the open-envelope benchmark case retained one call, and the route boundary cases had no completed-index metadata. Pass after: test-tool-finish-host; python3 -m unittest test_bench_sessions (25 tests).
Main's Inkling 2 native replies can include a call recovered from an open envelope at the token cap. Carry that call's identity into completed-index filtering so it is not advertised as complete, including after Cortheon filtering. Keep native tool_calls_streamed false as main does; complete capped native calls are still listed.
…tral weights.zig loop_weights.zig's loader, its tensor walk, checkpointBytes and the controllers' naming move unchanged into weights.zig, with the CUDA device buffer made a type parameter. loop_weights.zig keeps its public names (Controller, Attention, Layer, Weights, load) over weights.Weights(cuda.DeviceBuffer), so loop_engine.zig and cuda_native.zig are untouched. Over the release's header (fixtures/mini_model_header.txt) and one recording buffer, the old CUDA walk and the shared one make the same allocation, the same 822 uploads in order and the same addresses.
hip_weights.zig loads the text checkpoint through the loader CUDA shares (weights.zig), over a HIP device buffer, into one 256-aligned allocation. It exposes each layer's attention, conv, router, expert (format, w13 and w2 codes, scales, amax, denominator) and controller addresses, and crossQueries, the two cross-pass query rows a core layer's messages read. Host tests in test-inkling2-hip-host run the loader on the release's header over a recording runtime: every text tensor uploaded once, 256 aligned, at the field that names it; one arena of the checkpoint's padded bytes; each layer's expert format the plan's; and the Inkling2LoopRequired and LoopWeightsOverflow refusals.
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI for a landing train: #4830 #5031 stacked on main in that order. Nothing merges from this PR: each PR above lands on its own once this tip is green, and this PR is then closed.