Selected changesmerged Oct 25, 2026 – Oct 31, 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)
Train adapters on top of FP8 weightsPython · 78 + / 43 −
Introduces 7 new declarations in src/transformers/integrations/finegrained_fp8.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
src/transformers/integrations/finegrained_fp8.py ↗ · 3 files
@@ -282,6 +282,63 @@ def fp8_linear( return finegrained_fp8_linear(input, weight, weight_scale_inv, block_size, bias, activation_scale) +def _dequantize_fp8_weight(+ weight: torch.Tensor, weight_scale_inv: torch.Tensor, block_size: list[int] | None, dtype: torch.dtype+) -> torch.Tensor:+ """Dequantize `(..., N, K)` FP8 weights with their per-block (or per-tensor) scales, for the backward pass."""+ if weight.dtype == torch.int8:+ raise NotImplementedError("Backward through FP4 weights is not supported.")+ scale = weight_scale_inv.to(dtype)+ if block_size is not None:+ rows, cols = weight.shape[-2:]+ scale = scale.repeat_interleave(block_size[0], dim=-2)[..., :rows, :]+ scale = scale.repeat_interleave(block_size[1], dim=-1)[..., :cols]+ return weight.to(dtype).mul_(scale)+++class FP8LinearFunction(torch.autograd.Function):+ """+ `fp8_linear` with a backward for the input, so adapters (e.g. LoRA) can train on top of FP8 layers. The FP8 weights+ are frozen: the input gradient goes through the dequantized weight, and the weight, scales and bias get none.+ """++ @staticmethod+ def forward(ctx, input, weight, weight_scale_inv, block_size, bias, activation_scale, allow_deepgemm):+ ctx.save_for_backward(weight, weight_scale_inv)+ ctx.block_size = block_size+ return fp8_linear(input, weight, weight_scale_inv, block_size, bias, activation_scale, allow_deepgemm)++ @staticmethod+ def backward(ctx, grad_output):+ weight, weight_scale_inv = ctx.saved_tensors+ weight = _dequantize_fp8_weight(weight, weight_scale_inv, ctx.block_size, grad_output.dtype)
ENH: Add `np.ma.assert_array_equal`Python · 125 + / 1 −
Introduces 3 new declarations in numpy/ma/core.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
numpy/ma/core.py ↗ · 7 files
@@ -8744,6 +8745,129 @@ def allclose(a, b, masked_equal=True, rtol=1e-5, atol=1e-8): return np.all(d) +def assert_array_equal(actual, desired, err_msg='', verbose=True, *,+ strict=False):+ """+ Raises an AssertionError if two masked arrays are not equal.++ Given two array_like objects, check that their masks are equal and that+ their data is equal wherever it is not masked. Unlike+ `numpy.testing.assert_array_equal`, which ignores masked values, a value+ that is masked in only one of the objects is reported as a mismatch.+ Objects that are not masked arrays are treated as having no masked+ values. As in `numpy.testing.assert_array_equal`, NaNs in the same+ unmasked positions are considered equal, and a scalar is compared with+ every element of an array unless `strict` is set.++ .. versionadded:: 2.6.0++ Parameters+ ----------+ actual : array_like+ The actual object to check.+ desired : array_like+ The desired, expected object.+ err_msg : str, optional+ The error message to be printed in case of failure.+ verbose : bool, optional+ If True, the conflicting values are appended to the error message.+ strict : bool, optional+ If True, raise an AssertionError when either the shape or the data+ type of the array_like objects does not match, and disable the+ special handling of scalars.
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"
Implement `advance_back_by` on `Fuse`Rust · 41 + / 0 −
Introduces 4 new declarations in library/core/src/iter/adapters/fuse.rs.
Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.
library/core/src/iter/adapters/fuse.rs ↗ · 2 files
@@ -358,6 +366,25 @@ where and_then_or_clear(&mut self.iter, |iter| iter.next_back()) } + #[inline]+ default fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>+ where+ I: DoubleEndedIterator,+ {+ let Some(iter) = &mut self.iter else {+ return match NonZero::new(n) {+ Some(n) => Err(n),+ None => Ok(()),+ };+ };++ let res = iter.advance_back_by(n);+ if res.is_err() {+ self.iter = None;+ }+ res+ }+ #[inline] default fn nth_back(&mut self, n: usize) -> Option<<I as Iterator>::Item> where
Turbopack: fix trailing-slash package root resolutionRust · 118 + / 10 −
Introduces 3 new declarations in turbopack/crates/turbopack-core/src/resolve/mod.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/resolve/mod.rs ↗ · 6 files
@@ -3908,6 +3914,108 @@ mod tests { .await; } + #[rstest::rstest]+ #[case::main(rcstr!("package").into(), r#"{"main":"./main.js"}"#, vec![("package", "main.js")])]+ #[case::main_trailing_slash(rcstr!("package/").into(), r#"{"main":"./main.js"}"#, vec![("package/", "main.js")])]+ #[case::index(rcstr!("package").into(), "{}", vec![("package", "index.js")])]+ #[case::index_trailing_slash(rcstr!("package/").into(), "{}", vec![("package/", "index.js")])]+ #[case::exports(rcstr!("package").into(), r#"{"exports":"./main.js"}"#, vec![("package", "main.js")])]+ #[case::exports_trailing_slash(rcstr!("package/").into(), r#"{"exports":"./main.js"}"#, vec![])]+ #[case::exports_subpath(rcstr!("package/subpath.js").into(), r#"{"exports":{"./subpath.js":"./main.js"}}"#, vec![("package/subpath.js", "main.js")])]+ #[case::dynamic_subpath(+ Pattern::concat([rcstr!("package/").into(), Pattern::Dynamic, rcstr!(".js").into()]),+ r#"{"main":"./main.js"}"#,+ vec![("package/index.js", "index.js"), ("package/main.js", "main.js"), ("package/subpath.js", "subpath.js")]+ )]+ #[case::dynamic_trailing_slash(+ Pattern::concat([rcstr!("package/").into(), Pattern::Dynamic]),+ r#"{"main":"./main.js"}"#,+ vec![+ ("package/", "main.js"),+ ("package/index", "index.js"), ("package/index.js", "index.js"),+ ("package/main", "main.js"), ("package/main.js", "main.js"),+ ("package/package", "package.json"), ("package/package.json", "package.json"),+ ("package/subpath", "subpath.js"), ("package/subpath.js", "subpath.js")+ ]+ )]+ #[case::dynamic_roots(+ Pattern::Alternatives(vec![+ rcstr!("package").into(),+ Pattern::concat([rcstr!("package/").into(), Pattern::Dynamic]),+ ]),+ r#"{"main":"./main.js"}"#,
fix: Protect math from markdown emphasis parsing in Markdown panePython · 58 + / 3 −
Introduces 10 new declarations in panel/pane/markup.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
panel/pane/markup.py ↗ · 3 files
@@ -38,6 +38,54 @@ # links, definition lists) or which breaks line offsets (\r). _NON_LOCAL_SYNTAX = re.compile(r'\[\^|\]:|^ {0,3}[:~][ \t]|\r', re.MULTILINE) +def _math_plugin(md: MarkdownIt) -> None:+ """+ Keeps math delimited by $$ verbatim, since the client-side+ MathJax pass runs on the rendered HTML and would otherwise see+ markup generated from characters such as '*' inside the math.+ """+ from mdit_py_plugins.dollarmath import dollarmath_plugin+ from mdit_py_plugins.dollarmath.index import math_inline_dollar++ dollarmath_plugin(md, allow_labels=False, double_inline=True)++ # The client only typesets $$, so single $ must stay ordinary text+ # (e.g. currency) and keep its surrounding emphasis.+ inline_rule = math_inline_dollar(True, True, True)++ def double_only(state, silent):+ if state.src[state.pos:state.pos + 2] != '$$':+ return False+ return inline_rule(state, silent)++ md.inline.ruler.at('math_inline', double_only)++ def raw(delimiter, block=False):+ def render(self, tokens, idx, options, env):+ math = escape(tokens[idx].content, quote=False)+ return f'{delimiter}{math}{delimiter}\n' if block else f'{delimiter}{math}{delimiter}'+ return render++ md.add_render_rule('math_inline_double', raw('$$'))+ md.add_render_rule('math_block', raw('$$', block=True))
fix: Send updates from long running sync callbacks before they returnPython · 51 + / 2 −
Introduces 3 new declarations in panel/io/document.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
panel/io/document.py ↗ · 2 files
@@ -651,6 +653,46 @@ def _suppress_property_callbacks( event.callback_invoker = None return events +async def _write_message(+ doc: Document, connections: list[ServerConnection], message: Message+) -> None:+ for conn in connections:+ lock = getattr(conn._socket, 'write_lock', None)+ with (await lock.acquire()) if lock is not None else nullcontext():+ await _await_writes(_socket_dispatcher(conn._socket)(conn, msg=message))++def _write_from_worker_thread(+ doc: Document,+ connections: Iterable[ServerConnection],+ events: list[DocumentChangedEvent]+) -> bool:+ """+ Writes events generated by a locked callback that bokeh runs on a+ worker thread right away, rather than leaving them to bokeh, which+ only writes them once the callback returns, so that a long running+ callback can still report progress.++ Only safe while bokeh has no pending writes of its own: the message+ is serialized here, while the callback holds the Document lock, and+ the write is scheduled on the event loop ahead of bokeh's, so the+ client always receives models before they are referenced.+ """+ patches = [e for e in events if isinstance(e, DocumentPatchedEvent)]+ if state._on_loop_thread or not patches or len(patches) != len(events):+ return False+ loop = state._document_loop(doc)+ asyncio_loop = t.cast(+ 'asyncio.AbstractEventLoop | None', getattr(loop, 'asyncio_loop', loop)
[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.
zlib: skip the stream in sync convenience calls without optionsJavaScript · 162 + / 19 −
Introduces 8 new declarations in lib/zlib.js.
Adds new runtime rather than adjusting what was there. Tests changed with it, with code of their own.
lib/zlib.js ↗ · 2 files
@@ -176,43 +177,128 @@ function zlibBufferOnEnd() { this.cb(null, buf); } -function zlibBufferSync(engine, buffer) {+function toSyncInput(buffer) { if (typeof buffer === 'string') {- buffer = Buffer.from(buffer);- } else if (!isArrayBufferView(buffer)) {+ return Buffer.from(buffer);+ }+ if (!isArrayBufferView(buffer)) { if (isAnyArrayBuffer(buffer)) {- buffer = Buffer.from(buffer);- } else {- throw new ERR_INVALID_ARG_TYPE(- 'buffer',- ['string', 'Buffer', 'TypedArray', 'DataView', 'ArrayBuffer'],- buffer,- );+ return Buffer.from(buffer); }+ throw new ERR_INVALID_ARG_TYPE(+ 'buffer',+ ['string', 'Buffer', 'TypedArray', 'DataView', 'ArrayBuffer'],+ buffer,+ ); }+ return buffer;+}++function zlibBufferSync(engine, buffer) {+ buffer = toSyncInput(buffer); buffer = processChunkSync(engine, buffer, engine._finishFlushFlag);
parse inline and rustc_force_inline with same parserRust · 136 + / 106 −
Introduces 4 new declarations in compiler/rustc_attr_parsing/src/attributes/inline.rs.
Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.
compiler/rustc_attr_parsing/src/attributes/inline.rs ↗ · 3 files
@@ -3,125 +3,156 @@ use rustc_feature::AttributeStability; use rustc_lint_defs::builtin::{ILL_FORMED_ATTRIBUTE_INPUT, UNUSED_ATTRIBUTES}; use super::prelude::*;-use crate::diagnostics::{InlineForceInlineConflict, InlineIgnoredForExported};+use crate::diagnostics::{InlineForceInlineConflict, InlineIgnoredForExported, UnusedMultiple}; -pub(crate) struct InlineParser;+#[derive(Default)]+pub(crate) struct InlineParser(Option<(InlineAttr, Span)>); -impl SingleAttributeParser for InlineParser {- const PATH: &[Symbol] = &[sym::inline];- const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError;- const ALLOWED_TARGETS: AllowedTargets<'_> = AllowedTargets::AllowList(&[- Allow(Target::Fn),- Allow(Target::Method(MethodKind::Inherent)),- Allow(Target::Method(MethodKind::Trait { body: true })),- Allow(Target::Method(MethodKind::TraitImpl)),- Allow(Target::Closure),- Allow(Target::Delegation { mac: false }),- Warn(Target::Method(MethodKind::Trait { body: false })),- Warn(Target::ForeignFn),- Warn(Target::Field),- Warn(Target::MacroDef),- Warn(Target::Arm),- Warn(Target::AssocConst(AssocCtxt::Impl { of_trait: false })),- Warn(Target::AssocConst(AssocCtxt::Trait)),- Warn(Target::AssocConst(AssocCtxt::Impl { of_trait: true })),- Warn(Target::MacroCall),- ]);- const TEMPLATE: AttributeTemplate = template!(- Word,- List: &["always", "never"],