helloadhavan/github_issues huggingface dataset:
Repository: electron/electron
Pull request: fix: -Wunsafe-buffer-usage warnings in GetNextZoomLevel()

Backport of #43803

See that PR for details.


Notes: none.

Changed files:
filename: shell/browser/ui/inspectable_web_contents.cc
patch: @@ -5,6 +5,8 @@
 
 #include "shell/browser/ui/inspectable_web_contents.h"
 
+#include <algorithm>
+#include <array>
 #include <memory>
 #include <string_view>
 #include <utility>
@@ -74,10 +76,6 @@ namespace electron {
 
 namespace {
 
-const double kPresetZoomFactors[] = {0.25, 0.333, 0.5,  0.666, 0.75, 0.9,
-                                     1.0,  1.1,   1.25, 1.5,   1.75, 2.0,
-                                     2.5,  3.0,   4.0,  5.0};
-
 const char kChromeUIDevToolsURL[] =
     "devtools://devtools/bundled/devtools_app.html?"
     "remoteBase=%s&"
@@ -126,16 +124,22 @@ void SetZoomLevelForWebContents(content::WebContents* web_contents,
   content::HostZoomMap::SetZoomLevel(web_contents, level);
 }
 
-double GetNextZoomLevel(double level, bool out) {
-  double factor = blink::PageZoomLevelToZoomFactor(level);
-  size_t size = std::size(kPresetZoomFactors);
-  for (size_t i = 0; i < size; ++i) {
-    if (!blink::PageZoomValuesEqual(kPresetZoomFactors[i], factor))
-      continue;
-    if (out && i > 0)
-      return blink::PageZoomFactorToZoomLevel(kPresetZoomFactors[i - 1]);
-    if (!out && i != size - 1)
-      return blink::PageZoomFactorToZoomLevel(kPresetZoomFactors[i + 1]);
+double GetNextZoomLevel(const double level, const bool out) {
+  static constexpr std::array<double, 16U> kPresetFactors{
+      0.25, 0.333, 0.5,  0.666, 0.75, 0.9, 1.0, 1.1,
+      1.25, 1.5,   1.75, 2.0,   2.5,  3.0, 4.0, 5.0};
+  static constexpr auto kBegin = kPresetFactors.begin();
+  static constexpr auto kEnd = kPresetFactors.end();
+
+  const double factor = blink::PageZoomLevelToZoomFactor(level);
+  auto matches = [=](auto val) {
+    return blink::PageZoomValuesEqual(factor, val);
+  };
+  if (auto iter = std::find_if(kBegin, kEnd, matches); iter != kEnd) {
+    if (out && iter != kBegin)
+      return blink::PageZoomFactorToZoomLevel(*--iter);
+    if (!out && ++iter != kEnd)
+      return blink::PageZoomFactorToZoomLevel(*iter);
   }
   return level;
 }
Repository: ggml-org/llama.cpp
Pull request: server: fix remove 'image_url'/'input_audio' json-object effectlly for 'llama_params' in multimodal-model-mode

In multimodal-model-mode, the  'image_url'/'input_audio' json-object will copy to 'llama_params' json-object, it causes the following codes are not effective.
```cpp
p.erase("image_url");
... ...
p.erase("input_audio");
```


Changed files:
filename: tools/server/utils.hpp
patch: @@ -573,7 +573,7 @@ struct oaicompat_parser_options {
 
 // used by /chat/completions endpoint
 static json oaicompat_chat_params_parse(
-    const json & body, /* openai api json semantics */
+    json & body, /* openai api json semantics */
     const oaicompat_parser_options & opt,
     std::vector<raw_buffer> & out_files)
 {
@@ -624,7 +624,7 @@ static json oaicompat_chat_params_parse(
     if (!body.contains("messages")) {
         throw std::runtime_error("'messages' is required");
     }
-    json messages = body.at("messages");
+    json & messages = body.at("messages");
     if (!messages.is_array()) {
         throw std::runtime_error("Expected 'messages' to be an array");
     }
Repository: huggingface/transformers
Pull request: Fix donut backtracking

There's an exploitable regex in the donut processor, this replaces it with less blowup-prone code!

Changed files:
filename: src/transformers/models/donut/processing_donut.py
patch: @@ -156,14 +156,18 @@ def token2json(self, tokens, is_inner_value=False, added_vocab=None):
         output = {}
 
         while tokens:
-            start_token = re.search(r"<s_(.*?)>", tokens, re.IGNORECASE)
-            if start_token is None:
+            # We want r"<s_(.*?)>" but without ReDOS risk, so do it manually in two parts
+            potential_start = re.search(r"<s_", tokens, re.IGNORECASE)
+            if potential_start is None:
                 break
-            key = start_token.group(1)
+            start_token = tokens[potential_start.start() :]
+            if ">" not in start_token:
+                break
+            start_token = start_token[: start_token.index(">") + 1]
+            key = start_token[len("<s_") : -len(">")]
             key_escaped = re.escape(key)
 
             end_token = re.search(rf"</s_{key_escaped}>", tokens, re.IGNORECASE)
-            start_token = start_token.group()
             if end_token is None:
                 tokens = tokens.replace(start_token, "")
             else:
Repository: ggml-org/llama.cpp
Pull request: convert : fix qwen omni conversion

the `config["thinker_config"]` is not processed correctly if the config is read from `AutoConfig`. Thanks @danielhanchen for reporting this bug !


This also fix a small bug in the multimodal conversion, reported via #13848

Changed files:
filename: convert_hf_to_gguf.py
patch: @@ -423,19 +423,19 @@ def load_hparams(dir_model: Path):
         try:
             # for security reason, we don't allow loading remote code by default
             # if a model need remote code, we will fallback to config.json
-            return AutoConfig.from_pretrained(dir_model, trust_remote_code=False).to_dict()
+            config = AutoConfig.from_pretrained(dir_model, trust_remote_code=False).to_dict()
         except Exception as e:
             logger.warning(f"Failed to load model config from {dir_model}: {e}")
             logger.warning("Trying to load config.json instead")
             with open(dir_model / "config.json", "r", encoding="utf-8") as f:
                 config = json.load(f)
-                if "llm_config" in config:
-                    # rename for InternVL
-                    config["text_config"] = config["llm_config"]
-                if "thinker_config" in config:
-                    # rename for Qwen2.5-Omni
-                    config["text_config"] = config["thinker_config"]["text_config"]
-                return config
+        if "llm_config" in config:
+            # rename for InternVL
+            config["text_config"] = config["llm_config"]
+        if "thinker_config" in config:
+            # rename for Qwen2.5-Omni
+            config["text_config"] = config["thinker_config"]["text_config"]
+        return config
 
     @classmethod
     def register(cls, *names: str) -> Callable[[AnyModel], AnyModel]:
@@ -1207,7 +1207,7 @@ def set_gguf_parameters(self):
             self.gguf_writer.add_audio_block_count(self.find_aparam(self.n_block_keys))
             self.gguf_writer.add_audio_head_count(self.find_aparam(["num_attention_heads"]))
 
-        else:
+        if not self.has_vision_encoder and not self.has_audio_encoder:
             raise ValueError("MmprojModel must have either vision or audio encoder")
 
     def write_vocab(self):
Repository: nodejs/node
Pull request: test: add line break at end of file

Refs: https://github.com/nodejs/node/pull/56441#discussion_r1913408065

Changed files:
filename: test/fixtures/disable-signal/sigusr1.js
patch: @@ -1,2 +1,2 @@
 console.log('pid is', process.pid);
-setInterval(() => {}, 1000);
\ No newline at end of file
+setInterval(() => {}, 1000);
Repository: ggml-org/llama.cpp
Pull request: Change umlaut test

*Make sure to read the [contributing guidelines](https://github.com/ggerganov/llama.cpp/blob/master/CONTRIBUTING.md) before submitting a PR*


Changed files:
filename: convert_hf_to_gguf_update.py
patch: @@ -288,7 +288,7 @@ def get_vocab_base_pre(self, tokenizer) -> str:
 
 tests = [
     "ied 4 ½ months",
-    "Führer",
+    "Äpfel",
     "",
     " ",
     "  ",
Repository: denoland/deno
Pull request: fix(ext/node): fix Decipheriv when autoPadding disabled

This PR fixes Decipheriv behavior when autoPadding disabled and enabled.

By this change, the example given in [this comment](https://github.com/denoland/deno/issues/20924#issuecomment-2345931295) works in the same way as Node.

closes #20924

Changed files:
filename: ext/node/polyfills/internal/crypto/cipher.ts
patch: @@ -306,6 +306,10 @@ class BlockModeCache {
     this.cache = this.cache.subarray(len);
     return out;
   }
+
+  set lastChunkIsNonZero(value: boolean) {
+    this.#lastChunkIsNonZero = value;
+  }
 }
 
 export class Decipheriv extends Transform implements Cipher {
@@ -338,7 +342,7 @@ export class Decipheriv extends Transform implements Cipher {
       },
       ...options,
     });
-    this.#cache = new BlockModeCache(true);
+    this.#cache = new BlockModeCache(this.#autoPadding);
     this.#context = op_node_create_decipheriv(cipher, toU8(key), toU8(iv));
     this.#needsBlockCache =
       !(cipher == "aes-128-gcm" || cipher == "aes-256-gcm");
@@ -386,6 +390,7 @@ export class Decipheriv extends Transform implements Cipher {
 
   setAutoPadding(autoPadding?: boolean): this {
     this.#autoPadding = Boolean(autoPadding);
+    this.#cache.lastChunkIsNonZero = this.#autoPadding;
     return this;
   }
 

filename: tests/unit_node/crypto/crypto_cipher_test.ts
patch: @@ -378,3 +378,41 @@ Deno.test({
     assertEquals(info2.ivLength, 16);
   },
 });
+
+Deno.test({
+  name:
+    "createDecipheriv - handling of the last chunk when auto padding enabled/disabled",
+  fn() {
+    const algorithm = "aes-256-cbc";
+    const key = Buffer.from(
+      "84dcdd964968734fdf0de4a2cba471c2e0a753930b841c014b1e77f456b5797b",
+      "hex",
+    );
+    const val = Buffer.from(
+      "feabbdf66e2c71cc780d0cd2765dcce283e8ae7e58fcc1a9acafc678581e0e06",
+      "hex",
+    );
+    const iv = Buffer.alloc(16, 0);
+
+    {
+      const decipher = crypto.createDecipheriv(algorithm, key, iv);
+      decipher.setAutoPadding(false);
+      assertEquals(
+        decipher.update(val, undefined, "hex"),
+        "ed2c908f26571bf8e50d60b77fb9c25f95b933b59111543c6fac41ad6b47e681",
+      );
+      assertEquals(decipher.final("hex"), "");
+    }
+
+    {
+      const decipher = crypto.createDecipheriv(algorithm, key, iv);
+      assertEquals(
+        decipher.update(val, undefined, "hex"),
+        "ed2c908f26571bf8e50d60b77fb9c25f",
+      );
+      assertThrows(() => {
+        decipher.final();
+      });
+    }
+  },
+});
Repository: nodejs/node
Pull request: benchmark: add stream.compose benchmark

Initiated the benchmark to `stream.compose`.

This PR should unblock PR - https://github.com/nodejs/node/pull/54053 which was requested benchmark for the changes.

<!--
Before submitting a pull request, please read:

- the CONTRIBUTING guide at https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md
- the commit message formatting guidelines at
  https://github.com/nodejs/node/blob/HEAD/doc/contributing/pull-requests.md#commit-message-guidelines

For code changes:
1. Include tests for any bug fixes or new features.
2. Update documentation if relevant.
3. Ensure that `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes.

If you believe this PR should be highlighted in the Node.js CHANGELOG
please add the `notable-change` label.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.
-->


Changed files:
filename: benchmark/streams/compose.js
patch: @@ -0,0 +1,42 @@
+'use strict';
+const common = require('../common.js');
+
+const {
+  PassThrough,
+  Readable,
+  Writable,
+  compose,
+} = require('node:stream');
+
+const bench = common.createBenchmark(main, {
+  n: [1e3],
+});
+
+function main({ n }) {
+  const cachedPassThroughs = [];
+  const cachedReadables = [];
+  const cachedWritables = [];
+
+  for (let i = 0; i < n; i++) {
+    const numberOfPassThroughs = 100;
+    const passThroughs = [];
+
+    for (let i = 0; i < numberOfPassThroughs; i++) {
+      passThroughs.push(new PassThrough());
+    }
+
+    const readable = Readable.from(['hello', 'world']);
+    const writable = new Writable({ objectMode: true, write: (chunk, encoding, cb) => cb() });
+
+    cachedPassThroughs.push(passThroughs);
+    cachedReadables.push(readable);
+    cachedWritables.push(writable);
+  }
+
+  bench.start();
+  for (let i = 0; i < n; i++) {
+    const composed = compose(cachedReadables[i], ...cachedPassThroughs[i], cachedWritables[i]);
+    composed.end();
+  }
+  bench.end(n);
+}
Repository: electron/electron
Pull request: fix: detach native view when its removed from parent on macOS

#### Description of Change
Right now DelayedNativeViewHost attaches its underlying native view when it's being attached to a widget but it doesn't detach it when it's being detached. It may lead to use-after-free and crash.

We (in OpenFin) have different views hierarchy and lack of detaching a native views causes use-after-free during destruction of a window which contains some views. I was not able to get a repo on clean Electron but it seems wrong that we don't detach a native view and it may cause problems in different scenarios also on clean Electron.

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] PR description included and stakeholders cc'd
- [x] `npm test` passes
- [x] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).

#### Release Notes

Notes: Fixed potential use-after-free during view removal on macOS.


Changed files:
filename: shell/browser/ui/cocoa/delayed_native_view_host.mm
patch: @@ -15,6 +15,8 @@
 
 void DelayedNativeViewHost::ViewHierarchyChanged(
     const views::ViewHierarchyChangedDetails& details) {
+  if (!details.is_add && native_view())
+    Detach();
   NativeViewHost::ViewHierarchyChanged(details);
   if (details.is_add && GetWidget() && !native_view())
     Attach(native_view_);
Repository: facebook/react
Pull request: Fix typo in dangerfile.js (insiginificant -> insignificant)

Fix typo in dangerfile.js (insiginificant -> insignificant)

Changed files:
filename: dangerfile.js
patch: @@ -41,7 +41,7 @@ const CRITICAL_THRESHOLD = 0.02;
 const SIGNIFICANCE_THRESHOLD = 0.002;
 const CRITICAL_ARTIFACT_PATHS = new Set([
   // We always report changes to these bundles, even if the change is
-  // insiginificant or non-existent.
+  // insignificant or non-existent.
   'oss-stable/react-dom/cjs/react-dom.production.min.js',
   'oss-experimental/react-dom/cjs/react-dom.production.min.js',
   'facebook-www/ReactDOM-prod.classic.js',
Repository: ggml-org/llama.cpp
Pull request: CUDA: fix FA tg at long context for CC >= 8.9

Fixes https://github.com/ggml-org/llama.cpp/issues/12816#issuecomment-2915519224 .

On master the CUDA kernel for combining FlashAttention results without stream-k implicitly assumes that the number of parallel blocks is small vs. the head size. This used to be true but after the number of parallel blocks was made variable in https://github.com/ggml-org/llama.cpp/issues/12182 there are configurations where the shared memory is not being initialized correctly. This PR fixes the issue by replacing the bad conditional statement with a loop.

Changed files:
filename: ggml/src/ggml-cuda/fattn-common.cuh
patch: @@ -623,8 +623,8 @@ static __global__ void flash_attn_combine_results(
     __builtin_assume(tid < D);
 
     extern __shared__ float2 meta[];
-    if (tid < 2*parallel_blocks) {
-        ((float *) meta)[threadIdx.x] = ((const float *)VKQ_meta) [blockIdx.z*(2*parallel_blocks) + tid];
+    for (int i = tid; i < 2*parallel_blocks; i += D) {
+        ((float *) meta)[i] = ((const float *)VKQ_meta) [blockIdx.z*(2*parallel_blocks) + i];
     }
 
     __syncthreads();
Repository: huggingface/transformers
Pull request: Fix typo

# What does this PR do?

<!--
Congratulations! You've made it this far! You're not quite done yet though.

Once merged, your PR is going to appear in the release notes with the title you set, so make sure it's a great title that fully reflects the extent of your awesome contribution.

Then, please replace this with a description of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies (if any) that are required for this change.

Once you're done, someone will review your PR shortly (see the section "Who can review?" below to tag some potential reviewers). They may suggest changes to make the code even better. If no one reviewed your PR after a week has passed, don't hesitate to post a new comment @-mentioning the same persons---sometimes notifications get lost.
-->

<!-- Remove if not applicable -->

Fixes minor typo


## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [ ] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


Changed files:
filename: docs/source/ko/_toctree.yml
patch: @@ -98,7 +98,7 @@
     - local: generation_strategies
       title: 텍스트 생성 전략 사용자 정의
     - local: serving
-      title: 모델 서빙하기기
+      title: 모델 서빙하기
     title: 생성
   - isExpanded: false
     sections:
Repository: ggml-org/llama.cpp
Pull request: convert : fix tensor naming conflict for llama 4 vision

Fix naming conflict of `multi_modal_projector.linear_*` tensor name.

Llama 4 has only one single `multi_modal_projector.linear_1` which acts as a fully connected layer.

Other models usually have 2 or 3 linear layers.

(Note: there is no bug report for this, but I just found out while looking at the code, so assume somehow this does not affect any users)


Changed files:
filename: convert_hf_to_gguf.py
patch: @@ -2169,6 +2169,9 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
             # process vision tensors
             if "positional_embedding_vlm" in name and ".weight" not in name:
                 name += ".weight"
+            if "multi_modal_projector.linear_1" in name:
+                # despite the name with number postfix, this is a single fully connected layer
+                return [(gguf.TENSOR_NAMES[gguf.MODEL_TENSOR.V_MMPROJ_FC], data_torch)]
             return [(self.map_tensor_name(name), data_torch)]
         return []
 

filename: gguf-py/gguf/tensor_mapping.py
patch: @@ -902,7 +902,6 @@ class TensorNameMap:
 
         MODEL_TENSOR.V_MMPROJ_FC: (
             "model.connector.modality_projection.proj", # SmolVLM
-            "multi_modal_projector.linear_1", # llama 4
         ),
 
         MODEL_TENSOR.V_MMPROJ_MLP: (
Repository: denoland/deno
Pull request: fix(console): prevent duplicate error printing when the cause is assi…

This commit fixes the error format when the cause is assigned separately, ensuring that the cause is only printed once instead of twice.

The fix addresses issue [#21651](https://github.com/denoland/deno/issues/21651).

**Use Case**
When an error instance has a cause assigned separately, it produces the same output as when the cause is passed directly to the Error constructor.
**constructed-with-cause.js**
```
const x = new SyntaxError("improper syntax")
    const y = new TypeError("type incorrect", { cause: x })
    console.log(y)
```
**assigned-cause.js**
```
const x = new SyntaxError("improper syntax")
    const y = new TypeError("type incorrect")
    y.cause = x
```

When running the command `deno run constructed-with-cause.js`, the cause is printed twice. This occurs because the `inspectError `function checks for a cause property in the error and appends it to the final message, leading to the first print. The second print happens due to the direct assignment of the cause, which makes it an enumerable property. When the `getKeys `function retrieves the enumerable keys from the error, it includes cause, resulting in it being appended again to the final message after calling `formatProperty`, which invokes `inspectError `once more. as shown in this code:
![image](https://github.com/user-attachments/assets/fffabd72-f69c-480f-b2f6-22518ed699f3)
![image](https://github.com/user-attachments/assets/6d2feaf8-b0f7-4951-89a8-a95a060bdfea)


Code changes

A) Skip adding the cause as a key since it is already handeled in the `inspectError `method

Changed files:
filename: ext/console/01_console.js
patch: @@ -1287,6 +1287,7 @@ function getKeys(value, showHidden) {
       ArrayPrototypePushApply(keys, ArrayPrototypeFilter(symbols, filter));
     }
   }
+  keys = ArrayPrototypeFilter(keys, (key) => key !== "cause");
   return keys;
 }
 

filename: tests/unit/console_test.ts
patch: @@ -1894,6 +1894,25 @@ Deno.test(function consoleLogShouldNotThrowErrorWhenInputIsProxiedTypedArray() {
   });
 });
 
+Deno.test(function consoleLogWhenCauseIsAssignedShouldNotPrintCauseTwice() {
+  mockConsole((console, out) => {
+    const typeError = new TypeError("Type incorrect");
+    const syntaxError = new SyntaxError("Improper syntax");
+    typeError.cause = syntaxError;
+    console.log(typeError);
+    const result = stripAnsiCode(out.toString());
+    // Filter out stack trace lines, keeping only the first line and the cause line
+    const filteredOutput = result
+      .split("\n")
+      .filter((line) => !line.trim().startsWith("at"))
+      .join("\n");
+
+    const expectedResult =
+      "TypeError: Type incorrect\nCaused by SyntaxError: Improper syntax\n";
+    assertEquals(filteredOutput.trim(), expectedResult.trim());
+  });
+});
+
 // console.log(new Proxy(new RegExp(), {}))
 Deno.test(function consoleLogShouldNotThrowErrorWhenInputIsProxiedRegExp() {
   mockConsole((console, out) => {