Selected changesmerged Oct 25, 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)
Optimize `str.escape_default().to_string()`Rust · 204 + / 20 −
Introduces 21 new declarations in library/alloc/src/string.rs.
Adds new language design rather than adjusting what was there. Tests changed with it, with code of their own.
library/alloc/src/string.rs ↗ · 7 files
@@ -3160,6 +3206,126 @@ impl SpecToString for fmt::Arguments<'_> { } } +#[cfg(not(no_global_oom_handling))]+impl SpecToString for core::str::EscapeDefault<'_> {+ fn spec_to_string(&self) -> String {+ let mut s = String::new();+ s.extend_from_escape_default(self.clone());+ s+ }+}++#[cfg(not(no_global_oom_handling))]+impl String {+ #[inline]+ fn extend_from_escape_default(&mut self, escaper: core::str::EscapeDefault<'_>) {+ let (front, middle, tail) = escaper.into_parts();+ let lengths = front.as_ref().map_or_default(|f| f.size_hint().0)+ + middle.as_ref().map_or_default(|m| m.size_hint().0)+ + tail.as_ref().map_or_default(|t| t.size_hint().0);+ self.reserve(lengths);++ if let Some(front) = front {+ self.extend(front);+ }+ if let Some(middle) = middle {+ /// Ensures a spare capacity of N bytes and then passes that as MaybeUninit+ /// slice to a closure that returns the bytes written, then+ /// updates the length.+ ///+ /// # Safety:+ ///+ /// The caller must initialize the number of bytes returned by the closure.
common, grammar: add recursive depth limit, make it a requirementC++ · 390 + / 210 −
Introduces 6 new declarations in src/llama-grammar.cpp.
Adds new framework internals rather than adjusting what was there. Tests changed with it, with code of their own.
src/llama-grammar.cpp ↗ · 21 files
@@ -1124,17 +1117,80 @@ llama_grammar_candidates llama_grammar_reject_candidates_for_stack( if (!llama_grammar_is_end_of_sequence(stack_pos_after)) { stack_after.push_back(stack_pos_after); }- llama_grammar_stacks next_stacks; llama_grammar_advance_stack(rules, stack_after, next_stacks); - auto next_rejects = llama_grammar_reject_candidates(rules, next_stacks, next_candidates);- for (const auto & tok : next_rejects) {- rejects.push_back({ tok.index, tok.code_points - 1, tok.partial_utf8, tok.id });+ return true;+}++// the candidates that no stack accepts, each stack narrows the rejects of the previous one+// no recursion: a level per code point, a token from the GGUF can be long+static llama_grammar_candidates llama_grammar_reject_candidates(+ const llama_grammar_rules & rules,+ const llama_grammar_stacks & stacks,+ const llama_grammar_candidates & candidates) {+ GGML_ASSERT(!stacks.empty()); // REVIEW++ // a level checks the candidates that reach its code point against its stacks in turn+ struct level {+ llama_grammar_stacks stacks;+ size_t i; // the stack in progress+ std::vector<uint32_t> cur; // the candidates rejected by stacks[0, i)+ std::vector<uint32_t> rejects; // the rejects of stacks[i] at this code point+ };++ std::vector<uint32_t> all(candidates.size());+ std::iota(all.begin(), all.end(), 0u);++ std::vector<level> levels;+ levels.push_back({ stacks, 0, std::move(all), {} });
vfs: fix readlink, realpath and mkdtemp encodingJavaScript · 60 + / 54 −
Introduces 2 new declarations in lib/internal/vfs/setup.js.
Adds new runtime rather than adjusting what was there. Tests changed with it, with code of their own.
lib/internal/vfs/setup.js ↗ · 5 files
@@ -526,11 +533,10 @@ function createVfsHandlers() { }); }, mkdtempSync(prefix, options) {- const result = vfsOp(prefix, (vfs, n) => vfs.mkdtempSync(n));- if (result !== undefined && options?.encoding === 'buffer') {- return Buffer.from(result);- }- return result;+ return vfsOp(prefix, (vfs, n) => {+ options = getMkdtempOptions(prefix, options);+ return encodeRealpathResult(vfs.mkdtempSync(n), options);+ }); }, mkstempSync(prefix, options) { const result = vfsOp(prefix, (vfs, n) => vfs.mkstempSync(n));
ENH: warn when to_json/to_xml compression is ignored without a path (GH#32326)Python · 32 + / 7 −
Introduces 1 new declaration in pandas/io/common.py.
Adds new core implementation rather than adjusting what was there. Tests changed with it, with code of their own.
pandas/io/common.py ↗ · 6 files
@@ -659,6 +657,27 @@ def infer_compression( raise ValueError(msg) +def warn_unused_compression(+ compression: str | CompressionDict | None,+ reason: str = "no path or buffer is given; the returned string is not compressed",+) -> None:+ """+ Warn that ``compression`` has no effect because of ``reason``.++ An unrecognized compression method still raises, as it would if it were used.+ """+ compression_method, _ = get_compression_method(compression)+ if compression_method is None or compression_method == "infer":+ return+ # the path is only consulted for "infer"; here this only validates the method+ infer_compression("", compression_method)+ warnings.warn(+ f"compression has no effect when {reason}.",+ RuntimeWarning,+ stacklevel=find_stack_level(),+ )++ def check_parent_directory(path: Path | str) -> None: """ Check if parent directory of a file exists, raise OSError if it does not