helloadhavan/github_issues huggingface dataset:
Repository: huggingface/transformers
Pull request: Ensure positive warm-up size

# What does this PR do?

cc @qubvel @ydshieh for viz 🤗

Changed files:
filename: src/transformers/modeling_utils.py
patch: @@ -5898,7 +5898,7 @@ def caching_allocator_warmup(model: PreTrainedModel, expanded_device_map: Dict,
             # to OOM. See https://github.com/huggingface/transformers/issues/37436#issuecomment-2808982161 for more details.
             # Note that we use an absolute value instead of device proportion here, as a 8GiB device could still allocate too much
             # if using e.g. 90% of device size, while a 140GiB device would allocate too little
-            byte_count = min(byte_count, int(device_memory - 1.2 * 1024**3))
+            byte_count = min(byte_count, max(0, int(device_memory - 1.2 * 1024**3)))
         # Allocate memory
         _ = torch.empty(byte_count // factor, dtype=torch.float16, device=device, requires_grad=False)
Repository: ggml-org/llama.cpp
Pull request: Add --parse-special for enabling parsing of special tokens in imatrix calculation

There's been talks lately of trying to parse special tokens with imatrix tokenization to try to yield better overall results

I'm not positive yet if this will actually provide a true benefit, but I think it's definitely worth fully investigating, and adding a flag for it will make it far easier for everyone who wants to try parsing special tokens to do so

Changed files:
filename: common/arg.cpp
patch: @@ -2627,6 +2627,13 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
             params.i_chunk = value;
         }
     ).set_examples({LLAMA_EXAMPLE_IMATRIX}));
