helloadhavan/github_issues huggingface dataset:
Repository: ggml-org/llama.cpp
Pull request: [CANN] Fix a bug related to enabling async_mode

Fix a bug related to enabling async_mode #13104


Changed files:
filename: ggml/src/ggml-cann/common.h
patch: @@ -359,7 +359,7 @@ struct ggml_backend_cann_context {
         ggml_cann_set_device(device);
         description = aclrtGetSocName();
 
-        bool async_mode = parse_bool(get_env("GGML_CANN_ASYNC_MODE").value_or(""));
+        async_mode = parse_bool(get_env("GGML_CANN_ASYNC_MODE").value_or(""));
         GGML_LOG_INFO("%s: device %d async operator submission is %s\n", __func__,
             device, async_mode ? "ON" : "OFF");
     }
Repository: huggingface/transformers
Pull request: update gemma tests

# What does this PR do?

All tests now pass, except the following one

Detect and fix most `_init_weights()` issues - make it work for composite models (#37070)

fails

> tests/models/gemma/test_modeling_gemma.py::GemmaModelTest::test_sdpa_equivalence

2e-3 --> 4e-3, which is larger than 3e-3.

Let's deal with this in a separate PR.

Changed files:
filename: tests/models/gemma/test_modeling_gemma.py
patch: @@ -30,7 +30,6 @@
     require_torch,
     require_torch_accelerator,
     require_torch_gpu,
-    require_torch_sdpa,
     slow,
     torch_device,
 )
