helloadhavan/github_issues huggingface dataset:
Repository: facebook/react
Pull request: Add flag concurrent root to Fabric render function

<!--
  Thanks for submitting a pull request!
  We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory.

  Before submitting a pull request, please make sure the following is done:

  1. Fork [the repository](https://github.com/facebook/react) and create your branch from `master`.
  2. Run `yarn` in the repository root.
  3. If you've fixed a bug or added code that should be tested, add tests!
  4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development.
  5. Run `yarn test --prod` to test in the production environment. It supports the same options as `yarn test`.
  6. If you need a debugger, run `yarn debug-test --watch TestName`, open `chrome://inspect`, and press "Inspect".
  7. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`).
  8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

  Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html
-->

## Summary

To enable Concurrent Features in React Native, we need to pass flag to render surface with concurrent root.

## Test Plan

Tested separately with React Native.


Changed files:
filename: packages/react-native-renderer/src/ReactFabric.js
patch: @@ -40,7 +40,7 @@ import {
   getInspectorDataForViewTag,
   getInspectorDataForViewAtPoint,
 } from './ReactNativeFiberInspector';
-import {LegacyRoot} from 'react-reconciler/src/ReactRootTags';
+import {LegacyRoot, ConcurrentRoot} from 'react-reconciler/src/ReactRootTags';
 import ReactSharedInternals from 'shared/ReactSharedInternals';
 import getComponentNameFromType from 'shared/getComponentNameFromType';
 
@@ -201,13 +201,21 @@ function render(
   element: Element<ElementType>,
   containerTag: number,
   callback: ?() => void,
+  concurrentRoot: ?boolean,
 ): ?ElementRef<ElementType> {
   let root = roots.get(containerTag);
 
   if (!root) {
     // TODO (bvaughn): If we decide to keep the wrapper component,
     // We could create a wrapper for containerTag as well to reduce special casing.
-    root = createContainer(containerTag, LegacyRoot, false, null, false, null);
+    root = createContainer(
+      containerTag,
+      concurrentRoot ? ConcurrentRoot : LegacyRoot,
+      false,
+      null,
+      false,
+      null,
+    );
     roots.set(containerTag, root);
   }
   updateContainer(element, root, null, callback);
Repository: ggml-org/llama.cpp
Pull request: vulkan: fix bug in coopmat1 mul_mat_id

Came across these failures while I was testing mul_mat_id with larger values of N, to verify other PRs.

Changed files:
filename: ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp
patch: @@ -777,7 +777,7 @@ void main() {
         [[unroll]] for (uint cm_col = 0; cm_col < cms_per_col; cm_col++) {
             coopMatStore(sums[cm_col * cms_per_row + cm_row], coopmat_stage, warp_i * TM * TN, TM, gl_CooperativeMatrixLayoutColumnMajor);
 
-            [[unroll]] for (uint col = 0; col < BN; col += storestride) {
+            [[unroll]] for (uint col = 0; col < TN; col += storestride) {
                 const uint row_i = dc + cm_col * TN + col + store_c;
                 if (row_i >= _ne1) break;
 

filename: tests/test-backend-ops.cpp
patch: @@ -4113,7 +4113,7 @@ static std::vector<std::unique_ptr<test_case>> make_test_cases_eval() {
             for (int n_mats : {4, 8}) {
                 for (int n_used : {1, 2, 4}) {
                     for (bool b : {false, true}) {
-                        for (int n : {1, 32}) {
+                        for (int n : {1, 32, 129}) {
                             int m = 512;
                             int k = 256;
                             test_cases.emplace_back(new test_mul_mat_id(type_a, type_b, n_mats, n_used, b, m, n, k));
Repository: huggingface/transformers
Pull request: [CI] remove redundant checks in `test_eager_matches_sdpa_inference`

# What does this PR do?

Follow-up to #36650 

Removes redundant test cases in `test_eager_matches_sdpa_inference`, related to `output_attentions`.

SDPA has special attention mask preparation (e.g. see [here](https://github.com/huggingface/transformers/blob/e3af4fec91bdac3381e07f6e60fb8b74c3957c11/src/transformers/models/llama/modeling_llama.py#L657)) but, when we pass `output_attentions`, SDPA reverts to eager attention. That means that mask preparation for SDPA + `output_attentions` must be the same as eager. In #30652 we added a `for` loop to test the cases with `output_attentions in (True, False)`, resulting in 24 new subtests. 

That's testing overkill, all we need to check is to confirm that we're preparing the attention mask correctly with `output_attentions=True`. This PR removes all but 1 of the redundant tests.

@ydshieh with this PR, both CPU and GPU CI is faster than in `v4.49.0` 🤗 

Changed files:
filename: tests/test_modeling_common.py
patch: @@ -138,16 +138,16 @@
     (
         # test name for the test runner
         f"{dtype}_pad_{padding_side}{'' if use_attention_mask else '_no_attn_mask'}"
-        f"{'_output_attn' if output_attentions else ''}{'_sdpa_kernels' if enable_kernels else ''}",
+        f"{'_sdpa_kernels' if enable_kernels else ''}",
         # parameterization
-        *(dtype, padding_side, use_attention_mask, output_attentions, enable_kernels),
+        *(dtype, padding_side, use_attention_mask, False, enable_kernels),
     )
     for dtype in ("fp16", "fp32", "bf16")
     for padding_side in ("left", "right")
     for use_attention_mask in (True, False)
-    for output_attentions in (True, False)
     for enable_kernels in (True, False)
-]
+    # Extra test case: `output_attentions=True` has special attention mask handling and sdpa reverts to eager
+] + [("fp32_pad_left_output_attentions", "fp32", "left", True, True, False)]
 
 
 def _config_zero_init(config):
@@ -3618,7 +3618,7 @@ def test_eager_matches_sdpa_inference(
             ("cuda", False, torch.bfloat16): 1e-2,
             ("cuda", False, torch.float16): 5e-3,
             ("cuda", True, torch.float32): 1e-4,
-            ("cuda", True, torch.bfloat16): 3e-2,
+            ("cuda", True, torch.bfloat16): 3e-2,  # (different from others)
             ("cuda", True, torch.float16): 5e-3,
         }
Repository: denoland/deno
Pull request: fix(ext/node): add support for MessagePort.removeListener/off

Closes https://github.com/denoland/deno/issues/23564

Changed files:
filename: ext/node/polyfills/worker_threads.ts
patch: @@ -473,6 +473,12 @@ class NodeMessageChannel {
   }
 }
 
+const listeners = new SafeWeakMap<
+  // deno-lint-ignore no-explicit-any
+  (...args: any[]) => void,
+  // deno-lint-ignore no-explicit-any
+  (ev: any) => any
+>();
 function webMessagePortToNodeMessagePort(port: MessagePort) {
   port.on = port.addListener = function (this: MessagePort, name, listener) {
     // deno-lint-ignore no-explicit-any
@@ -486,6 +492,24 @@ function webMessagePortToNodeMessagePort(port: MessagePort) {
     } else {
       throw new Error(`Unknown event: "${name}"`);
     }
+    listeners.set(listener, _listener);
+    return this;
+  };
+  port.off = port.removeListener = function (
+    this: MessagePort,
+    name,
+    listener,
+  ) {
+    if (name == "message") {
+      port.removeEventListener("message", listeners.get(listener)!);
+    } else if (name == "messageerror") {
+      port.removeEventListener("messageerror", listeners.get(listener)!);
+    } else if (name == "close") {
+      port.removeEventListener("close", listeners.get(listener)!);
+    } else {
+      throw new Error(`Unknown event: "${name}"`);
+    }
+    listeners.delete(listener);
     return this;
   };
   port[nodeWorkerThreadCloseCb] = () => {

filename: ext/web/13_message_port.js
patch: @@ -190,6 +190,11 @@ class MessagePort extends EventTarget {
       this[_enabled] = true;
       while (true) {
         if (this[_id] === null) break;
+        // Exit if no message event listeners are present in Node compat mode.
+        if (
+          typeof this[nodeWorkerThreadCloseCb] == "function" &&
+          messageEventListenerCount === 0
+        ) break;
         let data;
         try {
           data = await op_message_port_recv_message(

filename: tests/specs/node/worker_threads/__test__.jsonc
patch: @@ -0,0 +1,8 @@
+{
+  "steps": [{
+    "args": "run message_port_removelistener.mjs",
+    "output": "message_port_removelistener.mjs.out",
+    // Note: successful exit asserts that the test passed
+    "exitCode": 0
+  }]
+}

filename: tests/specs/node/worker_threads/message_port_removelistener.mjs
patch: @@ -0,0 +1,9 @@
+import { MessageChannel } from "node:worker_threads";
+
+const { port1, port2 } = new MessageChannel();
+const listener = (message) => {
+  console.log(message);
+  port1.off("message", listener);
+};
+port1.on("message", listener);
+port2.postMessage("Hello World!");

filename: tests/specs/node/worker_threads/message_port_removelistener.mjs.out
patch: @@ -0,0 +1 @@
+Hello World!
Repository: vercel/next.js
Pull request: unify allowed origin detection handling

This unifies the CSRF origin detection to mirror what we do for server action origins, which supports things like wildcard matches (below the domain level)

Fixes #76999

Changed files:
filename: docs/01-app/04-api-reference/05-config/01-next-config-js/allowedDevOrigins.mdx
patch: @@ -11,7 +11,7 @@ To configure a Next.js application to allow requests from origins other than the
 
 ```js filename="next.config.js"
 module.exports = {
-  allowedDevOrigins: ['local-origin.dev'],
+  allowedDevOrigins: ['local-origin.dev', '*.local-origin.dev'],
 }
 ```
 

filename: packages/next/src/server/lib/router-utils/block-cross-site.ts
patch: @@ -3,6 +3,7 @@ import type { IncomingMessage, ServerResponse } from 'webpack-dev-server'
 import { parseUrl } from '../../../lib/url'
 import net from 'net'
 import { warnOnce } from '../../../build/output/log'
+import { isCsrfOriginAllowed } from '../../app-render/csrf-protection'
 
 export const blockCrossSite = (
   req: IncomingMessage,
@@ -25,7 +26,7 @@ export const blockCrossSite = (
     }
     res.end('Unauthorized')
     warnOnce(
-      `Blocked cross-origin request to /_next/*. To allow this, configure "allowedDevOrigins" in next.config\nRead more: https://nextjs.org/docs/app/api-reference/config/next-config-js/allowedDevOrigins`
+      `Blocked cross-origin request to /_next/*. Cross-site requests are blocked in "no-cors" mode.`
     )
     return true
   }
@@ -46,9 +47,7 @@ export const blockCrossSite = (
         // allow requests if direct IP and matching port and
         // allow if any of the allowed origins match
         !(isIpRequest && isMatchingPort) &&
-        !allowedOrigins.some(
-          (allowedOrigin) => allowedOrigin === originLowerCase
-        )
+        !isCsrfOriginAllowed(originLowerCase, allowedOrigins)
       ) {
         if ('statusCode' in res) {
           res.statusCode = 403
Repository: vercel/next.js
Pull request: only log when instrumentation client takes too long

Only log when the sync code inside instrumentation client takes more than 16ms, instead of logging every single time.

Changed files:
filename: packages/next/src/lib/require-instrumentation-client.ts
patch: @@ -6,12 +6,27 @@
  */
 if (process.env.__NEXT_EXPERIMENTAL_CLIENT_INSTRUMENTATION_HOOK) {
   if (process.env.NODE_ENV === 'development') {
+    const measureName = 'Client Instrumentation Hook'
     const startTime = performance.now()
     require('private-next-instrumentation-client')
     const endTime = performance.now()
-    console.log(
-      `[Client Instrumentation Hook] executed in ${(endTime - startTime).toFixed(0)}ms (Note: Code download overhead is not included in this measurement)`
-    )
+
+    const duration = endTime - startTime
+    performance.measure(measureName, {
+      start: startTime,
+      end: endTime,
+      detail: 'Client instrumentation initialization',
+    })
+
+    // Using 16ms threshold as it represents one frame (1000ms/60fps)
+    // This helps identify if the instrumentation hook initialization
+    // could potentially cause frame drops during development.
+    const THRESHOLD = 16
+    if (duration > THRESHOLD) {
+      console.log(
+        `[${measureName}] Slow execution detected: ${duration.toFixed(0)}ms (Note: Code download overhead is not included in this measurement)`
+      )
+    }
   } else {
     require('private-next-instrumentation-client')
   }

filename: test/e2e/instrumentation-client-hook/app-router/instrumentation-client.ts
patch: @@ -1 +1,6 @@
 ;(window as any).__INSTRUMENTATION_CLIENT_EXECUTED_AT = performance.now()
+
+const start = performance.now()
+while (performance.now() - start < 20) {
+  // Intentionally block for 20ms to test instrumentation timing
+}

filename: test/e2e/instrumentation-client-hook/instrumentation-client-hook.test.ts
patch: @@ -7,18 +7,21 @@ describe('Instrumentation Client Hook', () => {
     {
       name: 'With src folder',
       appDir: 'app-with-src',
+      shouldLog: false,
     },
     {
       name: 'App Router',
       appDir: 'app-router',
+      shouldLog: true,
     },
     {
       name: 'Pages Router',
       appDir: 'pages-router',
+      shouldLog: false,
     },
   ]
 
-  testCases.forEach(({ name, appDir }) => {
+  testCases.forEach(({ name, appDir, shouldLog }) => {
     describe(name, () => {
       const { next, isNextDev } = nextTestSetup({
         files: path.join(__dirname, appDir),
@@ -37,9 +40,11 @@ describe('Instrumentation Client Hook', () => {
         expect(instrumentationTime).toBeLessThan(hydrationTime)
         expect(
           (await browser.log()).some((log) =>
-            log.message.startsWith('[Client Instrumentation Hook]')
+            log.message.startsWith(
+              '[Client Instrumentation Hook] Slow execution detected'
+            )
           )
-        ).toBe(isNextDev)
+        ).toBe(isNextDev && shouldLog)
       })
     })
   })
Repository: facebook/react
Pull request: Fix typo in comment (accumlated → accumulated)

## Summary

Fixed minor typo in comment.

accumlated → accumulated


Changed files:
filename: packages/react-reconciler/src/ReactFiberBeginWork.new.js
patch: @@ -557,7 +557,7 @@ function updateSimpleMemoComponent(
         // The pending lanes were cleared at the beginning of beginWork. We're
         // about to bail out, but there might be other lanes that weren't
         // included in the current render. Usually, the priority level of the
-        // remaining updates is accumlated during the evaluation of the
+        // remaining updates is accumulated during the evaluation of the
         // component (i.e. when processing the update queue). But since since
         // we're bailing out early *without* evaluating the component, we need
         // to account for it here, too. Reset to the value of the current fiber.

filename: packages/react-reconciler/src/ReactFiberBeginWork.old.js
patch: @@ -557,7 +557,7 @@ function updateSimpleMemoComponent(
         // The pending lanes were cleared at the beginning of beginWork. We're
         // about to bail out, but there might be other lanes that weren't
         // included in the current render. Usually, the priority level of the
-        // remaining updates is accumlated during the evaluation of the
+        // remaining updates is accumulated during the evaluation of the
         // component (i.e. when processing the update queue). But since since
         // we're bailing out early *without* evaluating the component, we need
         // to account for it here, too. Reset to the value of the current fiber.
Repository: huggingface/transformers
Pull request: fix can_generate

Hi @SunMarc . I don't know why this code has been removed since there are many models overwrite the generate method. This PR fixed this kind of model. The following codes will be break without this PR:
```python
from transformers import pipeline

pipe = pipeline("text-to-speech", "suno/bark")
pipe("hello")
```

Changed files:
filename: src/transformers/models/blip/modeling_blip.py
patch: @@ -1233,7 +1233,7 @@ def generate(
     """,
     BLIP_START_DOCSTRING,
 )
-class BlipForQuestionAnswering(BlipPreTrainedModel):
+class BlipForQuestionAnswering(BlipPreTrainedModel, GenerationMixin):
     config_class = BlipConfig
     _tied_weights_keys = ["text_decoder.cls.predictions.decoder.bias"]
 

filename: src/transformers/models/speecht5/modeling_speecht5.py
patch: @@ -2631,6 +2631,13 @@ def __init__(self, config: SpeechT5Config):
         # Initialize weights and apply final processing
         self.post_init()
 
+    @classmethod
+    def can_generate(cls) -> bool:
+        # Speecht5 has a unique model structure, where the external class (`SpeechT5ForTextToSpeech`) doesn't need to inherit from
+        # `GenerationMixin` (it has a non-standard generation method). This means that the base `can_generate()` will return `False`,
+        # but we need to override it so as to do `GenerationConfig` handling in multiple parts of the codebase.
+        return True
+
     def get_encoder(self):
         return self.speecht5.get_encoder()
 

filename: tests/models/bark/test_modeling_bark.py
patch: @@ -1076,6 +1076,10 @@ def fine_generation_config(self):
         fine_generation_config = BarkFineGenerationConfig(**self.model.generation_config.fine_acoustics_config)
         return fine_generation_config
 
+    def test_model_can_generate(self):
+        # Bark has custom generate without inheriting GenerationMixin. This test could prevent regression.
+        self.assertTrue(self.model.can_generate())
+
     @slow
     def test_generate_semantic(self):
         input_ids = self.inputs

filename: tests/models/speecht5/test_modeling_speecht5.py
patch: @@ -881,6 +881,7 @@ def create_and_check_model_forward(self, config, inputs_dict):
 @require_torch
 class SpeechT5ForTextToSpeechTest(ModelTesterMixin, unittest.TestCase):
     all_model_classes = (SpeechT5ForTextToSpeech,) if is_torch_available() else ()
+    all_generative_model_classes = ()
     is_encoder_decoder = True
     test_pruning = False
     test_headmasking = False
@@ -892,6 +893,12 @@ def setUp(self):
     def test_config(self):
         self.config_tester.run_common_tests()
 
+    def test_model_can_generate(self):
+        config, inputs_dict = self.model_tester.prepare_config_and_inputs()
+        for model_class in self.all_model_classes:
+            model = model_class(config)
+            self.assertTrue(model.can_generate())
+
     def test_save_load_strict(self):
         config, inputs_dict = self.model_tester.prepare_config_and_inputs()
         for model_class in self.all_model_classes:
Repository: facebook/react
Pull request: Fix typo in comment (satsify → satisfy)

## Summary

Fixed minor typo in comment.

satsify → satisfy


Changed files:
filename: packages/react-reconciler/src/ReactFiberWorkLoop.new.js
patch: @@ -1803,7 +1803,7 @@ function commitRootImpl(root, renderPriorityLevel) {
 
   // Check if there are any effects in the whole tree.
   // TODO: This is left over from the effect list implementation, where we had
-  // to check for the existence of `firstEffect` to satsify Flow. I think the
+  // to check for the existence of `firstEffect` to satisfy Flow. I think the
   // only other reason this optimization exists is because it affects profiling.
   // Reconsider whether this is necessary.
   const subtreeHasEffects =

filename: packages/react-reconciler/src/ReactFiberWorkLoop.old.js
patch: @@ -1803,7 +1803,7 @@ function commitRootImpl(root, renderPriorityLevel) {
 
   // Check if there are any effects in the whole tree.
   // TODO: This is left over from the effect list implementation, where we had
-  // to check for the existence of `firstEffect` to satsify Flow. I think the
+  // to check for the existence of `firstEffect` to satisfy Flow. I think the
   // only other reason this optimization exists is because it affects profiling.
   // Reconsider whether this is necessary.
   const subtreeHasEffects =
Repository: ggml-org/llama.cpp
Pull request: Fix backend search path

`std::filesystem::current_path()` returns path without '/', leading to `path` error when trying to load the base backend.

I provide a simple example to demonstrate.

```
lin@amx:~/bs$ touch test.txt
lin@amx:~/bs$ cat error.cpp
#include <filesystem>
#include <iostream>
namespace fs = std::filesystem;
 
int main()
{
    fs::path search_path = fs::current_path();
    fs::path filename = "test.txt";
    fs::path path = search_path.native() + filename.native();
    if (fs::exists(path)) {
        std::cout << "File exists." << std::endl;
    } else {
        std::cout << "File does not exist." << std::endl;
    }
}
lin@amx:~/bs$ g++ error.cpp --std=c++17
lin@amx:~/bs$ ./a.out 
File does not exist.
lin@amx:~/bs$ diff error.cpp correct.cpp 
7c7
<     fs::path search_path = fs::current_path();
---
>     fs::path search_path = fs::current_path() / "";
lin@amx:~/bs$ g++ correct.cpp --std=c++17
lin@amx:~/bs$ ./a.out 
File exists.
```

Refenence: https://en.cppreference.com/w/cpp/filesystem/current_path

Changed files:
filename: ggml/src/ggml-backend-reg.cpp
patch: @@ -497,7 +497,7 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
         search_paths.push_back(get_executable_path());
         search_paths.push_back(fs::current_path());
     } else {
-        search_paths.push_back(user_search_path);
+        search_paths.push_back(fs::u8path(user_search_path));
     }
 
     int best_score = 0;
@@ -511,9 +511,9 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
         fs::directory_iterator dir_it(search_path, fs::directory_options::skip_permission_denied);
         for (const auto & entry : dir_it) {
             if (entry.is_regular_file()) {
-                auto filename = entry.path().filename().native();
-                auto ext = entry.path().extension().native();
-                if (filename.find(file_prefix) == 0 && ext == file_extension) {
+                auto filename = entry.path().filename();
+                auto ext = entry.path().extension();
+                if (filename.native().find(file_prefix) == 0 && ext == file_extension) {
                     dl_handle_ptr handle { dl_load_library(entry) };
                     if (!handle && !silent) {
                         GGML_LOG_ERROR("%s: failed to load %s\n", __func__, path_str(entry.path()).c_str());
@@ -544,7 +544,7 @@ static ggml_backend_reg_t ggml_backend_load_best(const char * name, bool silent,
         // try to load the base backend
         for (const auto & search_path : search_paths) {
             fs::path filename = backend_filename_prefix().native() + name_path.native() + backend_filename_extension().native();
-            fs::path path = search_path.native() + filename.native();
+            fs::path path = search_path / filename;
             if (fs::exists(path)) {
                 return get_reg().load_backend(path, silent);
             }
Repository: electron/electron
Pull request: build: update build-tools for GHA

Backport of #42870

See that PR for details.


Notes: <!-- Please add a one-line description for app developers to read in the release notes, or 'none' if no notes relevant to app developers. Examples and help on special cases: https://github.com/electron/clerk/blob/main/README.md#examples -->none


Changed files:
filename: .github/actions/install-build-tools/action.yml
patch: @@ -6,6 +6,6 @@ runs:
   - name: Install Build Tools
     shell: bash
     run: |
-      export BUILD_TOOLS_SHA=ff3e40a9a2ebb735c18b6450ecd5ddaa8bb364a9
+      export BUILD_TOOLS_SHA=47d4bb016f47d89938898c794db80b9f98d78ad7
       npm i -g @electron/build-tools
       e auto-update disable
\ No newline at end of file