+    add_opt(common_arg(
+        {"--parse-special"},
+        string_format("prase special tokens (chat, tool, etc) (default: %s)", params.parse_special ? "true" : "false"),
+        [](common_params & params) {
+            params.parse_special = true;
+        }
+    ).set_examples({LLAMA_EXAMPLE_IMATRIX}));
     add_opt(common_arg(
         {"-pps"},
         string_format("is the prompt shared across parallel sequences (default: %s)", params.is_pp_shared ? "true" : "false"),

filename: common/common.h
patch: @@ -409,6 +409,7 @@ struct common_params {
 
     bool process_output = false; // collect data for the output tensor
     bool compute_ppl    = true;  // whether to compute perplexity
+    bool parse_special  = false; // whether to parse special tokens during imatrix tokenization
 
     // cvector-generator params
     int n_pca_batch = 100;

filename: tools/imatrix/imatrix.cpp
patch: @@ -24,7 +24,8 @@ static void print_usage(int, char ** argv) {
     LOG("\n    %s \\\n"
             "       -m model.gguf -f some-text.txt [-o imatrix.dat] [--process-output] \\\n"
             "       [--no-ppl] [--chunk 123] [--output-frequency 10] [--save-frequency 0] \\\n"
-            "       [--in-file imatrix-prev-0.dat --in-file imatrix-prev-1.dat ...]\n" , argv[0]);
+            "       [--in-file imatrix-prev-0.dat --in-file imatrix-prev-1.dat ...] \\\n"
+            "       [--parse-special]\n" , argv[0]);
     LOG("\n");
 }
 
@@ -439,7 +440,7 @@ static bool compute_imatrix(llama_context * ctx, const common_params & params) {
     auto tim1 = std::chrono::high_resolution_clock::now();
     LOG_INF("%s: tokenizing the input ..\n", __func__);
 
-    std::vector<llama_token> tokens = common_tokenize(ctx, params.prompt, true);
+    std::vector<llama_token> tokens = common_tokenize(ctx, params.prompt, true, params.parse_special);
 
     auto tim2 = std::chrono::high_resolution_clock::now();
     LOG_INF("%s: tokenization took %g ms\n",__func__,1e-3*std::chrono::duration_cast<std::chrono::microseconds>(tim2-tim1).count());
Repository: facebook/react
Pull request: Bump next versions to prepare for rc.1


Changed files:
filename: ReactVersions.js
patch: @@ -18,26 +18,26 @@
 //
 //   0.0.0-experimental-241c4467e-20200129
 
-const ReactVersion = '18.0.0-rc.0';
+const ReactVersion = '18.0.0-rc.1';
 
 // The label used by the @next channel. Represents the upcoming release's
 // stability. Could be "alpha", "beta", "rc", etc.
 const nextChannelLabel = 'next';
 
 const stablePackages = {
   'create-subscription': ReactVersion,
-  'eslint-plugin-react-hooks': '4.2.1-rc.0',
-  'jest-react': '0.12.1-rc.0',
+  'eslint-plugin-react-hooks': '4.2.1-rc.1',
+  'jest-react': '0.12.1-rc.1',
   react: ReactVersion,
   'react-art': ReactVersion,
   'react-dom': ReactVersion,
   'react-is': ReactVersion,
-  'react-reconciler': '0.27.0-rc.0',
-  'react-refresh': '0.11.0-rc.0',
+  'react-reconciler': '0.27.0-rc.1',
+  'react-refresh': '0.11.0-rc.1',
   'react-test-renderer': ReactVersion,
-  'use-subscription': '1.6.0-rc.0',
-  'use-sync-external-store': '1.0.0-rc.0',
-  scheduler: '0.21.0-rc.0',
+  'use-subscription': '1.6.0-rc.1',
+  'use-sync-external-store': '1.0.0-rc.1',
+  scheduler: '0.21.0-rc.1',
 };
 
 // These packages do not exist in the @next or @latest channel, only
Repository: denoland/deno
Pull request: fix(ext/node): createBrotliCompress params

Fixes https://github.com/denoland/deno/issues/24416


Changed files:
filename: ext/node/polyfills/_brotli.js
patch: @@ -3,9 +3,11 @@
 import { core, primordials } from "ext:core/mod.js";
 const {
   Uint8Array,
+  Number,
   PromisePrototypeThen,
   PromisePrototypeCatch,
-  ObjectValues,
+  ObjectEntries,
+  ArrayPrototypeMap,
   TypedArrayPrototypeSlice,
   TypedArrayPrototypeSubarray,
   TypedArrayPrototypeGetByteLength,
@@ -114,7 +116,11 @@ export class BrotliCompress extends Transform {
       },
     });
 
-    const params = ObjectValues(options?.params ?? {});
+    const params = ArrayPrototypeMap(
+      ObjectEntries(options?.params ?? {}),
+      // Undo the stringification of the keys
+      (o) => [Number(o[0]), o[1]],
+    );
     this.#context = op_create_brotli_compress(params);
     const context = this.#context;
   }

filename: tests/unit_node/zlib_test.ts
patch: @@ -191,3 +191,22 @@ Deno.test("brotli decompress flush restore size", async () => {
   );
   assertEquals(output.length, input.length);
 });
+
+Deno.test("createBrotliCompress params", async () => {
+  const compress = createBrotliCompress({
+    params: {
+      [constants.BROTLI_PARAM_QUALITY]: 11,
+    },
+  });
+
+  const input = new Uint8Array(10000);
+  for (let i = 0; i < input.length; i++) {
+    input[i] = Math.random() * 256;
+  }
+  const output = await buffer(
+    Readable.from([input])
+      .pipe(compress)
+      .pipe(createBrotliDecompress()),
+  );
+  assertEquals(output.length, input.length);
+});
Repository: facebook/react
Pull request: Add more warnings for second argument to root.render.

We already had one for callbacks but containers is also an easy mistake.

cc @gnoff

Changed files:
filename: packages/react-dom/src/__tests__/ReactDOMRoot-test.js
patch: @@ -51,6 +51,37 @@ describe('ReactDOMRoot', () => {
     expect(callback).not.toHaveBeenCalled();
   });
 