@@ -147,7 +146,7 @@ def test_model_2b_bf16(self):
 
         EXPECTED_TEXTS = [
             "Hello I am doing a project on the 1990s and I need to know what the most popular music",
-            "Hi today I am going to share with you a very easy and simple recipe of <strong><em>Khichdi",
+            "Hi today I am going to share with you a very easy and simple recipe of <strong><em>Kaju Kat",
         ]
 
         model = AutoModelForCausalLM.from_pretrained(model_id, low_cpu_mem_usage=True, torch_dtype=torch.bfloat16).to(
@@ -168,34 +167,12 @@ def test_model_2b_eager(self):
 
         EXPECTED_TEXTS = [
             "Hello I am doing a project on the 1990s and I need to know what the most popular music",
-            "Hi today I am going to share with you a very easy and simple recipe of <strong><em>Khichdi",
-        ]
-
-        model = AutoModelForCausalLM.from_pretrained(
-            model_id, low_cpu_mem_usage=True, torch_dtype=torch.bfloat16, attn_implementation="eager"
-        )
-        model.to(torch_device)
-
-        tokenizer = AutoTokenizer.from_pretrained(model_id)
-        inputs = tokenizer(self.input_text, return_tensors="pt", padding=True).to(torch_device)
-
-        output = model.generate(**inputs, max_new_tokens=20, do_sample=False)
-        output_text = tokenizer.batch_decode(output, skip_special_tokens=True)
-
-        self.assertEqual(output_text, EXPECTED_TEXTS)
-
-    @require_torch_sdpa
-    @require_read_token
-    def test_model_2b_sdpa(self):
-        model_id = "google/gemma-2b"
-
-        EXPECTED_TEXTS = [
-            "Hello I am doing a project on the 1990s and I need to know what the most popular music",
-            "Hi today I am going to share with you a very easy and simple recipe of <strong><em>Khichdi",
+            "Hi today I am going to share with you a very easy and simple recipe of <strong><em>Kaju Kat",
         ]
 
+        # bfloat16 gives strange values, likely due to it has lower precision + very short prompts
         model = AutoModelForCausalLM.from_pretrained(
-            model_id, low_cpu_mem_usage=True, torch_dtype=torch.bfloat16, attn_implementation="sdpa"
+            model_id, low_cpu_mem_usage=True, torch_dtype=torch.float16, attn_implementation="eager"
         )
         model.to(torch_device)
Repository: vercel/next.js
Pull request: Turbopack Build: Fix middleware rewrite test

## What?

The reason this test fails seems to be that the `browser.on('request'` gets registered too late and the requests are not tracked because of that. Seems it can flake with webpack too. Switched to `beforePageLoad` to register it always. That switch makes the test consistently pass with Turbopack too.

Closes PACK-4695

Changed files:
filename: test/e2e/middleware-rewrites/test/index.test.ts
patch: @@ -24,15 +24,19 @@ describe('Middleware Rewrite', () => {
 
   function tests() {
     it('should handle catch-all rewrite correctly', async () => {
-      const browser = await next.browser('/', { waitHydration: false })
+      let requests: string[] = []
 
-      if (!(global as any).isNextDev) {
-        let requests = []
-
-        browser.on('request', (req) => {
-          requests.push(new URL(req.url()).pathname)
-        })
+      const browser = await next.browser('/', {
+        waitHydration: false,
+        beforePageLoad(page) {
+          page.on('request', (request) => {
+            const url = new URL(request.url())
+            requests.push(url.pathname)
+          })
+        },
+      })
 
+      if (!(global as any).isNextDev) {
         browser.elementByCss('#to-article-rewrite').moveTo()
 
         await retry(async () => {

filename: test/turbopack-build-tests-manifest.json
patch: @@ -7573,9 +7573,10 @@
       "Middleware Rewrite should rewrite to the external url for incoming data request externally rewritten",
       "Middleware Rewrite should rewrite when not using localhost",
       "Middleware Rewrite should rewrite without hard navigation",
-      "Middleware Rewrite support colons in path"
+      "Middleware Rewrite support colons in path",
+      "Middleware Rewrite should handle catch-all rewrite correctly"
     ],
-    "failed": ["Middleware Rewrite should handle catch-all rewrite correctly"],
+    "failed": [],
     "pending": [
       "Middleware Rewrite includes the locale in rewrites by default"
     ],
Repository: nodejs/node
Pull request: test: improve timeout duration for debugger events

Apparently, 5 seconds is not enough for some cases and causes flakiness on Github CI. 

Example: https://github.com/nodejs/node/actions/runs/13218322573/job/36900266760?pr=56962

cc @nodejs/inspector 

Changed files:
filename: test/common/debugger.js
patch: @@ -7,7 +7,8 @@ const BREAK_MESSAGE = new RegExp('(?:' + [
   'exception', 'other', 'promiseRejection', 'step',
 ].join('|') + ') in', 'i');
 
-let TIMEOUT = common.platformTimeout(5000);
+// Some macOS machines require more time to receive the outputs from the client.
+let TIMEOUT = common.platformTimeout(10000);
 if (common.isWindows) {
   // Some of the windows machines in the CI need more time to receive
   // the outputs from the client.
Repository: denoland/deno
Pull request: fix(node:tls): set TLSSocket.alpnProtocol for client connections

Towards https://github.com/denoland/deno/issues/26127

Changed files:
filename: ext/node/polyfills/_tls_wrap.ts
patch: @@ -68,6 +68,7 @@ export class TLSSocket extends net.Socket {
   secureConnecting: boolean;
   _SNICallback: any;
   servername: string | null;
+  alpnProtocol: string | boolean | null;
   alpnProtocols: string[] | null;
   authorized: boolean;
   authorizationError: any;
@@ -114,6 +115,7 @@ export class TLSSocket extends net.Socket {
     this.secureConnecting = true;
     this._SNICallback = null;
     this.servername = null;
+    this.alpnProtocol = null;
     this.alpnProtocols = tlsOptions.ALPNProtocols;
     this.authorized = false;
     this.authorizationError = null;
@@ -151,10 +153,21 @@ export class TLSSocket extends net.Socket {
       handle.afterConnect = async (req: any, status: number) => {
         try {
           const conn = await Deno.startTls(handle[kStreamBaseField], options);
+          try {
+            const hs = await conn.handshake();
+            if (hs.alpnProtocol) {
+              tlssock.alpnProtocol = hs.alpnProtocol;
+            } else {
+              tlssock.alpnProtocol = false;
+            }
+          } catch {
+            // Don't interrupt "secure" event to let the first read/write
+            // operation emit the error.
+          }
           handle[kStreamBaseField] = conn;
           tlssock.emit("secure");
           tlssock.removeListener("end", onConnectEnd);
-        } catch {
+        } catch (_) {
           // TODO(kt3k): Handle this
         }
         return afterConnect.call(handle, req, status);
@@ -269,6 +282,7 @@ export class ServerImpl extends EventEmitter {
         // Creates TCP handle and socket directly from Deno.TlsConn.
         // This works as TLS socket. We don't use TLSSocket class for doing
         // this because Deno.startTls only supports client side tcp connection.
+        // TODO(@satyarohith): set TLSSocket.alpnProtocol when we use TLSSocket class.
         const handle = new TCP(TCPConstants.SOCKET, await listener.accept());
         const socket = new net.Socket({ handle });
         this.emit("secureConnection", socket);

filename: tests/unit_node/tls_test.ts
patch: @@ -235,3 +235,31 @@ Deno.test("tls.rootCertificates is not empty", () => {
     (tls.rootCertificates as string[]).push("new cert");
   }, TypeError);
 });
+
+Deno.test("TLSSocket.alpnProtocol is set for client", async () => {
+  const listener = Deno.listenTls({
+    hostname: "localhost",
+    port: 0,
+    key,
+    cert,
+    alpnProtocols: ["a"],
+  });
+  const outgoing = tls.connect({
+    host: "::1",
+    servername: "localhost",
+    port: listener.addr.port,
+    ALPNProtocols: ["a"],
+    secureContext: {
+      ca: rootCaCert,
+      // deno-lint-ignore no-explicit-any
+    } as any,
+  });
+
+  const conn = await listener.accept();
+  const handshake = await conn.handshake();
+  assertEquals(handshake.alpnProtocol, "a");
+  conn.close();
+  outgoing.destroy();
+  listener.close();
+  await new Promise((resolve) => outgoing.on("close", resolve));
+});
Repository: electron/electron
Pull request: build: fixup reclient use for prod builds

Backport of #44340

See that PR for details.


Notes: none

Changed files:
filename: .github/actions/build-electron/action.yml
patch: @@ -159,21 +159,19 @@ runs:
       run: |
         cd src
         gn gen out/ffmpeg --args="import(\"//electron/build/args/ffmpeg.gn\") use_remoteexec=true $GN_EXTRA_ARGS"
-        autoninja -C out/ffmpeg electron:electron_ffmpeg_zip -j $NUMBER_OF_NINJA_PROCESSES
+        e build --target electron:electron_ffmpeg_zip -C ../../out/ffmpeg -j $NUMBER_OF_NINJA_PROCESSES
     - name: Generate Hunspell Dictionaries ${{ inputs.step-suffix }}
       shell: bash
       if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
       run: |
-        cd src
-        autoninja -C out/Default electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
+        e build --target electron:hunspell_dictionaries_zip -j $NUMBER_OF_NINJA_PROCESSES
     - name: Generate Libcxx ${{ inputs.step-suffix }}
       shell: bash
       if: ${{ inputs.is-release == 'true' && inputs.target-platform == 'linux' }}
       run: |
-        cd src
-        autoninja -C out/Default electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
-        autoninja -C out/Default electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
-        autoninja -C out/Default electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
+        e build --target electron:libcxx_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
+        e build --target electron:libcxxabi_headers_zip -j $NUMBER_OF_NINJA_PROCESSES
+        e build --target electron:libcxx_objects_zip -j $NUMBER_OF_NINJA_PROCESSES
     - name: Generate TypeScript Definitions ${{ inputs.step-suffix }}
       if: ${{ inputs.is-release == 'true' }}
       shell: bash
Repository: ggml-org/llama.cpp
Pull request: vulkan: Fix GGML_VULKAN_SHADER_DEBUG_INFO

This setting needs to be passed through to vulkan-shaders-gen


Changed files:
filename: ggml/src/ggml-vulkan/CMakeLists.txt
patch: @@ -99,6 +99,7 @@ if (Vulkan_FOUND)
 
     if (GGML_VULKAN_SHADER_DEBUG_INFO)
         add_compile_definitions(GGML_VULKAN_SHADER_DEBUG_INFO)
+        list(APPEND VULKAN_SHADER_GEN_CMAKE_ARGS -DGGML_VULKAN_SHADER_DEBUG_INFO=ON)
     endif()
 
     if (GGML_VULKAN_VALIDATE)

filename: ggml/src/ggml-vulkan/vulkan-shaders/CMakeLists.txt
patch: @@ -19,6 +19,10 @@ if (GGML_VULKAN_BFLOAT16_GLSLC_SUPPORT)
     add_compile_definitions(GGML_VULKAN_BFLOAT16_GLSLC_SUPPORT)
     message(STATUS "Enabling bfloat16 glslc support")
 endif()
+if (GGML_VULKAN_SHADER_DEBUG_INFO)
+    add_compile_definitions(GGML_VULKAN_SHADER_DEBUG_INFO)
+    message(STATUS "Enabling shader debug info")
+endif()
 
 set(TARGET vulkan-shaders-gen)
 add_executable(${TARGET} vulkan-shaders-gen.cpp)
Repository: huggingface/transformers
Pull request: [cli] cli usable without torch

# What does this PR do?

fixes import issues related to  type hints, such that the CLIs are usable without torch

supercedes #38356 

Changed files:
filename: src/transformers/commands/chat.py
patch: @@ -26,6 +26,7 @@
 
 import yaml
 
+from transformers import AutoTokenizer, GenerationConfig, TextIteratorStreamer
 from transformers.utils import is_rich_available, is_torch_available
 
 from . import BaseTransformersCLICommand
@@ -42,13 +43,7 @@
 if is_torch_available():
     import torch
 
-    from transformers import (
-        AutoModelForCausalLM,
-        AutoTokenizer,
-        BitsAndBytesConfig,
-        GenerationConfig,
-        TextIteratorStreamer,
-    )
+    from transformers import AutoModelForCausalLM, BitsAndBytesConfig
 
 
 ALLOWED_KEY_CHARS = set(string.ascii_letters + string.whitespace)
@@ -547,7 +542,7 @@ def get_quantization_config(model_args: ChatArguments) -> Optional["BitsAndBytes
 
         return quantization_config
 
-    def load_model_and_tokenizer(self, args: ChatArguments) -> tuple[AutoModelForCausalLM, AutoTokenizer]:
+    def load_model_and_tokenizer(self, args: ChatArguments) -> tuple["AutoModelForCausalLM", AutoTokenizer]:
         tokenizer = AutoTokenizer.from_pretrained(
             args.model_name_or_path_positional,
             revision=args.model_revision,
Repository: vercel/next.js
Pull request: Update flakey empty-project test

This test case has been flaking quite a bit so this increases the fetch timeout delay as we mainly want to ensure the correct content is rendered and it works not the duration. 

Changed files:
filename: test/integration/empty-project/test/index.test.js
patch: @@ -13,7 +13,8 @@ describe('Empty Project', () => {
     context.server = await launchApp(join(__dirname, '../'), context.appPort)
   })
 
-  const fetch = (p, q) => fetchViaHTTP(context.appPort, p, q, { timeout: 5000 })
+  const fetch = (p, q) =>
+    fetchViaHTTP(context.appPort, p, q, { timeout: 10_000 })
 
   it('Should not time out and return 404', async () => {
     const res = await fetch('/')
Repository: ggml-org/llama.cpp
Pull request: graph : make llm_graph_context destructor virtual

fix https://github.com/ggml-org/llama.cpp/pull/14400#discussion_r2170153950

Changed files:
filename: src/llama-graph.h
patch: @@ -475,6 +475,7 @@ struct llm_graph_context {
     std::unique_ptr<llm_graph_result> res;
 
     llm_graph_context(const llm_graph_params & params);
+    virtual ~llm_graph_context() = default;
 
     void cb(ggml_tensor * cur, const char * name, int il) const;
Repository: facebook/react
Pull request: Do not unmount layout effects on initial Offscreen mount

`wasHidden` is evaluted to false if `current` is null. This means Offscreen has never been shown but this code assumes it is going from 'visible' to 'hidden' and unmounts layout effects.
To fix this, only unmount layout effects if `current` is not null.

I'm not able to repro this problem or write unit test for it. I see this crash bug in production test.
The problem with repro is that if Offscreen starts as hidden, it's render is deferred and current is no longer null.

Changed files:
filename: packages/react-reconciler/src/ReactFiberCommitWork.new.js
patch: @@ -2880,7 +2880,8 @@ function commitMutationEffectsOnFiber(
         }
 
         if (isHidden) {
-          if (!wasHidden) {
+          // Check if this is an update, and the tree was previously visible.
+          if (current !== null && !wasHidden) {
             if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
               // Disappear the layout effects of all the children
               recursivelyTraverseDisappearLayoutEffects(offscreenBoundary);

filename: packages/react-reconciler/src/ReactFiberCommitWork.old.js
patch: @@ -2880,7 +2880,8 @@ function commitMutationEffectsOnFiber(
         }
 
         if (isHidden) {
-          if (!wasHidden) {
+          // Check if this is an update, and the tree was previously visible.
+          if (current !== null && !wasHidden) {
             if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) {
               // Disappear the layout effects of all the children
               recursivelyTraverseDisappearLayoutEffects(offscreenBoundary);

filename: packages/react-reconciler/src/__tests__/ReactOffscreen-test.js
patch: @@ -268,6 +268,44 @@ describe('ReactOffscreen', () => {
     expect(root).toMatchRenderedOutput(<span prop="Child" />);
   });
 
+  // @gate enableOffscreen
+  it('nested offscreen does not call componentWillUnmount when hidden', async () => {
+    // This is a bug that appeared during production test of <unstable_Offscreen />.
+    // It is a very specific scenario with nested Offscreens. The inner offscreen
+    // goes from visible to hidden in synchronous update.
+    class ClassComponent extends React.Component {
+      render() {
+        return <Text text="Child" />;
+      }
+
+      componentWillUnmount() {
+        Scheduler.unstable_yieldValue('componentWillUnmount');
+      }
+    }
+
+    function App() {
+      const [isVisible, setIsVisible] = React.useState(true);
+
+      if (isVisible === true) {
+        setIsVisible(false);
+      }
+
+      return (
+        <Offscreen mode="hidden">
+          <Offscreen mode={isVisible ? 'visible' : 'hidden'}>
+            <ClassComponent />
+          </Offscreen>
+        </Offscreen>
+      );
+    }
+
+    const root = ReactNoop.createRoot();
+    await act(async () => {
+      root.render(<App />);
+    });
+    expect(Scheduler).toHaveYielded(['Child']);
+  });
+
   // @gate enableOffscreen
   it('mounts/unmounts layout effects when visibility changes (starting hidden)', async () => {
     function Child({text}) {
Repository: denoland/deno
Pull request: fix(ext/node): map `ERROR_INVALID_NAME` to `ENOENT` on windows

In libuv on windows, `ERROR_INVALID_NAME` is mapped to `ENOENT`, but it is mapped to `EINVAL` in our compat implementation, which causes the issue #24899.

ref: https://github.com/libuv/libuv/blob/d4ab6fbba4669935a6bc23645372dfe4ac29ab39/src/win/error.c#L138

This PR fixes the above.

closes #24899 
closes #26411
closes #23635
closes #21165
closes #19067

Changed files:
filename: ext/node/ops/winerror.rs
patch: @@ -62,7 +62,7 @@ pub fn op_node_sys_to_uv_error(err: i32) -> String {
     WSAEHOSTUNREACH => "EHOSTUNREACH",
     ERROR_INSUFFICIENT_BUFFER => "EINVAL",
     ERROR_INVALID_DATA => "EINVAL",
-    ERROR_INVALID_NAME => "EINVAL",
+    ERROR_INVALID_NAME => "ENOENT",
     ERROR_INVALID_PARAMETER => "EINVAL",
     WSAEINVAL => "EINVAL",
     WSAEPFNOSUPPORT => "EINVAL",

filename: tests/unit_node/fs_test.ts
patch: @@ -233,3 +233,14 @@ Deno.test("[node/fs] copyFile COPYFILE_EXCL works", async () => {
     copyFileSync(src, dest2, fsPromiseConstants.COPYFILE_EXCL)
   );
 });
+
+Deno.test("[node/fs] statSync throws ENOENT for invalid path containing colon in it", () => {
+  // deno-lint-ignore no-explicit-any
+  const err: any = assertThrows(() => {
+    // Note: Deno.stat throws ERROR_INVALID_NAME (os error 123) instead of
+    // ERROR_FILE_NOT_FOUND (os error 2) on windows. This case checks that
+    // ERROR_INVALID_NAME is mapped to ENOENT correctly on node compat layer.
+    statSync("jsr:@std/assert");
+  });
+  assertEquals(err.code, "ENOENT");
+});
Repository: huggingface/transformers
Pull request: Stop TF weight rename reDOS

The regex to convert TF names to Pytorch names has potential runtime blowup for malicious inputs, so we add a check to make sure nothing too big or malformed gets passed to it.

Changed files:
filename: src/transformers/modeling_tf_pytorch_utils.py
patch: @@ -78,6 +78,9 @@ def convert_tf_weight_name_to_pt_weight_name(
         tf_name = tf_name[len(name_scope) :]
         tf_name = tf_name.lstrip("/")
     tf_name = tf_name.replace(":0", "")  # device ids
+    if (len(tf_name) > 2048 and "___" in tf_name) or tf_name.count("___") > 10:
+        # ReDOS check
+        raise ValueError("TF variable name is too long or contains too many ___ separators: " + tf_name)
     tf_name = re.sub(
         r"/[^/]*___([^/]*)/", r"/\1/", tf_name
     )  # '$1___$2' is replaced by $2 (can be used to duplicate or remove layers in TF2.0 vs PyTorch)
Repository: facebook/react
Pull request: Fix type check for null


Changed files:
filename: packages/react-server/src/ReactFlightServer.js
patch: @@ -287,7 +287,7 @@ function attemptResolveElement(
   }
   if (__DEV__) {
     jsxPropsParents.set(props, type);
-    if (typeof props.children === 'object') {
+    if (typeof props.children === 'object' && props.children !== null) {
       jsxChildrenParents.set(props.children, type);
     }
   }
Repository: ggml-org/llama.cpp
Pull request: recurrent : call balloc split_reset() in init_batch()

- Add missing `balloc.split_reset()`
- Make the recurrent memory batch splitting consistent with the other implementations

Changed files:
filename: src/llama-memory-recurrent.cpp
patch: @@ -363,30 +363,35 @@ llama_pos llama_memory_recurrent::seq_pos_max(llama_seq_id seq_id) const {
 }
 
 llama_memory_context_ptr llama_memory_recurrent::init_batch(llama_batch_allocr & balloc, uint32_t n_ubatch, bool embd_all) {
-    std::vector<llama_ubatch> ubatches;
+    do {
+        balloc.split_reset();
 
-    while (true) {
-        llama_ubatch ubatch;
+        std::vector<llama_ubatch> ubatches;
+        while (true) {
+            llama_ubatch ubatch;
 
-        if (embd_all) {
-            // if all tokens are output, split by sequence
-            ubatch = balloc.split_seq(n_ubatch);
-        } else {
-            ubatch = balloc.split_equal(n_ubatch);
+            if (embd_all) {
+                // if all tokens are output, split by sequence
+                ubatch = balloc.split_seq(n_ubatch);
+            } else {
+                ubatch = balloc.split_equal(n_ubatch);
+            }
+
+            if (ubatch.n_tokens == 0) {
+                break;
+            }
+
+            ubatches.push_back(std::move(ubatch)); // NOLINT
         }
 
-        if (ubatch.n_tokens == 0) {
+        if (!prepare(ubatches)) {
             break;
         }
 
-        ubatches.push_back(std::move(ubatch)); // NOLINT
-    }
-
-    if (!prepare(ubatches)) {
-        return std::make_unique<llama_memory_recurrent_context>(LLAMA_MEMORY_STATUS_FAILED_PREPARE);
-    }
+        return std::make_unique<llama_memory_recurrent_context>(this, std::move(ubatches));
+    } while (false);
 
-    return std::make_unique<llama_memory_recurrent_context>(this, std::move(ubatches));
+    return std::make_unique<llama_memory_recurrent_context>(LLAMA_MEMORY_STATUS_FAILED_PREPARE);
 }
 
 llama_memory_context_ptr llama_memory_recurrent::init_full() {