Repository navigation
refactor(model): matrix products go through a Products trait - #24
Merged
Merged
Conversation
…hrough a Products trait, with the CPU as the default
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.
Milestone I2, first step of moving the model to the GPU. Nothing about the CPU model's results changes.
Almost every byte a token reads is a weight matrix being multiplied by a vector. The Inkling forward pass now asks a
Productsobject for each of those products, so that another device can take them over while everything else in the model stays written once, indluth-model.What is in it
inkling::Products:bf16(the projections and the output table) andexperts(a layer's chosen experts, one job each). Matrices are handed over as the slices of the weight file they live in.inkling::CpuProducts: the default, doing what the code did before.InklingCpu::with_products;InklingCpu::newuses the CPU.inkling::ExpertMatrices: a public description of an expert layer's stored matrices (it was a private type).ModelError::Devicefor a failing device. Functions that make products now returnResult.How it was checked
tools/mutants.sh allwith both real models: 70 killed, 0 not killed, 17 skipped (GPU). Seven forward-pass patches no longer applied after the refactor and were regenerated; patch 71 is new (one product made directly, past the trait).Review
The qwen reviewer asked for changes. Made:
CpuProducts::expertschecks its output length; a missing doc comment; theDeviceerror says the model must be restarted at position 0 afterwards.Declined: a
Sendbound on the trait object. Nothing moves the model between threads, and a GPU device is tied to its thread by design.