+  it('warn if a container is passed to root.render(...)', async () => {
+    function App() {
+      return 'Child';
+    }
+
+    const root = ReactDOM.createRoot(container);
+    expect(() => root.render(<App />, {})).toErrorDev(
+      'You passed a second argument to root.render(...) but it only accepts ' +
+        'one argument.',
+      {
+        withoutStack: true,
+      },
+    );
+  });
+
+  it('warn if a container is passed to root.render(...)', async () => {
+    function App() {
+      return 'Child';
+    }
+
+    const root = ReactDOM.createRoot(container);
+    expect(() => root.render(<App />, container)).toErrorDev(
+      'You passed a container to the second argument of root.render(...). ' +
+        "You don't need to pass it again since you already passed it to create " +
+        'the root.',
+      {
+        withoutStack: true,
+      },
+    );
+  });
+
   it('warns if a callback parameter is provided to unmount', () => {
     const callback = jest.fn();
     const root = ReactDOM.createRoot(container);

filename: packages/react-dom/src/client/ReactDOMRoot.js
patch: @@ -104,7 +104,18 @@ ReactDOMHydrationRoot.prototype.render = ReactDOMRoot.prototype.render = functio
         'render(...): does not support the second callback argument. ' +
           'To execute a side effect after rendering, declare it in a component body with useEffect().',
       );
+    } else if (isValidContainer(arguments[1])) {
+      console.error(
+        'You passed a container to the second argument of root.render(...). ' +
+          "You don't need to pass it again since you already passed it to create the root.",
+      );
+    } else if (typeof arguments[1] !== 'undefined') {
+      console.error(
+        'You passed a second argument to root.render(...) but it only accepts ' +
+          'one argument.',
+      );
     }
