Selected changesmerged Nov 9, 2026
[masking] Fix packed sequences for abitrary mask formsPython · 49 + / 4 −
Introduces 3 new declarations in src/transformers/masking_utils.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
src/transformers/masking_utils.py ↗ · 2 files
@@ -186,6 +190,38 @@ def inner_mask(batch_idx: int, head_idx: int, q_idx: int, kv_idx: int) -> bool: return inner_mask +def remap_positions_for_packed_sequence(mask_function: Callable, position_ids: torch.Tensor) -> Callable:+ """+ This function remaps the monotonically increasing `q_idx` and `kv_idx` to their actual per-sequence indices when we detect+ packed sequence format, i.e. several sequences inside the same batch dimension.+ Note that it is ensured that `position_ids.shape[1] == q_length == kv_length` here, so we can never have indexing problems here.+ If this was not the case, i.e. q_length < kv_length, we would need to infer the packed kv_position_ids, since the `position_ids`+ in the argument here are the packed query positions. Then we would need to remap q_idx and kv_idx with a different tensor.+ """++ def inner_mask(batch_idx: int, head_idx: int, q_idx: int, kv_idx: int) -> bool:+ return mask_function(batch_idx, head_idx, position_ids[batch_idx, q_idx], position_ids[batch_idx, kv_idx])++ return inner_mask+++def packed_sequence_compatibility_function(+ mask_function: Callable, position_ids: torch.Tensor, packed_sequence_mask: torch.Tensor+) -> Callable:+ """+ This function ensures compatibility of the current `mask_function` with packed sequence format, by making sure each sequence+ stays fully independent of all others, and the `q_idx` and `kv_idx` positions inside each sequence are correctly remapped to+ their actual values.+ Note that it is ensured that `position_ids.shape[1] == packed_sequence_mask.shape[1] == q_length == kv_length`, so we can never+ have indexing problems here.+ """+ # For packed sequences, we need to make sure each sequence are independent, as well as remapping the indices+ return and_masks(+ packed_sequence_mask_function(packed_sequence_mask),+ remap_positions_for_packed_sequence(mask_function, position_ids),+ )
Windows unbuffered model loadC++ · 265 + / 35 −
Introduces 3 new declarations in src/llama-mmap.cpp.
Adds new runtime rather than adjusting what was there. Tests changed with it, with code of their own.
src/llama-mmap.cpp ↗ · 3 files
@@ -123,24 +207,159 @@ struct llama_file::impl { li.QuadPart = offset; BOOL ret = SetFilePointerEx(fp_win32, li, NULL, whence); if (!ret) {- throw std::runtime_error(format("read error: %s", GetErrorMessageWin32(GetLastError()).c_str()));+ throw std::runtime_error(format("seek error: %s", GetErrorMessageWin32(GetLastError()).c_str())); } } - void read_raw(void * ptr, size_t len) {+ void read_raw_unsafe(void * ptr, size_t len) {+ if (len == 0) {+ return;+ }++ const size_t read_offset = tell();+ if (read_offset > size) {+ throw std::runtime_error("unexpectedly reached end of file");+ }++ if (!has_direct_io()) {+ const size_t read_size = std::min(len, size - read_offset);+ size_t bytes_read = 0;+ while (bytes_read < read_size) {+ const DWORD to_read = (DWORD) std::min<size_t>(read_size - bytes_read, MAXDWORD);+ DWORD chunk_read = 0;+ BOOL result = ReadFile(fp_win32, reinterpret_cast<char *>(ptr) + bytes_read,+ to_read, &chunk_read, NULL);+ if (!result) {+ throw std::runtime_error(format("read error: %s", GetErrorMessageWin32(GetLastError()).c_str()));+ }+ if (chunk_read < to_read) {+ throw std::runtime_error("unexpectedly reached end of file");+ }
Watchcache background resyncGo · 122 + / 9 −
Introduces 4 new declarations in staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
staging/src/k8s.io/apiserver/pkg/storage/cacher/cacher.go ↗ · 11 files
@@ -525,6 +535,62 @@ func (c *Cacher) startCaching(stopChannel <-chan struct{}) { } } +func (c *Cacher) startBackgroundResync() {+ c.stopWg.Add(1)+ ticker := c.clock.NewTicker(watcherResyncPeriod)+ go func() {+ defer c.stopWg.Done()+ defer ticker.Stop()+ for {+ select {+ case <-c.stopCh:+ return+ case <-ticker.C():+ c.resyncWatchers()+ }+ }+ }()+}++func (c *Cacher) resyncWatchers() {+ c.RLock()+ hasUnsynced := len(c.unsyncedWatchers) > 0+ c.RUnlock()+ if !hasUnsynced {+ return+ }++ c.watchCache.RLock()+ defer c.watchCache.RUnlock()++ c.Lock()+ defer c.Unlock()
Don't block the dev overlay on the npm registry version checkTypeScript · 111 + / 32 −
Introduces 5 new declarations in packages/next/src/server/dev/hot-reloader-turbopack.ts.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
packages/next/src/server/dev/hot-reloader-turbopack.ts ↗ · 18 files
@@ -1499,16 +1501,35 @@ export async function createHotReloaderTurbopack( }) }) - let versionInfoCached: ReturnType<typeof getVersionInfo> | undefined- // This fetch, even though not awaited, is not kicked off eagerly because the first `fetch()` in+ let resolvedVersionInfo: VersionInfo | undefined+ let versionInfoRequested = false+ // This fetch is not kicked off eagerly because the first `fetch()` in // Node.js adds roughly 20ms main-thread blocking to load the SSL certificate cache // We don't want that blocking time to be in the hot path for the `ready in` logging.- // Instead, the fetch is kicked off lazily when the first `getVersionInfoCached()` is called.- const getVersionInfoCached = (): ReturnType<typeof getVersionInfo> => {- if (!versionInfoCached) {- versionInfoCached = getVersionInfo()- }- return versionInfoCached+ // Instead, `startVersionInfoRequest()` kicks it off lazily when the first HMR+ // client connects. The registry request is never awaited: until it resolves,+ // clients get a placeholder in `sync`, and every connected client receives+ // the resolved info in a `versionInfo` message. Otherwise a slow registry+ // would delay `sync`, and with it the whole dev overlay.+ const startVersionInfoRequest = () => {+ if (versionInfoRequested) return+ versionInfoRequested = true+ getVersionInfo()+ .then((versionInfo) => {+ resolvedVersionInfo = versionInfo+ for (const client of [+ ...clientsWithoutHtmlRequestId,+ ...clientsByHtmlRequestId.values(),+ ]) {+ sendToClient(client, {+ type: HMR_MESSAGE_SENT_TO_BROWSER.VERSION_INFO,
Update training dependency compatibilityPython · 292 + / 344 −
Introduces 15 new declarations in nemo/utils/callbacks/dist_ckpt_io.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
nemo/utils/callbacks/dist_ckpt_io.py ↗ · 28 files
@@ -198,288 +175,3 @@ def _get_checkpoint_io(self, trainer) -> AsyncFinalizableCheckpointIO: f'Async finalizer requires an async compatible CheckpointIO, got: {checkpoint_io.__class__}' ) return checkpoint_io---class DistributedCheckpointIO(AsyncCompatibleCheckpointIO):- """CheckpointIO for a distributed checkpoint format.-- Args:- save_ckpt_format (str): Distributed checkpoint format to use for checkpoint saving.- load_directly_on_device (bool, optional): if True, loads the weights directly- on GPU. Has effect only for `zarr` based checkpoints (PyT Distributed- always loads on device). Defaults to True.- load_strictness (StrictHandling, optional): defines loading strictness.- If not None, overwrites the `strict` flag passed to `load_checkpoint`.- Defaults to None.- async_save (bool): whether to save asynchronously. Should be set to True if- this class will be wrapped with AsyncFinalizableCheckpointIO.- torch_dist_multiproc (int, optional): number of extra processes per rank- used during ckpt save with PyTorch distributed format. Defaults, to None- which means using an MCore default (2).- parallel_save (bool): parallelizes the save across ranks. Defaults to True- parallel_load (bool): parallelizes the load across ranks (followed by params all gather).- Defaults to False due to some extra memory usage requirement.- """-- def __init__(- self,- save_ckpt_format: str,- load_directly_on_device: bool = True,- load_strictness: Optional['StrictHandling'] = None,- async_save: bool = False,- torch_dist_multiproc: Optional[int] = None,