helloadhavan/github_issues huggingface dataset:
Repository: vercel/next.js
Pull request: fix: make sure body can be read using `nodejs` runtime in middleware

This fixes an issue where the body couldn't be read when running the middleware with the `nodejs` runtime. When running it in the `edge` runtime, `cloneBodyStream()` is ran [here](https://github.com/vercel/next.js/blob/ca4a18789d37dbd01ca3c88091d1f86134072dee/packages/next/src/server/web/sandbox/sandbox.ts#L104) so we need to do the same for the `nodejs`. 

Fixes #77551

Changed files:
filename: packages/next/src/server/next-server.ts
patch: @@ -1605,7 +1605,12 @@ export default class NextNodeServer extends BaseServer<
 
       result = await adapterFn({
         handler: middlewareModule.middleware || middlewareModule,
-        request: requestData,
+        request: {
+          ...requestData,
+          body: !['HEAD', 'GET'].includes(params.request.method)
+            ? requestData.body?.cloneBodyStream()
+            : undefined,
+        },
         page: 'middleware',
       })
     } else {

filename: test/e2e/middleware-general/app/middleware-node.js
patch: @@ -253,6 +253,10 @@ export async function middleware(request) {
     throw new Error('test error')
   }
 
+  if (url.pathname === '/request-body' && request.method === 'POST') {
+    return NextResponse.json(await request.json())
+  }
+
   const original = new URL(request.url)
   return NextResponse.next({
     headers: {

filename: test/e2e/middleware-general/app/middleware.js
patch: @@ -252,6 +252,10 @@ export async function middleware(request) {
     throw new Error('test error')
   }
 
+  if (url.pathname === '/request-body' && request.method === 'POST') {
+    return NextResponse.json(await request.json())
+  }
+
   const original = new URL(request.url)
   return NextResponse.next({
     headers: {

filename: test/e2e/middleware-general/test/index.test.ts
patch: @@ -824,6 +824,17 @@ describe('Middleware Runtime', () => {
         }/sha.json?hello=goodbye`,
       ])
     })
+
+    it(`should read request body`, async () => {
+      const body = { hello: 'world' }
+      const res = await fetchViaHTTP(next.url, '/request-body', undefined, {
+        body: JSON.stringify(body),
+        headers: { 'content-type': 'application/json' },
+        method: 'POST',
+      })
+
+      expect(await res.json()).toEqual(body)
+    })
   }
   describe('with i18n', () => {
     setup({ i18n: true })
Repository: ggml-org/llama.cpp
Pull request: [SYCL] Fix build on Windows when ccache enabled (#9954)


- [x] I have read the [contributing guidelines](https://github.com/ggerganov/llama.cpp/blob/master/CONTRIBUTING.md)
- Self-reported review complexity:
  - [x] Low
  - [ ] Medium
  - [ ] High


Changed files:
filename: ggml/src/CMakeLists.txt
patch: @@ -76,7 +76,11 @@ if (GGML_CCACHE)
             set(GGML_CCACHE_VARIANT sccache)
         endif()
         # TODO: should not be set globally
-        set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${GGML_CCACHE_VARIANT}")
+        if (GGML_SYCL AND GGML_CCACHE_FOUND AND WIN32)
+            set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "ccache compiler_type=icl")
+        else ()
+            set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${GGML_CCACHE_VARIANT}")
+        endif ()
         set(ENV{CCACHE_SLOPPINESS} time_macros)
         message(STATUS "${GGML_CCACHE_VARIANT} found, compilation results will be cached. Disable with GGML_CCACHE=OFF.")
     else()
Repository: electron/electron
Pull request: fix: dangling raw_ptr<views::View> in api::View

Backport of #42929

See that PR for details.


Notes: none.

Changed files:
filename: shell/browser/api/electron_api_view.cc
patch: @@ -178,7 +178,7 @@ View::~View() {
     return;
   view_->RemoveObserver(this);
   if (delete_view_)
-    delete view_;
+    view_.ClearAndDelete();
 }
 
 void View::ReorderChildView(gin::Handle<View> child, size_t index) {
Repository: huggingface/transformers
Pull request: [CI] fix update metadata job

# What does this PR do?

The `Update Transformers metadata / build_and_package` job is failing on main. This PR fixes underlying issues (see comments on the line changes)

Changed files:
filename: .github/workflows/update_metdata.yml
patch: @@ -19,7 +19,7 @@ jobs:
       - name: Setup environment
         run: |
           pip install --upgrade pip
-          pip install datasets pandas==2.0.3
+          pip install datasets pandas
           pip install .[torch,tf,flax]
 
       - name: Update metadata

filename: src/transformers/cache_utils.py
patch: @@ -537,6 +537,7 @@ def batch_select_indices(self, indices: torch.Tensor):
             self.value_cache[layer_idx] = self.value_cache[layer_idx][indices, ...]
 
 
+# Utilities for `DynamicCache` <> torch.export support
 def _flatten_dynamic_cache(
     dynamic_cache: DynamicCache,
 ):
@@ -584,15 +585,16 @@ def _flatten_dynamic_cache_for_fx(cache, spec):
     return torch.utils._pytree.tree_flatten(dictionary)[0]
 
 
-torch.utils._pytree.register_pytree_node(
-    DynamicCache,
-    _flatten_dynamic_cache,
-    _unflatten_dynamic_cache,
-    serialized_type_name=f"{DynamicCache.__module__}.{DynamicCache.__name__}",
-    flatten_with_keys_fn=_flatten_with_keys_dynamic_cache,
-)
-# TODO (tmanlaibaatar) This won't be needed in torch 2.7.
-torch.fx._pytree.register_pytree_flatten_spec(DynamicCache, _flatten_dynamic_cache_for_fx)
+if is_torch_greater_or_equal("2.2"):
+    torch.utils._pytree.register_pytree_node(
+        DynamicCache,
+        _flatten_dynamic_cache,
+        _unflatten_dynamic_cache,
+        serialized_type_name=f"{DynamicCache.__module__}.{DynamicCache.__name__}",
+        flatten_with_keys_fn=_flatten_with_keys_dynamic_cache,
+    )
+    # TODO (tmanlaibaatar) This won't be needed in torch 2.7.
+    torch.fx._pytree.register_pytree_flatten_spec(DynamicCache, _flatten_dynamic_cache_for_fx)
 
 
 class OffloadedCache(DynamicCache):
Repository: facebook/react
Pull request: Enable scheduling profiler flag for react-dom profiling builds

Relates to #21866

Changed files:
filename: packages/shared/ReactFeatureFlags.js
patch: @@ -17,7 +17,7 @@ export const enableDebugTracing = false;
 
 // Adds user timing marks for e.g. state updates, suspense, and work loop stuff,
 // for an experimental scheduling profiler tool.
-export const enableSchedulingProfiler = __PROFILE__ && __EXPERIMENTAL__;
+export const enableSchedulingProfiler = __PROFILE__;
 
 // Helps identify side effects in render-phase lifecycle hooks and setState
 // reducers by double invoking them in StrictLegacyMode.
Repository: vercel/next.js
Pull request: fix(turbopack): Fix panic while tree shaking optimization

### What?

Handle duplicates in `nodes_to_merge` by checking the existence of a node using graph.

### Why?

Because the previous code fails on one of the internal apps.

### How?


Closes PACK-4228

Changed files:
filename: turbopack/crates/turbopack-ecmascript/src/tree_shake/optimizations.rs
patch: @@ -207,6 +207,12 @@ impl GraphOptimizer<'_> {
             let mut nodes_to_remove = Vec::new();
 
             for node in nodes_to_merge {
+                // Skip if a node no longer exists in the graph. This may happen if `nodes_to_merge`
+                // contains a duplicate.
+                if g.node_weight(node).is_none() {
+                    continue;
+                }
+
                 // Move outgoing edges from node to start
                 let outgoing_edges: Vec<_> = g
                     .edges_directed(node, Direction::Outgoing)
@@ -243,7 +249,7 @@ impl GraphOptimizer<'_> {
             // Remove merged nodes (in reverse order to preserve indices)
             nodes_to_remove.sort();
             for node in nodes_to_remove.into_iter().rev() {
-                g.remove_node(node);
+                g.remove_node(node).expect("Node should exist");
                 did_work = true;
             }
         }
Repository: facebook/react
Pull request: Adjust Error stack columns numbers by 1

Follow up for https://github.com/facebook/react/pull/21833#discussion_r666831276. Resolves #21792.

This change accounts for differences between error stacks (1-based) and ASTs (0-based). In practice this change should not make an observable difference.

In practice, the change should never matter, because we are matching the 1-based Error stack location for the hook `Identifier` (e.g. `useState`) against the larger 0-based `VariableDeclarator` (e.g. `[foo, setFoo] = useState()`) so the ranges will always overlap. Because of this, I don't think it's possible to write an integration test that would fail without this change.

Changed files:
filename: packages/react-devtools-extensions/src/astUtils.js
patch: @@ -40,6 +40,17 @@ function checkNodeLocation(
     return false;
   }
 
+  // Column numbers are representated differently between tools/engines.
+  // Error.prototype.stack columns are 1-based (like most IDEs) but ASTs are 0-based.
+  //
+  // In practice this will probably never matter,
+  // because this code matches the 1-based Error stack location for the hook Identifier (e.g. useState)
+  // with the larger 0-based VariableDeclarator (e.g. [foo, setFoo] = useState())
+  // so the ranges should always overlap.
+  //
+  // For more info see https://github.com/facebook/react/pull/21833#discussion_r666831276
+  column -= 1;
+
   if (
     (line === start.line && column < start.column) ||
     (line === end.line && column > end.column)

filename: packages/react-devtools-extensions/src/parseHookNames.js
patch: @@ -378,6 +378,7 @@ function findHookNames(
         line: lineNumber,
 
         // Column numbers are representated differently between tools/engines.
+        // Error.prototype.stack columns are 1-based (like most IDEs) but ASTs are 0-based.
         // For more info see https://github.com/facebook/react/issues/21792#issuecomment-873171991
         column: columnNumber - 1,
       });
@@ -476,6 +477,7 @@ async function parseSourceAST(
         line: lineNumber,
 
         // Column numbers are representated differently between tools/engines.
+        // Error.prototype.stack columns are 1-based (like most IDEs) but ASTs are 0-based.
         // For more info see https://github.com/facebook/react/issues/21792#issuecomment-873171991
         column: columnNumber - 1,
       });
Repository: huggingface/transformers
Pull request: [torchao] revert to get_apply_tensor_subclass

# What does this PR do?

This PR reverts a method name in torchaoconfig back to `get_apply_tensor_subclass` as this might be breaking for other libraries such as peft. 

Changed files:
filename: src/transformers/utils/quantization_config.py
patch: @@ -1595,7 +1595,7 @@ def _get_torchao_quant_type_to_method(self):
             "autoquant": autoquant,
         }
 
-    def get_quantize_config(self):
+    def get_apply_tensor_subclass(self):
         """Create the appropriate quantization method based on configuration."""
         if isinstance(self.quant_type, str):
             methods = self._get_torchao_quant_type_to_method()
Repository: nodejs/node
Pull request: crypto: fix `RSA_PKCS1_PADDING` error message

The ability to revert the fix for CVE-2023-46809 was only added to Node.js 18.x, 20.x and 21.x as, per policy, security reverts are only added to the existing supported release lines at the time of the fix.

The error message thrown when `RSA_PKCS1_PADDING` is used on `main` and subsequent major versions (i.e. Node.js 22 and 23) when OpenSSL does not support implicit rejections should not have suggested that it is possible to revert the fix.

Fixes: https://github.com/nodejs/node/issues/55628

<!--
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: src/crypto/crypto_cipher.cc
patch: @@ -1092,8 +1092,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
     if (rsa_pkcs1_implicit_rejection <= 0) {
       return THROW_ERR_INVALID_ARG_VALUE(
           env,
-          "RSA_PKCS1_PADDING is no longer supported for private decryption,"
-          " this can be reverted with --security-revert=CVE-2024-PEND");
+          "RSA_PKCS1_PADDING is no longer supported for private decryption");
     }
   }
Repository: vercel/next.js
Pull request: Turbopack Build: CSR bailout test skip check for file path

### What?

Fix Turbopack test for missing suspense with CSR bailout by conditionally checking for source file path in error output only when not using Turbopack.

### Why?
The path in the error output is different when using Turbopack, causing the test to fail. This change makes the test pass in both environments by skipping the path check when Turbopack is enabled.

Applying sourcemaps during prerendering is being worked on. We'll be able to un-skip the particular check when it's ready.

Closes PACK-4231

Changed files:
filename: test/e2e/app-dir/missing-suspense-with-csr-bailout/missing-suspense-with-csr-bailout.test.ts
patch: @@ -29,7 +29,10 @@ describe('missing-suspense-with-csr-bailout', () => {
       expect(exitCode).toBe(1)
       expect(next.cliOutput).toContain(message)
       // Can show the trace where the searchParams hook is used
-      expect(next.cliOutput).toMatch(/at.*server[\\/]app[\\/]page.js/)
+      // TODO: This path is different for Turbopack. Builds need to have sourcemaps support.
+      if (!process.env.TURBOPACK) {
+        expect(next.cliOutput).toMatch(/at.*server[\\/]app[\\/]page.js/)
+      }
     })
 
     it('should pass build if useSearchParams is wrapped in a suspense boundary', async () => {

filename: test/turbopack-build-tests-manifest.json
patch: @@ -2991,11 +2991,10 @@
   "test/e2e/app-dir/missing-suspense-with-csr-bailout/missing-suspense-with-csr-bailout.test.ts": {
     "passed": [
       "missing-suspense-with-csr-bailout next/dynamic does not emit errors related to bailing out of client side rendering",
-      "missing-suspense-with-csr-bailout useSearchParams should pass build if useSearchParams is wrapped in a suspense boundary"
-    ],
-    "failed": [
+      "missing-suspense-with-csr-bailout useSearchParams should pass build if useSearchParams is wrapped in a suspense boundary",
       "missing-suspense-with-csr-bailout useSearchParams should fail build if useSearchParams is not wrapped in a suspense boundary"
     ],
+    "failed": [],
     "pending": [],
     "flakey": [],
     "runtimeError": false
Repository: ggml-org/llama.cpp
Pull request: llama : make Qwen2MoE QKV bias optional

I'm guessing someone is cooking something, see huggingface/transformers#36735 :)

Changed files:
filename: src/llama-model.cpp
patch: @@ -2210,9 +2210,9 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
                         layer.wo = create_tensor(tn(LLM_TENSOR_ATTN_OUT, "weight", i), {n_embd, n_embd}, 0);
 
                         // optional bias tensors
-                        layer.bq = create_tensor(tn(LLM_TENSOR_ATTN_Q,   "bias", i), {n_embd}, 0);
-                        layer.bk = create_tensor(tn(LLM_TENSOR_ATTN_K,   "bias", i), {n_embd_gqa}, 0);
-                        layer.bv = create_tensor(tn(LLM_TENSOR_ATTN_V,   "bias", i), {n_embd_gqa}, 0);
+                        layer.bq = create_tensor(tn(LLM_TENSOR_ATTN_Q,   "bias", i), {n_embd}, TENSOR_NOT_REQUIRED);
+                        layer.bk = create_tensor(tn(LLM_TENSOR_ATTN_K,   "bias", i), {n_embd_gqa}, TENSOR_NOT_REQUIRED);
+                        layer.bv = create_tensor(tn(LLM_TENSOR_ATTN_V,   "bias", i), {n_embd_gqa}, TENSOR_NOT_REQUIRED);
 
                         layer.ffn_norm = create_tensor(tn(LLM_TENSOR_FFN_NORM, "weight", i), {n_embd}, 0);
 
@@ -6193,16 +6193,25 @@ struct llm_build_qwen2moe : public llm_graph_context {
             {
                 // compute Q and K and RoPE them
                 ggml_tensor * Qcur = build_lora_mm(model.layers[il].wq, cur);
-                Qcur = ggml_add(ctx0, Qcur, model.layers[il].bq);
                 cb(Qcur, "Qcur", il);
+                if (model.layers[il].bq) {
+                    Qcur = ggml_add(ctx0, Qcur, model.layers[il].bq);
+                    cb(Qcur, "Qcur", il);
+                }
 
                 ggml_tensor * Kcur = build_lora_mm(model.layers[il].wk, cur);
-                Kcur = ggml_add(ctx0, Kcur, model.layers[il].bk);
                 cb(Kcur, "Kcur", il);
+                if (model.layers[il].bk) {
+                    Kcur = ggml_add(ctx0, Kcur, model.layers[il].bk);
+                    cb(Kcur, "Kcur", il);
+                }
 
                 ggml_tensor * Vcur = build_lora_mm(model.layers[il].wv, cur);
-                Vcur = ggml_add(ctx0, Vcur, model.layers[il].bv);
                 cb(Vcur, "Vcur", il);
+                if (model.layers[il].bv) {
+                    Vcur = ggml_add(ctx0, Vcur, model.layers[il].bv);
+                    cb(Vcur, "Vcur", il);
+                }
 
                 Qcur = ggml_reshape_3d(ctx0, Qcur, n_embd_head, n_head,    n_tokens);
                 Kcur = ggml_reshape_3d(ctx0, Kcur, n_embd_head, n_head_kv, n_tokens);
Repository: facebook/react
Pull request: Update link to flow


<!--
  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 `main`.
  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

This PR is fixing the link to the flow repository. This repository doesn't have main branch.

## Test Plan

<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. -->
No test is needed.


Changed files:
filename: packages/react/index.js
patch: @@ -7,7 +7,7 @@
  * @flow
  */
 
-// Keep in sync with https://github.com/facebook/flow/blob/main/lib/react.js
+// Keep in sync with https://github.com/facebook/flow/blob/master/lib/react.js
 export type StatelessFunctionalComponent<
   P,
 > = React$StatelessFunctionalComponent<P>;
Repository: ggml-org/llama.cpp
Pull request: Avoid calls to tokenizer.added_tokens_decoder

tokenizer.added_tokens_decoder returns a fresh dict every time relatively slowly (~0.04s on average) which results in massive slowdowns when we have a huge number of added tokens:

https://github.com/huggingface/transformers/blob/9be4728af8bec48073ae841881d7f4e2ac3521d1/src/transformers/tokenization_utils_fast.py#L264

Typically this slowdown is imperceptible, but when we have a model like ByteCraft with 100,000 added tokens, suddenly 0.04 * 2 * 100,000 = 8000 seconds extra to process the tokens: https://huggingface.co/SamsungSAILMontreal/ByteCraft/blob/main/added_tokens.json

This fix removes the slowdown entirely by calling it only once at the start (initial tokenizer load is still slow at 2 minutes but that's at least workable)

*Make sure to read the [contributing guidelines](https://github.com/ggml-org/llama.cpp/blob/master/CONTRIBUTING.md) before submitting a PR*


Changed files:
filename: convert_hf_to_gguf.py
patch: @@ -529,6 +529,8 @@ def get_vocab_base(self) -> tuple[list[str], list[int], str]:
         reverse_vocab = {id_: encoded_tok for encoded_tok, id_ in tokenizer.vocab.items()}
         added_vocab = tokenizer.get_added_vocab()
 
+        added_tokens_decoder = tokenizer.added_tokens_decoder
+
         for i in range(vocab_size):
             if i not in reverse_vocab:
                 tokens.append(f"[PAD{i}]")
@@ -538,13 +540,13 @@ def get_vocab_base(self) -> tuple[list[str], list[int], str]:
                 if token in added_vocab:
                     # The tokenizer in llama.cpp assumes the CONTROL and USER_DEFINED tokens are pre-normalized.
                     # To avoid unexpected issues - we make sure to normalize non-normalized tokens
-                    if not tokenizer.added_tokens_decoder[i].normalized:
+                    if not added_tokens_decoder[i].normalized:
                         previous_token = token
                         token = tokenizer.decode(tokenizer.encode(token, add_special_tokens=False))
                         if previous_token != token:
                             logger.info(f"{repr(previous_token)} is encoded and decoded back to {repr(token)} using AutoTokenizer")
 
-                    if tokenizer.added_tokens_decoder[i].special or self.does_token_look_special(token):
+                    if added_tokens_decoder[i].special or self.does_token_look_special(token):
                         toktypes.append(gguf.TokenType.CONTROL)
                     else:
                         # NOTE: this was added for Gemma.