helloadhavan/github_issues huggingface dataset:
Repository: huggingface/transformers
Pull request: fix llama4 training

# What does this PR do?

Fix some issues during Llama 4 training using transformers.

![image](https://github.com/user-attachments/assets/0191e111-6ea5-4f72-a369-f72e58975f4f)

Reproduce: https://github.com/hiyouga/LLaMA-Factory/pull/7611

## Before submitting
- [ ] 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?


## Who can review?

@ArthurZucker

Changed files:
filename: src/transformers/models/llama4/modeling_llama4.py
patch: @@ -356,7 +356,7 @@ def forward(
             attn_scales = (
                 torch.log(torch.floor((cache_position.float() + 1.0) / self.floor_scale) + 1.0) * self.attn_scale + 1.0
             )
-            attn_scales = attn_scales.view((*input_shape, 1, 1))
+            attn_scales = attn_scales.view((1, input_shape[-1], 1, 1)).expand((*input_shape, 1, 1))  # batch size > 1
             query_states = (query_states * attn_scales).to(query_states.dtype)
 
         query_states = query_states.transpose(1, 2)
@@ -692,6 +692,7 @@ def forward(
                     position_ids,
                     past_key_values,
                     output_attentions,
+                    False,  # output_router_logits is False
                     use_cache,
                     cache_position,
                     freq_cis,
@@ -1375,6 +1376,7 @@ def forward(
                 layer_outputs = self._gradient_checkpointing_func(
                     encoder_layer.__call__,
                     hidden_states,
+                    freqs_ci,
                     attention_mask,
                     output_attentions,
                 )
@@ -1445,7 +1447,7 @@ def forward(self, hidden_states):
 
 class Llama4VisionModel(Llama4PreTrainedModel):
     base_model_prefix = "vision_model"
-    _no_split_modules = ["Llama4VisionAttention"]
+    _no_split_modules = ["Llama4VisionEncoderLayer"]
     config_class = Llama4VisionConfig
 
     def __init__(self, config: Llama4VisionConfig):
@@ -1754,8 +1756,7 @@ def forward(
                 )
 
             expanded_mask = final_mask_1d.unsqueeze(-1).expand(-1, inputs_embeds.size(-1))
-            inputs_embeds.masked_scatter_(expanded_mask, projected_vision_flat)
-
+            inputs_embeds = inputs_embeds.masked_scatter(expanded_mask, projected_vision_flat)
             inputs_embeds = inputs_embeds.view(original_inputs_embeds_shape)
 
         outputs = self.language_model(
Repository: ggml-org/llama.cpp
Pull request: rpc : add command line option for number of threads for the CPU backend

closes #13051



Changed files:
filename: examples/rpc/rpc-server.cpp
patch: @@ -22,6 +22,7 @@
 
 #include "ggml-rpc.h"
 #ifdef _WIN32
+#  define NOMINMAX
 #  define DIRECTORY_SEPARATOR '\\'
 #  include <locale>
 #  include <windows.h>
@@ -37,6 +38,8 @@
 #include <stdio.h>
 #include <vector>
 #include <filesystem>
+#include <algorithm>
+#include <thread>
 
 namespace fs = std::filesystem;
 
@@ -150,12 +153,14 @@ struct rpc_server_params {
     int         port        = 50052;
     size_t      backend_mem = 0;
     bool        use_cache   = false;
+    int         n_threads   = std::max(1U, std::thread::hardware_concurrency()/2);
 };
 
 static void print_usage(int /*argc*/, char ** argv, rpc_server_params params) {
     fprintf(stderr, "Usage: %s [options]\n\n", argv[0]);
     fprintf(stderr, "options:\n");
     fprintf(stderr, "  -h, --help                show this help message and exit\n");
+    fprintf(stderr, "  -t,      --threads        number of threads for the CPU backend (default: %d)\n", params.n_threads);
     fprintf(stderr, "  -H HOST, --host HOST      host to bind to (default: %s)\n", params.host.c_str());
     fprintf(stderr, "  -p PORT, --port PORT      port to bind to (default: %d)\n", params.port);
     fprintf(stderr, "  -m MEM,  --mem MEM        backend memory size (in MB)\n");
@@ -172,6 +177,15 @@ static bool rpc_server_params_parse(int argc, char ** argv, rpc_server_params &
                 return false;
             }
             params.host = argv[i];
+        } else if (arg == "-t" || arg == "--threads") {
+            if (++i >= argc) {
+                return false;
+            }
+            params.n_threads = std::stoi(argv[i]);
+            if (params.n_threads <= 0) {
+                fprintf(stderr, "error: invalid number of threads: %d\n", params.n_threads);
+                return false;
+            }
         } else if (arg == "-p" || arg == "--port") {
             if (++i >= argc) {
                 return false;
@@ -199,7 +213,7 @@ static bool rpc_server_params_parse(int argc, char ** argv, rpc_server_params &
     return true;
 }
 
-static ggml_backend_t create_backend() {
+static ggml_backend_t create_backend(const rpc_server_params & params) {
     ggml_backend_t backend = NULL;
 #ifdef GGML_USE_CUDA
     fprintf(stderr, "%s: using CUDA backend\n", __func__);
@@ -231,6 +245,7 @@ static ggml_backend_t create_backend() {
     if (!backend) {
         fprintf(stderr, "%s: using CPU backend\n", __func__);
         backend = ggml_backend_cpu_init();
+        ggml_backend_cpu_set_n_threads(backend, params.n_threads);
     }
     return backend;
 }
@@ -275,7 +290,7 @@ int main(int argc, char * argv[]) {
         fprintf(stderr, "\n");
     }
 
-    ggml_backend_t backend = create_backend();
+    ggml_backend_t backend = create_backend(params);
     if (!backend) {
         fprintf(stderr, "Failed to create backend\n");
         return 1;
Repository: facebook/react
Pull request: Fix small typos

Hello,
I've found some minor typos in the documentation, solved with this PR.

Fix typo: 
overriden -> overridden
typechecks  -> type checks
hard coded -> hardcoded

Changed files:
filename: packages/react-devtools-shared/src/__tests__/console-test.js
patch: @@ -69,7 +69,7 @@ describe('console', () => {
     );
   }
 
-  it('should not patch console methods that are not explicitly overriden', () => {
+  it('should not patch console methods that are not explicitly overridden', () => {
     expect(fakeConsole.error).not.toBe(mockError);
     expect(fakeConsole.info).toBe(mockInfo);
     expect(fakeConsole.log).toBe(mockLog);

filename: packages/react-devtools-shared/src/backend/views/utils.js
patch: @@ -50,7 +50,7 @@ export function getBoundingClientRectWithBorderOffset(node: HTMLElement) {
       right: dimensions.borderRight,
       // This width and height won't get used by mergeRectOffsets (since this
       // is not the first rect in the array), but we set them so that this
-      // object typechecks as a ClientRect.
+      // object type checks as a ClientRect.
       width: 0,
       height: 0,
     },

filename: scripts/release/prepare-release-from-npm-commands/update-stable-version-numbers.js
patch: @@ -132,7 +132,7 @@ const run = async ({cwd, packages, version}, versionsMap) => {
   let diff = '';
   let numFilesModified = 0;
 
-  // Find-and-replace hard coded version (in built JS) for renderers.
+  // Find-and-replace hardcoded version (in built JS) for renderers.
   for (let i = 0; i < packages.length; i++) {
     const packageName = packages[i];
     const packagePath = join(nodeModulesPath, packageName);
Repository: nodejs/node
Pull request: test: fix invalid `file:` URL in `test-fs-path-dir`

Trying to build a URL by concatenating `file://` and a path will always fail as soon as the path contains some URL-significant char (e.g. `%`, `?`, `#`)
<!--
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: test/sequential/test-fs-path-dir.js
patch: @@ -5,7 +5,7 @@ const tmpdir = require('../common/tmpdir');
 const assert = require('assert');
 const path = require('path');
 const fs = require('fs');
-const URL = require('url').URL;
+const { pathToFileURL } = require('url');
 
 tmpdir.refresh();
 
@@ -15,7 +15,7 @@ const nextFile = () => path.join(tmpdir.path, `file${fileCounter++}`);
 const generateStringPath = (file, suffix = '') => file + suffix;
 
 const generateURLPath = (file, suffix = '') =>
-  new URL('file://' + path.resolve(file) + suffix);
+  pathToFileURL(file + suffix);
 
 const generateUint8ArrayPath = (file, suffix = '') =>
   new Uint8Array(Buffer.from(file + suffix));
Repository: denoland/deno
Pull request: build: update wgpu-core to unblock release

`wgpu-core` version 0.20 was yanked and it caused failure to
publish `deno_webgpu`. I bumped and published locally to
unblock the release.

Changed files:
filename: Cargo.lock
patch: @@ -7657,9 +7657,9 @@ dependencies = [
 
 [[package]]
 name = "wgpu-core"
-version = "0.20.0"
+version = "0.21.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac6a86eaa5e763e59c73cf9e97d55fffd4dfda69fd8bda19589fcf851ddfef1f"
+checksum = "d50819ab545b867d8a454d1d756b90cd5f15da1f2943334ca314af10583c9d39"
 dependencies = [
  "arrayvec",
  "bit-vec",
@@ -7686,9 +7686,9 @@ dependencies = [
 
 [[package]]
 name = "wgpu-hal"
-version = "0.20.0"
+version = "0.21.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d71c8ae05170583049b65ee562fd839fdc0b3e9ddb84f4e40c9d5f8ea0d4c8c"
+checksum = "172e490a87295564f3fcc0f165798d87386f6231b04d4548bca458cbbfd63222"
 dependencies = [
  "android_system_properties",
  "arrayvec",

filename: Cargo.toml
patch: @@ -190,7 +190,7 @@ rsa = { version = "0.9.3", default-features = false, features = ["std", "pem", "
 
 # webgpu
 raw-window-handle = "0.6.0"
-wgpu-core = "0.20"
+wgpu-core = "0.21.1"
 wgpu-types = "0.20"
 
 # macros
Repository: ggml-org/llama.cpp
Pull request: security : add note about RPC and server functionality

We are generally aware that the RPC backend and `rpc-server` are vulnerable to all sorts of attack vectors. At some point we added a notice in the README to avoid usage of the RPC functionality in sensitive environments: https://github.com/ggml-org/llama.cpp/tree/master/examples/rpc

However, we keep receiving security advisories about the RPC backend that we don't have the capacity to act upon privately. It makes more sense for the time being to resolve such vulnerabilities publicly, so that the community can help in the process.

With this change to the security policy, we categorize such issues as known vulnerabilities and recommend to skip the advisory process. My suggestion is this to be in effect until we feel more confident about the security of the RPC implementation.

Changed files:
filename: SECURITY.md
patch: @@ -40,7 +40,8 @@ To protect sensitive data from potential leaks or unauthorized access, it is cru
 ### Untrusted environments or networks
 
 If you can't run your models in a secure and isolated environment or if it must be exposed to an untrusted network, make sure to take the following security precautions:
-* Confirm the hash of any downloaded artifact (e.g. pre-trained model weights) matches a known-good value
+* Do not use the RPC backend, [rpc-server](https://github.com/ggml-org/llama.cpp/tree/master/examples/rpc) and [llama-server](https://github.com/ggml-org/llama.cpp/tree/master/examples/server) functionality (see https://github.com/ggml-org/llama.cpp/pull/13061).
+* Confirm the hash of any downloaded artifact (e.g. pre-trained model weights) matches a known-good value.
 * Encrypt your data if sending it over the network.
 
 ### Multi-Tenant environments
Repository: nodejs/node
Pull request: assert: fix deepEqual always return true on URL

Fixes: https://github.com/nodejs/node/issues/50836

Changed files:
filename: lib/internal/util/comparisons.js
patch: @@ -27,6 +27,7 @@ const {
 
 const { compare } = internalBinding('buffer');
 const assert = require('internal/assert');
+const { isURL } = require('internal/url');
 const types = require('internal/util/types');
 const {
   isAnyArrayBuffer,
@@ -287,6 +288,10 @@ function innerDeepEqual(val1, val2, strict, memos) {
     }
   } else if (isWeakMap(val1) || isWeakSet(val1)) {
     return false;
+  } else if (isURL(val1)) {
+    if (!isURL(val2) || val1.href !== val2.href) {
+      return false;
+    }
   }
 
   return keyCheck(val1, val2, strict, memos, kNoIterator);

filename: lib/internal/util/inspect.js
patch: @@ -166,6 +166,11 @@ function pathToFileUrlHref(filepath) {
   return internalUrl.pathToFileURL(filepath).href;
 }
 
+function isURL(value) {
+  internalUrl ??= require('internal/url');
+  return typeof value.href === 'string' && value instanceof internalUrl.URL;
+}
+
 const builtInObjects = new SafeSet(
   ArrayPrototypeFilter(
     ObjectGetOwnPropertyNames(globalThis),
@@ -1026,6 +1031,11 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
       if (keys.length === 0 && protoProps === undefined) {
         return base;
       }
+    } else if (isURL(value) && !(recurseTimes > ctx.depth && ctx.depth !== null)) {
+      base = value.href;
+      if (keys.length === 0 && protoProps === undefined) {
+        return base;
+      }
     } else {
       if (keys.length === 0 && protoProps === undefined) {
         if (isExternal(value)) {

filename: test/parallel/test-assert-deep.js
patch: @@ -1346,3 +1346,47 @@ test('Comparing two different WeakSet instances', () => {
   const weakSet2 = new WeakSet();
   assertNotDeepOrStrict(weakSet1, weakSet2);
 });
+
+// check URL
+{
+  const a = new URL('http://foo');
+  const b = new URL('http://bar');
+
+  assertNotDeepOrStrict(a, b);
+}
+
+{
+  const a = new URL('http://foo');
+  const b = new URL('http://foo');
+
+  assertDeepAndStrictEqual(a, b);
+}
+
+{
+  const a = new URL('http://foo');
+  const b = new URL('http://foo');
+  a.bar = 1;
+  b.bar = 2;
+  assertNotDeepOrStrict(a, b);
+}
+
+{
+  const a = new URL('http://foo');
+  const b = new URL('http://foo');
+  a.bar = 1;
+  b.bar = 1;
+  assertDeepAndStrictEqual(a, b);
+}
+
+{
+  const a = new URL('http://foo');
+  const b = new URL('http://bar');
+  assert.throws(
+    () => assert.deepStrictEqual(a, b),
+    {
+      code: 'ERR_ASSERTION',
+      name: 'AssertionError',
+      message: /http:\/\/bar/
+    }
+  );
+}
Repository: facebook/react
Pull request: Fix typos

Fix typo in renderer.js: 
dehyration -> dehydration


Fix typo in ReactTestUtils.js: 
instance -> instances

Changed files:
filename: packages/react-devtools-shared/src/backend/legacy/renderer.js
patch: @@ -716,7 +716,7 @@ export function attach(
 
     // Any time an inspected element has an update,
     // we should update the selected $r value as wel.
-    // Do this before dehyration (cleanForBridge).
+    // Do this before dehydration (cleanForBridge).
     updateSelectedElement(id);
 
     inspectedElement.context = cleanForBridge(

filename: packages/react-dom/src/test-utils/ReactTestUtils.js
patch: @@ -178,7 +178,7 @@ function findAllInRenderedTree(inst, test) {
 }
 
 /**
- * Finds all instance of components in the rendered tree that are DOM
+ * Finds all instances of components in the rendered tree that are DOM
  * components with the class name matching `className`.
  * @return {array} an array of all the matches.
  */
@@ -233,7 +233,7 @@ function findRenderedDOMComponentWithClass(root, className) {
 }
 
 /**
- * Finds all instance of components in the rendered tree that are DOM
+ * Finds all instances of components in the rendered tree that are DOM
  * components with the tag name matching `tagName`.
  * @return {array} an array of all the matches.
  */
Repository: electron/electron
Pull request: fix: devtools dock state with WCO on linux

Backport of #43490

See that PR for details.


Notes: fix devtools to allow restoring saved dock state on Linux when WCO is enabled

Changed files:
filename: shell/browser/ui/inspectable_web_contents.cc
patch: @@ -554,7 +554,7 @@ void InspectableWebContents::LoadCompleted() {
           prefs.FindString("currentDockState");
       base::RemoveChars(*current_dock_state, "\"", &dock_state_);
     }
-#if BUILDFLAG(IS_WIN)
+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
     auto* api_web_contents = api::WebContents::From(GetWebContents());
     if (api_web_contents) {
       auto* win =
Repository: electron/electron
Pull request: fix: devtools dock state with WCO on linux

#### Description of Change

Enables fix from https://github.com/electron/electron/pull/39734 for linux when WCO is enabled.

Refs https://github.com/microsoft/vscode/issues/226633

#### Release Notes

Notes: fix devtools to allow restoring saved dock state on Linux when WCO is enabled

Changed files:
filename: shell/browser/ui/inspectable_web_contents.cc
patch: @@ -550,7 +550,7 @@ void InspectableWebContents::LoadCompleted() {
           prefs.FindString("currentDockState");
       base::RemoveChars(*current_dock_state, "\"", &dock_state_);
     }
-#if BUILDFLAG(IS_WIN)
+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
     auto* api_web_contents = api::WebContents::From(GetWebContents());
     if (api_web_contents) {
       auto* win =
Repository: vercel/next.js
Pull request: Update Rspack production test manifest

This auto-generated PR updates the production integration test manifest used when testing Rspack.

Changed files:
filename: test/rspack-build-tests-manifest.json
patch: @@ -18212,6 +18212,24 @@
     "flakey": [],
     "runtimeError": false
   },
+  "test/production/app-dir/graceful-degrade-error/graceful-degrade-error-non-bot.test.ts": {
+    "passed": [
+      "graceful-degrade-error - non bot should not degrade to graceful error when chunk loading fails in ssr for non-bot user agents"
+    ],
+    "failed": [],
+    "pending": [],
+    "flakey": [],
+    "runtimeError": false
+  },
+  "test/production/app-dir/graceful-degrade-error/graceful-degrade-error.test.ts": {
+    "passed": [
+      "graceful-degrade-error should degrade to graceful error when chunk loading fails in ssr for bot"
+    ],
+    "failed": [],
+    "pending": [],
+    "flakey": [],
+    "runtimeError": false
+  },
   "test/production/app-dir/mangle-reserved/mangle-reserved.test.ts": {
     "passed": ["mangle-reserved should preserve the name"],
     "failed": [],
Repository: electron/electron
Pull request: fix: devtools dock state with WCO on linux

Backport of #43490

See that PR for details.


Notes: fix devtools to allow restoring saved dock state on Linux when WCO is enabled

Changed files:
filename: shell/browser/ui/inspectable_web_contents.cc
patch: @@ -555,7 +555,7 @@ void InspectableWebContents::LoadCompleted() {
           prefs.FindString("currentDockState");
       base::RemoveChars(*current_dock_state, "\"", &dock_state_);
     }
-#if BUILDFLAG(IS_WIN)
+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
     auto* api_web_contents = api::WebContents::From(GetWebContents());
     if (api_web_contents) {
       auto* win =
Repository: electron/electron
Pull request: fix: devtools dock state with WCO on linux

Backport of #43490

See that PR for details.


Notes: fix devtools to allow restoring saved dock state on Linux when WCO is enabled

Changed files:
filename: shell/browser/ui/inspectable_web_contents.cc
patch: @@ -551,7 +551,7 @@ void InspectableWebContents::LoadCompleted() {
           prefs.FindString("currentDockState");
       base::RemoveChars(*current_dock_state, "\"", &dock_state_);
     }
-#if BUILDFLAG(IS_WIN)
+#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
     auto* api_web_contents = api::WebContents::From(GetWebContents());
     if (api_web_contents) {
       auto* win =
Repository: vercel/next.js
Pull request: [test] Add dedicated tsconfig for test utils

We'll enable stricter type-checking in those abstractions in a follow-up.

## Test plan

- [x] fails once I enable `strictNullChecks`: https://github.com/vercel/next.js/actions/runs/14445320174/job/40504625891?pr=78142

Changed files:
filename: package.json
patch: @@ -42,7 +42,7 @@
     "lint-eslint": "cross-env ESLINT_USE_FLAT_CONFIG=false eslint . --ext js,jsx,mjs,ts,tsx,mts,mdx --config .eslintrc.json --no-eslintrc",
     "lint-ast-grep": "ast-grep scan",
     "lint-no-typescript": "run-p prettier-check lint-eslint lint-language",
-    "types-and-precompiled": "run-p lint-typescript check-precompiled validate-externals-doc check-compiler-fixtures",
+    "types-and-precompiled": "run-p lint-typescript check-precompiled validate-externals-doc check-compiler-fixtures types:test-lib",
     "check-compiler-fixtures": "find crates/next-custom-transforms/tests/fixture -type f -name 'tsconfig.json' -exec /bin/sh -c 'echo \"project: $1\"; pnpm tsc --noEmit --project \"$1\"' -- {} \\;",
     "validate-externals-doc": "node ./scripts/validate-externals-doc.js",
     "lint": "run-p test-types lint-typescript prettier-check lint-eslint lint-ast-grep lint-language",
@@ -53,6 +53,7 @@
     "get-test-timings": "node run-tests.js --timings --write-timings -g 1/1",
     "prettier-fix": "prettier --write .",
     "types": "lerna run types --stream",
+    "types:test-lib": "tsc --project test/lib/tsconfig.json",
     "check-precompiled": "./scripts/check-pre-compiled.sh",
     "prepublishOnly": "turbo run build",
     "lint-staged": "lint-staged",

filename: test/lib/tsconfig.json
patch: @@ -0,0 +1,7 @@
+{
+  "extends": "../../tsconfig.json",
+  "include": ["./**/*.ts"],
+  "compilerOptions": {
+    "strictNullChecks": false
+  }
+}