helloadhavan/github_issues huggingface dataset:
Repository: huggingface/transformers
Pull request: Fix duplicated weights in fp8 quantization

# What does this PR do?

https://github.com/huggingface/transformers/pull/35926 moved the fp8 params from buffers to parameters (which makes sense), but the quantizer itself was not updated, so the parameters would still be added as buffers leading to duplicated weights (they would live as both buffers and parameters).

Also, note that we SHOULD NEVER use `set_module_tensor_to_device` as it clears the cuda cache at each call which is really inefficient, and defeats all the purpose of cuda warmup we do in `from_pretrained`

cc @SunMarc @MekkCyber 


Changed files:
filename: src/transformers/quantizers/quantizer_finegrained_fp8.py
patch: @@ -91,11 +91,9 @@ def create_quantized_param(
         """
         Quantizes weights to FP8 format using Block-wise quantization
         """
-        from accelerate.utils import set_module_tensor_to_device
+        from ..modeling_utils import _load_parameter_into_model
 
-        set_module_tensor_to_device(model, param_name, target_device, param_value)
-
-        module, tensor_name = get_module_from_name(model, param_name)
+        param_value = param_value.to(target_device)
 
         # Get FP8 min/max values
         fp8_min = torch.finfo(torch.float8_e4m3fn).min
@@ -131,8 +129,9 @@ def create_quantized_param(
         # Reshape scale to match the number of blocks
         scale = scale.reshape(scale_orig_shape).squeeze().reciprocal()
 
-        module._buffers[tensor_name] = quantized_param.to(target_device)
-        module._buffers["weight_scale_inv"] = scale.to(target_device)
+        # Load into the model
+        _load_parameter_into_model(model, param_name, quantized_param)
+        _load_parameter_into_model(model, param_name.rsplit(".", 1)[0] + ".weight_scale_inv", scale)
 
     def check_quantized_param(
         self,
Repository: denoland/deno
Pull request: feat: support DENO_LOG env var instead of RUST_LOG

Instead of `RUST_LOG` env var, we now support `DENO_LOG` env var.
This is done to be able to set a setting specific to `deno` that wouldn't impact
other binaries written in Rust.

Ref https://github.com/denoland/deno/issues/10558#issuecomment-2324300211



Changed files:
filename: cli/util/logger.rs
patch: @@ -41,8 +41,10 @@ impl log::Log for CliLogger {
 pub fn init(maybe_level: Option<log::Level>) {
   let log_level = maybe_level.unwrap_or(log::Level::Info);
   let logger = env_logger::Builder::from_env(
-    env_logger::Env::default()
-      .default_filter_or(log_level.to_level_filter().to_string()),
+    env_logger::Env::new()
+      // Use `DENO_LOG` and `DENO_LOG_STYLE` instead of `RUST_` prefix
+      .filter_or("DENO_LOG", log_level.to_level_filter().to_string())
+      .write_style("DENO_LOG_STYLE"),
   )
   // https://github.com/denoland/deno/issues/6641
   .filter_module("rustyline", log::LevelFilter::Off)

filename: tests/integration/run_tests.rs
patch: @@ -2499,8 +2499,8 @@ fn should_not_panic_on_undefined_deno_dir_and_home_environment_variables() {
 }
 
 #[test]
-fn rust_log() {
-  // Without RUST_LOG the stderr is empty.
+fn deno_log() {
+  // Without DENO_LOG the stderr is empty.
   let output = util::deno_cmd()
     .current_dir(util::testdata_path())
     .arg("run")
@@ -2513,12 +2513,12 @@ fn rust_log() {
   assert!(output.status.success());
   assert!(output.stderr.is_empty());
 
-  // With RUST_LOG the stderr is not empty.
+  // With DENO_LOG the stderr is not empty.
   let output = util::deno_cmd()
     .current_dir(util::testdata_path())
     .arg("run")
     .arg("run/001_hello.js")
-    .env("RUST_LOG", "debug")
+    .env("DENO_LOG", "debug")
     .stderr_piped()
     .spawn()
     .unwrap()
Repository: vercel/next.js
Pull request: [dev-overlay] Consider scrollbar width for drag positioning

This PR fixes a small bug with the dragging logic established in #78716

Namely, I didn't take into account the scrollbar width when calculating `translate` for each corner. So if the page was scrollable the drag end would be a bit janky:


https://github.com/user-attachments/assets/17e227e9-7af1-4ab8-91b2-b7cc4d363793

After this PR, the snapping is much smoother with no jank:


https://github.com/user-attachments/assets/06021fae-da61-46b3-b224-11f319835fa3



Changed files:
filename: packages/next/src/client/components/react-dev-overlay/ui/components/errors/dev-tools-indicator/draggable.tsx
patch: @@ -73,13 +73,17 @@ export function Draggable({
     const offset = padding * 2
     const triggerWidth = ref.current?.offsetWidth || 0
     const triggerHeight = ref.current?.offsetHeight || 0
+    const scrollbarWidth =
+      window.innerWidth - document.documentElement.clientWidth
 
     function getAbsolutePosition(corner: Corners) {
       const isRight = corner.includes('right')
       const isBottom = corner.includes('bottom')
 
       return {
-        x: isRight ? window.innerWidth - offset - triggerWidth : 0,
+        x: isRight
+          ? window.innerWidth - scrollbarWidth - offset - triggerWidth
+          : 0,
         y: isBottom ? window.innerHeight - offset - triggerHeight : 0,
       }
     }
@@ -93,15 +97,25 @@ export function Draggable({
         y: 0 - basePosition.y,
       },
       'top-right': {
-        x: window.innerWidth - offset - triggerWidth - basePosition.x,
+        x:
+          window.innerWidth -
+          scrollbarWidth -
+          offset -
+          triggerWidth -
+          basePosition.x,
         y: 0 - basePosition.y,
       },
       'bottom-left': {
         x: 0 - basePosition.x,
         y: window.innerHeight - offset - triggerHeight - basePosition.y,
       },
       'bottom-right': {
-        x: window.innerWidth - offset - triggerWidth - basePosition.x,
+        x:
+          window.innerWidth -
+          scrollbarWidth -
+          offset -
+          triggerWidth -
+          basePosition.x,
         y: window.innerHeight - offset - triggerHeight - basePosition.y,
       },
     }
Repository: ggml-org/llama.cpp
Pull request: hparams : support models for which all layers use SWA

ref https://github.com/ggml-org/llama.cpp/pull/13676#discussion_r2099898349

`n_swa_pattern == 0` now corresponds to all layers in the model using SWA.

Changed files:
filename: src/llama-hparams.cpp
patch: @@ -72,7 +72,7 @@ uint32_t llama_hparams::n_embd_v_s() const {
 
 bool llama_hparams::is_swa(uint32_t il) const {
     if (il < n_layer) {
-        return n_swa > 0 && n_swa_pattern > 0 && il % n_swa_pattern < (n_swa_pattern - 1);
+        return n_swa_pattern == 0 || (il % n_swa_pattern < (n_swa_pattern - 1));
     }
 
     GGML_ABORT("fatal error");

filename: src/llama-hparams.h
patch: @@ -104,7 +104,18 @@ struct llama_hparams {
     llama_swa_type swa_type = LLAMA_SWA_TYPE_NONE;
 
     uint32_t n_swa = 0;         // the size of the sliding window (0 - no SWA)
-    uint32_t n_swa_pattern = 1; // by default, all layers use non-sliding-window attention
+    uint32_t n_swa_pattern = 1; // this value n means that every nth layer is dense (i.e. non-SWA)
+                                // by default n == 1, all layers are dense
+                                // note that if n_swa_pattern == 0, all layers are SWA
+                                // example: n_swa_pattern = 3
+                                //   il == 0: swa
+                                //   il == 1: swa
+                                //   il == 2: dense
+                                //   il == 3: swa
+                                //   il == 4: swa
+                                //   il == 5: dense
+                                //   il == 6: swa
+                                //   etc ...
 
     // for State Space Models
     uint32_t ssm_d_conv  = 0;
Repository: facebook/react
Pull request: explain the rationale for the chosen escaping implemenation in a comment

Clarifies the why of #24385 with an explanatory comment


Changed files:
filename: packages/react-dom/src/server/ReactDOMServerFormatConfig.js
patch: @@ -83,16 +83,25 @@ const startScriptSrc = stringToPrecomputedChunk('<script src="');
 const startModuleSrc = stringToPrecomputedChunk('<script type="module" src="');
 const endAsyncScript = stringToPrecomputedChunk('" async=""></script>');
 
-const scriptRegex = /(<\/|<)(s)(cript)/gi;
-const scriptReplacer = (match, prefix, s, suffix) =>
-  `${prefix}${s === 's' ? '\\u0073' : '\\u0053'}${suffix}`;
-
+/**
+ * This escaping function is designed to work with bootstrapScriptContent only.
+ * because we know we are escaping the entire script. We can avoid for instance
+ * escaping html comment string sequences that are valid javascript as well because
+ * if there are no sebsequent <script sequences the html parser will never enter
+ * script data double escaped state (see: https://www.w3.org/TR/html53/syntax.html#script-data-double-escaped-state)
+ *
+ * While untrusted script content should be made safe before using this api it will
+ * ensure that the script cannot be early terminated or never terminated state
+ */
 function escapeBootstrapScriptContent(scriptText) {
   if (__DEV__) {
     checkHtmlStringCoercion(scriptText);
   }
   return ('' + scriptText).replace(scriptRegex, scriptReplacer);
 }
+const scriptRegex = /(<\/|<)(s)(cript)/gi;
+const scriptReplacer = (match, prefix, s, suffix) =>
+  `${prefix}${s === 's' ? '\\u0073' : '\\u0053'}${suffix}`;
 
 // Allows us to keep track of what we've already written so we can refer back to it.
 export function createResponseState(
Repository: electron/electron
Pull request: fix: `createWindow` shouldn't load URL for `webContents`

Backport of #43775

See that PR for details.


Notes: Fixed a potential issue accessing a child window document when overriding browserWindow creation via `setWindowOpenHandler`.

Changed files:
filename: lib/browser/guest-window-manager.ts
patch: @@ -71,14 +71,6 @@ export function openGuestWindow ({ embedder, guest, referrer, disposition, postD
         throw new Error('Invalid webContents. Created window should be connected to webContents passed with options object.');
       }
 
-      webContents.loadURL(url, {
-        httpReferrer: referrer,
-        ...(postData && {
-          postData,
-          extraHeaders: formatPostDataHeaders(postData as Electron.UploadRawData[])
-        })
-      });
-
       handleWindowLifecycleEvents({ embedder, frameName, guest, outlivesOpener });
     }
 

filename: spec/guest-window-manager-spec.ts
patch: @@ -231,6 +231,10 @@ describe('webContents.setWindowOpenHandler', () => {
             response.statusCode = 200;
             response.end('<title>Child page</title>');
             break;
+          case '/test':
+            response.statusCode = 200;
+            response.end('<title>Test page</title>');
+            break;
           default:
             throw new Error(`Unsupported endpoint: ${request.url}`);
         }
@@ -303,6 +307,32 @@ describe('webContents.setWindowOpenHandler', () => {
       expect(childWindow.title).to.equal(browserWindowTitle);
     });
 
+    it('should be able to access the child window document when createWindow is provided', async () => {
+      browserWindow.webContents.setWindowOpenHandler(() => {
+        return {
+          action: 'allow',
+          createWindow: (options) => {
+            const child = new BrowserWindow(options);
+            return child.webContents;
+          }
+        };
+      });
+
+      const aboutBlankTitle = await browserWindow.webContents.executeJavaScript(`
+        const win1 = window.open('about:blank', '', 'show=no');
+        win1.document.title = 'about-blank-title';
+        win1.document.title;
+      `);
+      expect(aboutBlankTitle).to.equal('about-blank-title');
+
+      const serverPageTitle = await browserWindow.webContents.executeJavaScript(`
+        const win2 = window.open('${url}/child', '', 'show=no');
+        win2.document.title = 'server-page-title';
+        win2.document.title;
+      `);
+      expect(serverPageTitle).to.equal('server-page-title');
+    });
+
     it('spawns browser window with overridden options', async () => {
       const childWindow = await new Promise<Electron.BrowserWindow>(resolve => {
         browserWindow.webContents.setWindowOpenHandler(() => {
Repository: ggml-org/llama.cpp
Pull request: server : improve error reporting

On `master` even when the computation fails due to lack of system resources, we send an error to the client that states "Input prompt is too big ..." which is confusing.

We now send error messages that correspond better to the error codes of `llama_decode()`.

Changed files:
filename: tools/server/server.cpp
patch: @@ -3366,14 +3366,29 @@ struct server_context {
             metrics.on_decoded(slots);
 
             if (ret != 0) {
-                if (n_batch == 1 || ret < 0) {
-                    // if you get here, it means the KV cache is full - try increasing it via the context size
-                    SRV_ERR("failed to decode the batch: KV cache is full - try increasing it via the context size, i = %d, n_batch = %d, ret = %d\n", i, n_batch, ret);
-                    for (auto & slot : slots) {
-                        slot.release();
-                        send_error(slot, "Input prompt is too big compared to KV size. Please try increasing KV size.");
+                {
+                    std::string err;
+
+                    if (n_batch == 1 && ret == 1) {
+                        err = "Context size has been exceeded.";
+                    }
+
+                    if (ret == -1) {
+                        err = "Invalid input batch.";
+                    }
+
+                    if (ret < -1) {
+                        err = "Compute error.";
+                    }
+
+                    if (!err.empty()) {
+                        SRV_ERR("%s, i = %d, n_batch = %d, ret = %d\n", err.c_str(), i, n_batch, ret);
+                        for (auto & slot : slots) {
+                            slot.release();
+                            send_error(slot, err);
+                        }
+                        break;
                     }
-                    break; // break loop of n_batch
                 }
 
                 // retry with half the batch size to try to find a free slot in the KV cache
Repository: denoland/deno
Pull request: BREAKING: remove `--trace-ops`

Towards #22079

Changed files:
filename: cli/args/flags.rs
patch: @@ -2784,14 +2784,6 @@ Directory arguments are expanded to all contained files matching the glob
           .action(ArgAction::SetTrue)
           .help_heading(TEST_HEADING),
       )
-      .arg(
-        Arg::new("trace-ops")
-          .long("trace-ops")
-          .help("Deprecated alias for --trace-leaks")
-          .hide(true)
-          .action(ArgAction::SetTrue)
-          .help_heading(TEST_HEADING),
-      )
       .arg(
         Arg::new("trace-leaks")
           .long("trace-leaks")
@@ -4662,20 +4654,7 @@ fn test_parse(flags: &mut Flags, matches: &mut ArgMatches) {
   };
 
   let no_run = matches.get_flag("no-run");
-  let trace_leaks =
-    matches.get_flag("trace-ops") || matches.get_flag("trace-leaks");
-
-  #[allow(clippy::print_stderr)]
-  if trace_leaks && matches.get_flag("trace-ops") {
-    // We can't change this to use the log crate because its not configured
-    // yet at this point since the flags haven't been parsed. This flag is
-    // deprecated though so it's not worth changing the code to use the log
-    // crate here and this is only done for testing anyway.
-    eprintln!(
-      "⚠️ {}",
-      crate::colors::yellow("The `--trace-ops` flag is deprecated and will be removed in Deno 2.0.\nUse the `--trace-leaks` flag instead."),
-    );
-  }
+  let trace_leaks = matches.get_flag("trace-leaks");
   let doc = matches.get_flag("doc");
   #[allow(clippy::print_stderr)]
   let allow_none = matches.get_flag("permit-no-files")

filename: tests/integration/test_tests.rs
patch: @@ -251,7 +251,7 @@ itest!(allow_none {
 });
 
 itest!(ops_sanitizer_unstable {
-  args: "test --trace-ops test/sanitizer/ops_sanitizer_unstable.ts",
+  args: "test --trace-leaks test/sanitizer/ops_sanitizer_unstable.ts",
   exit_code: 1,
   output: "test/sanitizer/ops_sanitizer_unstable.out",
 });

filename: tests/testdata/test/sanitizer/ops_sanitizer_unstable.out
patch: @@ -1,5 +1,3 @@
-⚠️ The `--trace-ops` flag is deprecated and will be removed in Deno 2.0.
-Use the `--trace-leaks` flag instead.
 Check [WILDCARD]/ops_sanitizer_unstable.ts
 running 2 tests from [WILDCARD]/ops_sanitizer_unstable.ts
 no-op ... ok ([WILDCARD])
Repository: vercel/next.js
Pull request: fix(turbopack): Backport sourcemap bugfix

https://github.com/vercel/next.js/pull/78453 is a bugfix for sourcemap on windows

Closes PACK-4537

Changed files:
filename: turbopack/crates/turbo-tasks-fs/src/lib.rs
patch: @@ -1278,6 +1278,10 @@ impl FileSystemPath {
     /// None when the joined path would leave the filesystem root.
     #[turbo_tasks::function]
     pub async fn try_join(&self, path: RcStr) -> Result<Vc<FileSystemPathOption>> {
+        // TODO(PACK-3279): Remove this once we do not produce invalid paths at the first place.
+        #[cfg(target_os = "windows")]
+        let path = path.replace('\\', "/");
+
         if let Some(path) = join_path(&self.path, &path) {
             Ok(Vc::cell(Some(
                 Self::new_normalized(*self.fs, path.into())

filename: turbopack/crates/turbo-tasks-fs/src/util.rs
patch: @@ -138,6 +138,7 @@ pub fn extract_disk_access<T>(value: io::Result<T>, path: &Path) -> Result<Optio
     }
 }
 
+#[cfg(not(target_os = "windows"))]
 pub async fn uri_from_file(root: Vc<FileSystemPath>, path: Option<&str>) -> Result<String> {
     let root_fs = root.fs();
     let root_fs = &*Vc::try_resolve_downcast_type::<DiskFileSystem>(root_fs)
@@ -162,3 +163,34 @@ pub async fn uri_from_file(root: Vc<FileSystemPath>, path: Option<&str>) -> Resu
         .join("/")
     ))
 }
+
+#[cfg(target_os = "windows")]
+pub async fn uri_from_file(root: Vc<FileSystemPath>, path: Option<&str>) -> Result<String> {
+    let root_fs = root.fs();
+    let root_fs = &*Vc::try_resolve_downcast_type::<DiskFileSystem>(root_fs)
+        .await?
+        .context("Expected root to have a DiskFileSystem")?
+        .await?;
+
+    let sys_path = root_fs
+        .to_sys_path(match path {
+            Some(path) => root.join(path.into()),
+            None => root,
+        })
+        .await?;
+
+    let raw_path = sys_path.to_string_lossy().to_string();
+    let normalized_path = raw_path.replace('\\', "/");
+
+    let mut segments = normalized_path.split('/');
+
+    let first = segments.next().unwrap_or_default(); // e.g., "C:"
+    let encoded_path = std::iter::once(first.to_string()) // keep "C:" intact
+        .chain(segments.map(|s| urlencoding::encode(s).into_owned()))
+        .collect::<Vec<_>>()
+        .join("/");
+
+    let uri = format!("file:///{}", encoded_path);
+
+    Ok(uri)
+}
Repository: vercel/next.js
Pull request: fix(react-compiler): Fix detection of interest

Backport of #78874 to 15.3.x


Changed files:
filename: crates/next-custom-transforms/src/react_compiler.rs
patch: @@ -1,5 +1,5 @@
 use swc_core::ecma::{
-    ast::{Callee, Expr, FnDecl, FnExpr, Program, ReturnStmt},
+    ast::{Callee, Expr, FnDecl, FnExpr, Pat, Program, ReturnStmt, VarDeclarator},
     visit::{Visit, VisitWith},
 };
 
@@ -68,4 +68,19 @@ impl Visit for Finder {
 
         node.visit_children_with(self);
     }
+
+    fn visit_var_declarator(&mut self, node: &VarDeclarator) {
+        let old = self.is_interested;
+
+        if let Pat::Ident(ident) = &node.name {
+            self.is_interested = ident.sym.starts_with("use")
+                || ident.sym.starts_with(|c: char| c.is_ascii_uppercase());
+        } else {
+            self.is_interested = false;
+        }
+
+        node.visit_children_with(self);
+
+        self.is_interested = old;
+    }
 }
Repository: ggml-org/llama.cpp
Pull request: convert : add qwen2vl support for unsloth merges

Add support for 'Qwen2VLModel' keyword in merged config.json files of the Unsloth library

Changed files:
filename: convert_hf_to_gguf.py
patch: @@ -2645,7 +2645,7 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
         yield from super().modify_tensors(data_torch, name, bid)
 
 
-@ModelBase.register("Qwen2VLForConditionalGeneration", "Qwen2_5_VLForConditionalGeneration")
+@ModelBase.register("Qwen2VLModel", "Qwen2VLForConditionalGeneration", "Qwen2_5_VLForConditionalGeneration")
 class Qwen2VLModel(TextModel):
     model_arch = gguf.MODEL_ARCH.QWEN2VL
 
@@ -2669,7 +2669,7 @@ def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iter
         return [(self.map_tensor_name(name), data_torch)]
 
 
-@ModelBase.register("Qwen2VLForConditionalGeneration", "Qwen2_5_VLForConditionalGeneration")
+@ModelBase.register("Qwen2VLModel", "Qwen2VLForConditionalGeneration", "Qwen2_5_VLForConditionalGeneration")
 class Qwen2VLVisionModel(VisionModel):
     def __init__(self, *args, **kwargs):
         super().__init__(*args, **kwargs)
Repository: facebook/react
Pull request: Synchronize implementations of second render logging

<!--
  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

Minor followup to https://github.com/facebook/react/pull/24373. The fix for https://github.com/facebook/react/pull/24373#discussion_r849992177 didn't get synchronized to the hook implementation.

cc @lunaruan 


Changed files:
filename: packages/react-devtools-shared/src/backend/utils.js
patch: @@ -187,7 +187,7 @@ export function formatWithStyles(
     return inputArgs;
   }
 
-  // Matches any of %(o|O|i|s|f), but not %%(o|O|i|s|f)
+  // Matches any of %(o|O|d|i|s|f), but not %%(o|O|d|i|s|f)
   const REGEXP = /([^%]|^)(%([oOdisf]))/g;
   if (inputArgs[0].match(REGEXP)) {
     return [`%c${inputArgs[0]}`, style, ...inputArgs.slice(1)];

filename: packages/react-devtools-shared/src/hook.js
patch: @@ -180,13 +180,16 @@ export function installHook(target: any): DevToolsHook | null {
       inputArgs === undefined ||
       inputArgs === null ||
       inputArgs.length === 0 ||
-      (typeof inputArgs[0] === 'string' && inputArgs[0].includes('%c')) ||
+      // Matches any of %c but not %%c
+      (typeof inputArgs[0] === 'string' &&
+        inputArgs[0].match(/([^%]|^)(%c)/g)) ||
       style === undefined
     ) {
       return inputArgs;
     }
 
-    const REGEXP = /(%?)(%([oOdisf]))/g;
+    // Matches any of %(o|O|d|i|s|f), but not %%(o|O|d|i|s|f)
+    const REGEXP = /([^%]|^)(%([oOdisf]))/g;
     if (inputArgs[0].match(REGEXP)) {
       return [`%c${inputArgs[0]}`, style, ...inputArgs.slice(1)];
     } else {