+
     const container = root.containerInfo;
 
     if (container.nodeType !== COMMENT_NODE) {
Repository: huggingface/transformers
Pull request: Fix qwen2audio wanr -> warn

# What does this PR do?

Fixes a typo for `warnings.wanr` -. `warnings.warn` in the qwen2 audio processor. Should not really be reachable because of the deprecation decorator, but maybe still nice to fix anyway!


## Before submitting
- [x] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [ ] 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?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

 @eustlb

Changed files:
filename: src/transformers/models/qwen2_audio/processing_qwen2_audio.py
patch: @@ -105,12 +105,12 @@ def __call__(
                 The audio or batch of audios to be prepared. Each audio can be a NumPy array.
         """
 
-        # Handle BC when user passes deprecared keyword argument
+        # Handle BC when user passes deprecated keyword argument
         if audios is not None and audio is None:
             audio = audios
-            warnings.wanr(
+            warnings.warn(
                 "You may have used the keyword argument for the `audio` inputs. It is strongly recommended to pass inputs with keyword arguments "
-                "with keys `audio` and `text`. From transformers v4.55 `audio` will be the onle acceptable keyword argument.",
+                "with keys `audio` and `text`. From transformers v4.55 `audio` will be the only acceptable keyword argument.",
                 FutureWarning,
             )
Repository: nodejs/node
Pull request: test: remove exludes for sea tests on PPC

The referenced issue is closed as having been
fixed, so the tests should run ok. Unexclude them.

<!--
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/sequential.status
patch: @@ -52,14 +52,3 @@ test-watch-mode-inspect: SKIP
 [$arch==s390x]
 # https://github.com/nodejs/node/issues/41286
 test-performance-eventloopdelay: PASS, FLAKY
-
-[$system==linux && $arch==ppc64]
-# https://github.com/nodejs/node/issues/50740
-test-single-executable-application-assets-raw: PASS, FLAKY
-test-single-executable-application-assets: PASS, FLAKY
-test-single-executable-application-disable-experimental-sea-warning: PASS, FLAKY
-test-single-executable-application-empty: PASS, FLAKY
-test-single-executable-application-snapshot-and-code-cache: PASS, FLAKY
-test-single-executable-application-snapshot: PASS, FLAKY
-test-single-executable-application-use-code-cache: PASS, FLAKY
-test-single-executable-application: PASS, FLAKY
Repository: denoland/deno
Pull request: fix(ext/node): use pem private keys in createPublicKey


Changed files:
filename: ext/node/ops/crypto/keys.rs
patch: @@ -522,7 +522,7 @@ impl KeyObjectHandle {
     key: &[u8],
     format: &str,
     typ: &str,
-    _passphrase: Option<&[u8]>,
+    passphrase: Option<&[u8]>,
   ) -> Result<KeyObjectHandle, AnyError> {
     let document = match format {
       "pem" => {
@@ -542,23 +542,22 @@ impl KeyObjectHandle {
             Document::from_pkcs1_der(document.as_bytes())
               .map_err(|_| type_error("invalid PKCS#1 public key"))?
           }
-          EncryptedPrivateKeyInfo::PEM_LABEL => {
-            // FIXME
-            return Err(type_error(
-              "deriving public key from encrypted private key",
-            ));
-          }
-          PrivateKeyInfo::PEM_LABEL => {
-            // FIXME
-            return Err(type_error("public key cannot be a private key"));
-          }
-          sec1::EcPrivateKey::PEM_LABEL => {
-            // FIXME
-            return Err(type_error("deriving public key from ec private key"));
-          }
-          rsa::pkcs1::RsaPrivateKey::PEM_LABEL => {
-            // FIXME
-            return Err(type_error("deriving public key from rsa private key"));
+          EncryptedPrivateKeyInfo::PEM_LABEL
+          | PrivateKeyInfo::PEM_LABEL
+          | sec1::EcPrivateKey::PEM_LABEL
+          | rsa::pkcs1::RsaPrivateKey::PEM_LABEL => {
+            let handle = KeyObjectHandle::new_asymmetric_private_key_from_js(
+              key, format, typ, passphrase,
+            )?;
+            match handle {
+              KeyObjectHandle::AsymmetricPrivate(private) => {
+                return Ok(KeyObjectHandle::AsymmetricPublic(
+                  private.to_public_key(),
+                ))
+              }
+              KeyObjectHandle::AsymmetricPublic(_)
+              | KeyObjectHandle::Secret(_) => unreachable!(),
+            }
           }
           // TODO: handle x509 certificates as public keys
           _ => {
Repository: ggml-org/llama.cpp
Pull request: mtmd : fix batch_view for m-rope

Fix https://github.com/ggml-org/llama.cpp/issues/13394

With the prompt + image from the original issue, the model now response correctly:

`The image is of an animated character, Pikachu, from the Pokémon series. Pikachu is a small, yellow, mouse-like Pokémon known for its ability to generate electricity. The image shows Pikachu in a cheerful pose, with its arms outstretched and a happy expression on its face.`

Special thanks to @mattjcly for testing and pointing out the buggy code! 💯 


Changed files:
filename: tools/mtmd/mtmd.cpp
patch: @@ -554,14 +554,19 @@ struct decode_embd_batch {
     llama_batch get_view(int offset, int n_tokens) {
         llama_pos * pos_ptr;
         pos_view.clear();
-        pos_view.resize(n_tokens * n_pos_per_embd);
+        pos_view.reserve(n_tokens * n_pos_per_embd);
         if (n_pos_per_embd > 1) {
             // mrope
             // for example, with layout of src: 1234...1234...1234...1234...
             //       offset 2 will give us dst: 34...34...34...34...
             for (int i = 0; i < n_pos_per_embd; i++) {
-                auto src = pos.begin() + i * batch.n_tokens + offset;
-                pos_view.insert(pos_view.end(), src, src + n_tokens);
+                // assume n_tokens is less than or equal to batch.n_tokens
+                // batch.n_tokens is number of **total** tokens
+                // n_tokens is number of viewed token
+                size_t src_idx = i * batch.n_tokens + offset;
+                pos_view.insert(pos_view.end(),
+                    pos.data() + src_idx,
+                    pos.data() + src_idx + n_tokens);
             }
             pos_ptr = pos_view.data();
         } else {
Repository: facebook/react
Pull request: Add warnings for common root API mistakes

For createRoot, a common mistake is to pass JSX as the second argument, instead of calling root.render.

For hydrateRoot, a common mistake is to forget to pass children as the second argument.

The type system will enforce correct usage, but since not everyone uses types we'll log a helpful warning, too.

Changed files:
filename: packages/react-dom/src/__tests__/ReactDOMRoot-test.js
patch: @@ -420,4 +420,27 @@ describe('ReactDOMRoot', () => {
     // Still works in the legacy API
     ReactDOM.render(<div />, commentNode);
   });
+
+  it('warn if no children passed to hydrateRoot', async () => {
+    expect(() =>
+      ReactDOM.hydrateRoot(container),
+    ).toErrorDev(
+      'Must provide initial children as second argument to hydrateRoot.',
+      {withoutStack: true},
+    );
+  });
+
+  it('warn if JSX passed to createRoot', async () => {
+    function App() {
+      return 'Child';
+    }
+
+    expect(() => ReactDOM.createRoot(container, <App />)).toErrorDev(
+      'You passed a JSX element to createRoot. You probably meant to call ' +
+        'root.render instead',
+      {
+        withoutStack: true,
+      },
+    );
+  });
 });

filename: packages/react-dom/src/client/ReactDOMRoot.js
patch: @@ -15,6 +15,7 @@ import type {
 } from 'react-reconciler/src/ReactInternalTypes';
 
 import {queueExplicitHydrationTarget} from '../events/ReactDOMEventReplaying';
+import {REACT_ELEMENT_TYPE} from 'shared/ReactSymbols';
 
 export type RootType = {
   render(children: ReactNodeList): void,
@@ -174,6 +175,20 @@ export function createRoot(
         console.warn(
           'hydrate through createRoot is deprecated. Use ReactDOM.hydrateRoot(container, <App />) instead.',
         );
+      } else {
+        if (
+          typeof options === 'object' &&
+          options !== null &&
+          (options: any).$$typeof === REACT_ELEMENT_TYPE
+        ) {
+          console.error(
+            'You passed a JSX element to createRoot. You probably meant to ' +
+              'call root.render instead. ' +
+              'Example usage:\n\n' +
+              '  let root = createRoot(domContainer);\n' +
+              '  root.render(<App />);',
+          );
+        }
       }
     }
     if (options.unstable_strictMode === true) {
@@ -237,6 +252,15 @@ export function hydrateRoot(
 
   warnIfReactDOMContainerInDEV(container);
 
+  if (__DEV__) {
+    if (initialChildren === undefined) {
+      console.error(
+        'Must provide initial children as second argument to hydrateRoot. ' +
+          'Example usage: hydrateRoot(domContainer, <App />)',
+      );
+    }
+  }
+
   // For now we reuse the whole bag of options since they contain
   // the hydration callbacks.
   const hydrationCallbacks = options != null ? options : null;
Repository: electron/electron
Pull request: fix: ensure bounds stability in `OnWidgetBoundsChanged`

Backport of #43431.

See that PR for details.

Notes: Fixed an issue with `resize` events being emitted on Windows when the window was moved but not resized.

Changed files:
filename: shell/browser/native_window_views.cc
patch: @@ -22,6 +22,7 @@
 
 #include "base/containers/contains.h"
 #include "base/memory/raw_ptr.h"
+#include "base/numerics/ranges.h"
 #include "base/stl_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "content/public/browser/browser_thread.h"
@@ -1644,10 +1645,18 @@ void NativeWindowViews::OnWidgetBoundsChanged(views::Widget* changed_widget,
   if (changed_widget != widget())
     return;
 
-  // Note: We intentionally use `GetBounds()` instead of `bounds` to properly
-  // handle minimized windows on Windows.
+  // |GetWindowBoundsInScreen| has a ~1 pixel margin of error, so if we check
+  // existing bounds directly against the new bounds without accounting for that
+  // we'll have constant false positives when the window is moving but the user
+  // hasn't changed its size at all.
+  auto areWithinOnePixel = [](gfx::Size old_size, gfx::Size new_size) -> bool {
+    return base::IsApproximatelyEqual(old_size.width(), new_size.width(), 1) &&
+           base::IsApproximatelyEqual(old_size.height(), new_size.height(), 1);
+  };
+
+  // We use |GetBounds| to account for minimized windows on Windows.
   const auto new_bounds = GetBounds();
-  if (widget_size_ != new_bounds.size()) {
+  if (!areWithinOnePixel(widget_size_, new_bounds.size())) {
     NotifyWindowResize();
     widget_size_ = new_bounds.size();
   }