Selected changesmerged Oct 20, 2026 – Oct 26, 2026
feat(common): add build_module for configurable sub-module blocksPython · 87 + / 2 −
Introduces 6 new declarations in nemo/collections/common/parts/utils.py.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
nemo/collections/common/parts/utils.py ↗ · 2 files
@@ -35,8 +47,81 @@ "swish": nn.SiLU, "silu": nn.SiLU, "gelu": nn.GELU,+ "squared_relu": SquaredReLU, } +ModuleBlock = Callable[..., nn.Module] | functools.partial | Mapping+++def build_module(block: ModuleBlock, **defaults: Any) -> nn.Module:+ """Instantiate a configurable sub-module of a parent module.++ Args:+ block: what builds the module:+ a class or callable returning it,+ a ``functools.partial`` of one+ (what Hydra creates for a config section with ``_target_`` and ``_partial_: true``),+ or such a config section itself, resolved through ``safe_instantiate``.+ defaults: the arguments the parent supplies, such as sizes and dropout rates;+ arguments bound in the partial or the section take precedence, by keyword or by position,+ so a section only names what deviates from the parent's defaults.++ Returns:+ The instantiated module.+ """+ if isinstance(block, Mapping):+ block = _section_partial(block)+ if isinstance(block, functools.partial):+ positional = _positional_names(block)+ keywords = {name: value for name, value in defaults.items() if name not in positional}+ keywords.update(block.keywords)+ return block.func(*block.args, **keywords)+ return block(**defaults)
ENH: implement ExtensionArray.__array_function__ (GH#26380)Python · 80 + / 0 −
Introduces 4 new declarations in pandas/core/arrays/base.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
pandas/core/arrays/base.py ↗ · 5 files
@@ -3235,6 +3268,53 @@ def _groupby_first_last( return self.take(result_indices, allow_fill=True) +# -----------------------------------------------------------------------------+# __array_function__ helpers++# True while ExtensionArray.__array_function__ is handling a call+_IN_ARRAY_FUNCTION = contextvars.ContextVar("_IN_ARRAY_FUNCTION", default=False)+++# Overrides so these keep the extension dtype. Returning NotImplemented falls+# back to numpy's implementation.+++def _delete(arr, obj, axis=None):+ # the ExtensionArray may be obj rather than arr+ if (+ not isinstance(arr, ExtensionArray)+ or arr.ndim != 1+ or axis not in (None, 0, -1)+ ):+ return NotImplemented+ return arr.delete(obj)+++def _concatenate(arrays, axis=0, out=None, dtype=None, casting="same_kind"):+ if (+ not isinstance(arrays, (list, tuple))+ or not arrays+ or axis not in (None, 0, -1)+ or out is not None+ or dtype is not None+ or casting != "same_kind"
Add webpack utilsTypeScript · 650 + / 0 −
Introduces 14 new declarations in turbopack/crates/turbopack-node/js/src/transforms/webpack-loaders-utils.ts.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
turbopack/crates/turbopack-node/js/src/transforms/webpack-loaders-utils.ts ↗ · 12 files
@@ -0,0 +1,648 @@+import { createHash as nodeCreateHash } from 'crypto'+import path from 'path'++const WINDOWS_ABS_PATH_REGEXP = /^[a-zA-Z]:[\\/]/++function relativePathToRequest(relativePath: string): string {+ if (relativePath === '') return './.'+ if (relativePath === '..') return '../.'+ if (relativePath.startsWith('../')) return relativePath+ return `./${relativePath}`+}++// Matches webpack's lib/util/identifier.js, including regexp-like requests.+function absoluteToRequest(context: string, request: string): string {+ const windows = WINDOWS_ABS_PATH_REGEXP.test(request)+ if (!windows && request[0] !== '/') return request+ if (!windows && request.length > 1 && request.endsWith('/')) return request++ const queryIndex = request.indexOf('?')+ const resource = queryIndex === -1 ? request : request.slice(0, queryIndex)+ let relative = windows+ ? path.win32.relative(context, resource)+ : path.posix.relative(context, resource)+ if (!windows || !WINDOWS_ABS_PATH_REGEXP.test(relative)) {+ relative = relativePathToRequest(+ windows ? relative.replace(/\\/g, '/') : relative+ )+ }+ return relative + (queryIndex === -1 ? '' : request.slice(queryIndex))+}++export function contextify(context: string, request: string): string {+ return request
Turbopack: propagate late partial namespace provenance to passthrough targetsRust · 277 + / 6 −
Introduces 25 new declarations in turbopack/crates/turbopack-core/src/module_graph/binding_usage_info.rs.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
turbopack/crates/turbopack-core/src/module_graph/binding_usage_info.rs ↗ · 8 files
@@ -513,3 +520,267 @@ mod tests { assert!(matches!(usage, ModuleExportUsageInfo::All)); } }++#[cfg(test)]+mod graph_tests {+ use anyhow::Result;+ use rustc_hash::FxHashMap;+ use turbo_rcstr::{RcStr, rcstr};+ use turbo_tasks::{ResolvedVc, TryJoinIterExt, Vc};+ use turbo_tasks_backend::{BackendOptions, TurboTasksBackend, noop_backing_storage};+ use turbo_tasks_fs::{FileSystem, FileSystemPath, VirtualFileSystem};++ use super::compute_binding_usage_info;+ use crate::{+ asset::{Asset, AssetContent},+ ident::AssetIdent,+ module::{Module, ModuleSideEffects},+ module_graph::{+ GraphEntries, ModuleGraph, SingleModuleGraph,+ chunk_group_info::{ChunkGroupEntry, EntryHeuristics},+ },+ reference::{ModuleReference, ModuleReferences, SingleChunkableModuleReference},+ resolve::ExportUsage,+ };++ /// Module name -> outgoing edges `(target name, export usage of the edge)`, in reference order.+ type Edges = Vec<(RcStr, Vec<(RcStr, ExportUsage)>)>;++ #[turbo_tasks::value(shared)]+ struct UsageTestRepo {+ edges: FxHashMap<RcStr, Vec<(RcStr, ExportUsage)>>,+ }
[Fix] Fix NUMA and cpuset detection in CBPython · 80 + / 9 −
Introduces 3 new declarations in src/transformers/generation/continuous_batching/utils.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
src/transformers/generation/continuous_batching/utils.py ↗ · 2 files
@@ -319,6 +325,73 @@ def memory_pool_context(mem_pool: Any) -> AbstractContextManager: # --------------------------------------------------- MEMORY UTILS --------------------------------------------------- # +def _parse_numa_node_list(node_list: str) -> set[int]:+ """Parses a node list in the kernel format, e.g. "0-1,3" -> {0, 1, 3}."""+ nodes = set()+ for node_range in node_list.split(","):+ first_node, _, last_node = node_range.partition("-")+ nodes.update(range(int(first_node), int(last_node or first_node) + 1))+ return nodes+++def _get_allowed_numa_nodes() -> set[int]:+ """Returns the NUMA nodes the process can allocate memory from, i.e. the nodes allowed both by its cpuset (cgroups,+ `docker --cpuset-mems`, ...) and by its memory policy (`numactl --membind`, ...). Returns an empty set if they+ cannot be read, e.g. if we are not on Linux or there is no NUMA support."""+ allowed_sets: list[set[int]] = []++ # Retrieve the allowed nodes from the cpuset+ mems_allowed = None+ try:+ # The cpuset restricts memory to the nodes in "Mems_allowed_list: <nodes>"+ with open("/proc/self/status", encoding="utf-8", errors="replace") as f:+ for line in f:+ if line.startswith("Mems_allowed_list:"):+ mems_allowed = line.split(":")[1].strip()+ break+ except OSError:+ pass++ if mems_allowed is not None:+ allowed_sets.append(_parse_numa_node_list(mems_allowed))+
Pass initial events through input channel preparing for moving the initial event fetching to separate goroutineGo · 69 + / 34 −
Introduces 3 new declarations in staging/src/k8s.io/apiserver/pkg/storage/cacher/cache_watcher.go.
Adds new systems design rather than adjusting what was there. Tests changed with it, with code of their own.
staging/src/k8s.io/apiserver/pkg/storage/cacher/cache_watcher.go ↗ · 3 files
@@ -466,22 +472,60 @@ func (c *cacheWatcher) sendWatchCacheEvent(event *watchCacheEvent) (builtAt, sen return builtAt, sentAt } -func (c *cacheWatcher) process(ctx context.Context, cacheInterval *watchCacheInterval) {+func (c *cacheWatcher) process(ctx context.Context) { defer utilruntime.HandleCrashWithContext(ctx) defer close(c.result) defer c.Stop()+ initialized := false+ var resourceVersion uint64 - if err := c.processInitialEvents(cacheInterval); err != nil {- return+ for {+ select {+ case item, ok := <-c.input:+ if !ok {+ return+ }+ switch {+ case item.interval != nil:+ if initialized {+ klog.ErrorS(nil, "Unexpected interval after watch was already initialized", "resource", c.groupResource, "identifier", c.identifier)+ if consistency.PanicOnCacheInconsistency {+ panic(fmt.Sprintf("Unexpected interval after watch was already initialized, resource: %q, identifier: %q", c.groupResource, c.identifier))+ }+ return+ }+ if err := c.processInitialEvents(item.interval); err != nil {+ return+ }+ resourceVersion = item.interval.resourceVersion+ // At this point we already start processing incoming watch events.
BUG: str regex \w, \d, \s and \b only matching ASCII for pyarrow-backed stringsPython · 79 + / 44 −
Introduces 5 new declarations in pandas/core/arrays/_arrow_string_mixins.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
pandas/core/arrays/_arrow_string_mixins.py ↗ · 5 files
@@ -64,48 +77,72 @@ def _has_unsupported_regex(pat: str | re.Pattern[str]) -> bool: Returns -------- bool- Whether `pat` contains a lookahead or lookbehind.+ list[tuple[Any, Any]]+ The nodes of `pat`, or an empty list if Python's ``re`` cannot+ parse it. """- try:- # error: Module "re" has no attribute "_parser"- from re import _parser # type: ignore[attr-defined]+ _parser = ArrowStringArrayMixin._re_parser()+ repeats = {_parser.MAX_REPEAT, _parser.MIN_REPEAT, _parser.POSSESSIVE_REPEAT} - regex_parser = _parser.parse- except Exception as err:- raise type(err)(- "Incompatible version for regex; you will need to upgrade pandas "- "or downgrade Python"- ) from err-- def has_unsupported_code(tokens):- # For certain op codes we need to recurse.+ def walk(tokens): for op_code, argument in tokens:- if (- (- op_code == _parser.SUBPATTERN- and has_unsupported_code(argument[3])- )- or (- op_code == _parser.BRANCH
suggest named lifetimes instead of `'_` in `use<...>` for E0700Rust · 247 + / 69 −
Introduces 13 new declarations in compiler/rustc_trait_selection/src/error_reporting/infer/region.rs.
Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.
compiler/rustc_trait_selection/src/error_reporting/infer/region.rs ↗ · 8 files
@@ -1169,6 +1110,101 @@ pub(super) fn note_and_explain_region<'tcx>( emit_msg_span(err, prefix, description, span, suffix); } +fn suggest_name_regions<'tcx>(+ tcx: TyCtxt<'tcx>,+ generic_param_scope: LocalDefId,+ lifetimes: &[Region<'tcx>],+ add_lt_suggs: &mut Vec<(Span, String)>,+) -> Option<Vec<String>> {+ struct LifetimeReplaceVisitor<'a> {+ new_lts: &'a [(LocalDefId, String)],+ add_lt_suggs: &'a mut Vec<(Span, String)>,+ }++ impl<'hir> hir::intravisit::Visitor<'hir> for LifetimeReplaceVisitor<'_> {+ fn visit_lifetime(&mut self, lt: &'hir hir::Lifetime) {+ if let hir::LifetimeKind::Param(def_id) = lt.kind+ && let Some((_, new_lt)) = self.new_lts.iter().find(|(id, _)| *id == def_id)+ {+ self.add_lt_suggs.push(lt.suggestion(new_lt));+ }+ }+ }++ let mut lifetime_scope = None;+ let mut used_names = vec![];+ let mut new_lts: Vec<(LocalDefId, String)> = vec![];+ let names: Vec<_> = lifetimes+ .iter()+ .map(|&lifetime| {+ let (lifetime_def_id, scope) =+ match tcx.is_suitable_region(generic_param_scope, lifetime) {+ Some(info) if !lifetime.is_named(tcx) => {
MIR move elimination [4/6]: MoveEliminationRust · 959 + / 36 −
Introduces 41 new declarations in compiler/rustc_mir_transform/src/move_elimination.rs.
Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.
compiler/rustc_mir_transform/src/move_elimination.rs ↗ · 36 files
@@ -0,0 +1,911 @@+//! Eliminates copies and moves by unifying MIR places whose allocation ranges+//! are disjoint.+//!+//! See RFC 3943 for the local-lifetime semantics that make this optimization+//! possible.+//!+//! # Motivation+//!+//! MIR building can insert a lot of redundant copies, and Rust code in general+//! often tends to move values around a lot. The result is a lot of assignments+//! of the form `dest = {move} src;` in MIR. MIR building for constants in+//! particular tends to create additional locals that are only used inside a+//! single block to shuffle a value around unnecessarily.+//!+//! Additionally, Rust constructs nested aggregates by repeatedly moving values+//! into fields. For example, a function may build an inner value in a local,+//! move it into an outer aggregate, then move that aggregate into the caller's+//! destination. If these intermediate source and destination places have+//! different addresses, each layer needs an actual copy or move of the bytes.+//!+//! LLVM cannot remove these copies when both the source and destination+//! addresses are observed because merging the allocations would be an+//! observable change: the program could see that two addresses which were+//! previously distinct have become the same. This pass removes the copies+//! earlier, while MIR still has the information needed to prove that the two+//! allocation ranges do not overlap.+//!+//! # Optimization+//!+//! The basis of this optimization is place unification. If the source and+//! destination of an assignment have the same address, then the assignment is a+//! no-op. The same idea applies to aggregate construction: if a field operand+//! is already located at the corresponding field of the destination, then the
feat(core): add the Muon optimizer with an AdamW fallbackPython · 351 + / 0 −
Introduces 9 new declarations in nemo/core/optim/muon.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
nemo/core/optim/muon.py ↗ · 7 files
@@ -0,0 +1,314 @@+# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.+# SPDX-License-Identifier: Apache-2.0+#+# Licensed under the Apache License, Version 2.0 (the "License");+# you may not use this file except in compliance with the License.+# You may obtain a copy of the License at+#+# http://www.apache.org/licenses/LICENSE-2.0+#+# Unless required by applicable law or agreed to in writing, software+# distributed under the License is distributed on an "AS IS" BASIS,+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+# See the License for the specific language governing permissions and+# limitations under the License.++"""Muon optimizer (MomentUm Orthogonalized by Newton-Schulz) with an AdamW fallback.++Muon (Keller Jordan et al., 2024, https://kellerjordan.github.io/posts/muon/) updates a weight matrix+with an approximately semi-orthogonal matrix derived from the momentum-averaged gradient,+computed with a quintic Newton-Schulz iteration in bfloat16.+Parameters that are not matrices (biases, normalization scales, convolution filters)+and matrices with a dimension of at least ``adam_dim_threshold`` (large embeddings and output projections)+are updated with AdamW at a fixed fraction of the learning rate,+as the public reference trainings (modded-nanogpt, nanochat) do with their embeddings and heads.+An embedding below the threshold is a matrix like any other and takes the Muon update+unless its parameter group sets ``use_muon=False``, see :class:`Muon`.+One optimizer instance handles both kinds,+so one learning-rate schedule drives both with a fixed ratio.+"""++from typing import Any, Callable, Dict, Iterable, Optional, Sequence, Tuple, Union++import torch
Only disable the compiler on the offload path in AlignDevicesHookPython · 64 + / 58 −
Introduces 9 new declarations in src/accelerate/hooks.py.
Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.
src/accelerate/hooks.py ↗ · 2 files
@@ -356,76 +356,82 @@ def _maybe_get_fp16_statistics(self, name, value): return None @_compiler_disable- def pre_forward(self, module, *args, **kwargs):- if self.io_same_device:- self.input_device = find_device([args, kwargs])- if self.offload:- self.tied_pointers_to_remove = set()+ def _onload_weights(self, module):+ self.tied_pointers_to_remove = set() - for name, _ in named_module_tensors(- module,- include_buffers=self.offload_buffers,- recurse=self.place_submodules,- remove_non_persistent=True,+ for name, _ in named_module_tensors(+ module,+ include_buffers=self.offload_buffers,+ recurse=self.place_submodules,+ remove_non_persistent=True,+ ):+ value = self.weights_map[name]+ fp16_statistics = self._maybe_get_fp16_statistics(name, value)++ # In case we are using offloading with tied weights, we need to keep track of the offloaded weights+ # that are loaded on device at this point, as we will need to remove them as well from the dictionary+ # self.tied_params_map in order to allow to free memory.+ if name in self.tied_params_names and value.data_ptr() not in self.tied_params_map:+ self.tied_params_map[value.data_ptr()] = {}++ if (+ value is not None
🚨Add an FP8 backend to `QuantizedCache`Python · 144 + / 27 −
Introduces 14 new declarations in src/transformers/cache_utils.py.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
src/transformers/cache_utils.py ↗ · 6 files
@@ -919,6 +941,76 @@ def _dequantize(self, qtensor): return tensor +class Fp8QuantizedLayer(BaseQuantizedLayer):+ """+ A quantized layer storing the key and value states in 8-bit floating point. The per-tensor scale is frozen+ after the first `update`, so new states are appended as-is: no residual cache, no re-quantization.++ A finer-grained variant belongs here rather than under `QuantizedLayer`, as grouping along the head+ dimension keeps states appendable and only turns the stored scale into a tensor.+ """++ fp8_dtype = torch.float8_e4m3fn+ fp8_max = torch.finfo(fp8_dtype).max++ def lazy_initialization(self, key_states: torch.Tensor, value_states: torch.Tensor) -> None:+ super().lazy_initialization(key_states, value_states)+ self._quantized_keys = self._quantize(key_states)+ self._quantized_values = self._quantize(value_states)++ def _quantize(self, tensor, scale=None):+ """Quantize `tensor` to FP8, calibrating the scale on its amplitude if it is not provided."""+ if scale is None:+ # `clamp` guards against an all-zeros tensor, which would give a null scale+ scale = (tensor.abs().amax().float() / self.fp8_max).clamp(min=torch.finfo(torch.float32).tiny)+ return (tensor.float() / scale).to(self.fp8_dtype), scale++ def _dequantize(self, qtensor):+ quant_tensor, scale = qtensor+ return (quant_tensor.float() * scale).to(self.dtype)++ def update(+ self, key_states: torch.Tensor, value_states: torch.Tensor, *args, **kwargs