helloadhavan/github_issues huggingface dataset:
Repository: ggml-org/llama.cpp
Pull request: batch : fix consistency checks for the input positions

fix #16876

Update sanity checks in `llama-batch` to allow repeating positions for mrope embedding inputs.

Changed files:
filename: src/llama-batch.cpp
patch: @@ -261,15 +261,29 @@ bool llama_batch_allocr::init(
 
             const llama_pos p0 = memory ? memory->seq_pos_max(s) : -1;
 
-            if (p0 >= 0 && p0 >= seq_pos_min(s)) {
-                LLAMA_LOG_ERROR(
-                        "%s: the tokens of sequence %d in the input batch have inconsistent sequence positions:\n"
-                        " - the last position stored in the memory module of the context (i.e. the KV cache) for sequence %d is X = %d\n"
-                        " - the tokens for sequence %d in the input batch have a starting position of Y = %d\n"
-                        " for M-RoPE, it is required that the position satisfies: X < Y\n",
-                        __func__, s, s, p0, s, seq_pos_min(s));
+            if (batch.token) {
+                if (p0 >= 0 && p0 >= seq_pos_min(s)) {
+                    LLAMA_LOG_ERROR(
+                            "%s: the tokens of sequence %d in the input batch have inconsistent sequence positions:\n"
+                            " - the last position stored in the memory module of the context (i.e. the KV cache) for sequence %d is X = %d\n"
+                            " - the tokens for sequence %d in the input batch have a starting position of Y = %d\n"
+                            " for M-RoPE, it is required that the position satisfies: X < Y\n",
+                            __func__, s, s, p0, s, seq_pos_min(s));
 
-                return false;
+                    return false;
+                }
+            } else {
+                // embedding inputs can have overlapping positions
+                if (p0 >= 0 && p0 > seq_pos_min(s)) {
+                    LLAMA_LOG_ERROR(
+                            "%s: the tokens of sequence %d in the input batch have inconsistent sequence positions:\n"
+                            " - the last position stored in the memory module of the context (i.e. the KV cache) for sequence %d is X = %d\n"
+                            " - the tokens for sequence %d in the input batch have a starting position of Y = %d\n"
+                            " for M-RoPE, it is required that the position satisfies: X <= Y\n",
+                            __func__, s, s, p0, s, seq_pos_min(s));
+
+                    return false;
+                }
             }
         }
     } else {
Repository: nodejs/node
Pull request: fs: make `Dir` disposers idempotent

As per draft explicit resource management guidelines (#58526) regarding disposer behaviour.

refs: #58206

Changed files:
filename: doc/api/fs.md
patch: @@ -6773,8 +6773,8 @@ changes:
    description: No longer experimental.
 -->
 
-Calls `dir.close()` and returns a promise that fulfills when the
-dir is closed.
+Calls `dir.close()` if the directory handle is open, and returns a promise that
+fulfills when disposal is complete.
 
 #### `dir[Symbol.dispose]()`
 
@@ -6786,7 +6786,8 @@ changes:
    description: No longer experimental.
 -->
 
-Calls `dir.closeSync()` and returns `undefined`.
+Calls `dir.closeSync()` if the directory handle is open, and returns
+`undefined`.
 
 ### Class: `fs.Dirent`
 

filename: lib/internal/fs/dir.js
patch: @@ -24,7 +24,6 @@ const {
 
 const { FSReqCallback } = binding;
 const {
-  assignFunctionName,
   promisify,
 } = require('internal/util');
 const {
@@ -296,31 +295,24 @@ class Dir {
       await this.#closePromisified();
     }
   }
+
+  [SymbolDispose]() {
+    if (this.#closed) return;
+    this.closeSync();
+  }
+
+  async [SymbolAsyncDispose]() {
+    if (this.#closed) return;
+    await this.#closePromisified();
+  }
 }
 
-const nonEnumerableDescriptor = {
-  enumerable: false,
-  writable: true,
-  configurable: true,
-};
 ObjectDefineProperties(Dir.prototype, {
-  [SymbolDispose]: {
-    __proto__: null,
-    ...nonEnumerableDescriptor,
-    value: assignFunctionName(SymbolDispose, function() {
-      this.closeSync();
-    }),
-  },
-  [SymbolAsyncDispose]: {
-    __proto__: null,
-    ...nonEnumerableDescriptor,
-    value: assignFunctionName(SymbolAsyncDispose, function() {
-      this.close();
-    }),
-  },
   [SymbolAsyncIterator]: {
     __proto__: null,
-    ...nonEnumerableDescriptor,
+    enumerable: false,
+    writable: true,
+    configurable: true,
     value: Dir.prototype.entries,
   },
 });

filename: test/parallel/test-fs-promises-file-handle-dispose.js
patch: @@ -11,10 +11,14 @@ async function explicitCall() {
 
   const dh = await fs.opendir(__dirname);
   await dh[Symbol.asyncDispose]();
+  // Repeat invocations should not reject
+  await dh[Symbol.asyncDispose]();
   await assert.rejects(dh.read(), { code: 'ERR_DIR_CLOSED' });
 
   const dhSync = opendirSync(__dirname);
   dhSync[Symbol.dispose]();
+  // Repeat invocations should not throw
+  dhSync[Symbol.dispose]();
   assert.throws(() => dhSync.readSync(), { code: 'ERR_DIR_CLOSED' });
 }
Repository: vercel/next.js
Pull request: Turbopack: remove blocking thread limit to avoid deadlocks

### What?

Having a limit of blocking thread can lead to deadlocks the using block_in_place

Closes PACK-5329

Changed files:
filename: crates/napi/src/lib.rs
patch: @@ -73,6 +73,7 @@ fn init() {
     use std::{
         cell::RefCell,
         panic::{set_hook, take_hook},
+        thread::available_parallelism,
         time::{Duration, Instant},
     };
 
@@ -90,6 +91,8 @@ fn init() {
         prev_hook(info);
     }));
 
+    let worker_threads = available_parallelism().map(|n| n.get()).unwrap_or(1);
+
     let rt = Builder::new_multi_thread()
         .enable_all()
         .on_thread_stop(|| {
@@ -103,6 +106,10 @@ fn init() {
                 }
             });
         })
+        .worker_threads(worker_threads)
+        // Avoid a limit on threads to avoid deadlocks due to usage of block_in_place
+        .max_blocking_threads(usize::MAX - worker_threads)
+        // Avoid the extra lifo slot to avoid stalling tasks when doing cpu-heavy work
         .disable_lifo_slot()
         .build()
         .unwrap();

filename: turbopack/crates/turbopack-cli/src/main.rs
patch: @@ -1,7 +1,7 @@
 #![feature(future_join)]
 #![feature(min_specialization)]
 
-use std::{cell::RefCell, path::Path, time::Instant};
+use std::{cell::RefCell, path::Path, thread::available_parallelism, time::Instant};
 
 use anyhow::{Context, Result};
 use clap::Parser;
@@ -42,6 +42,11 @@ fn main() {
             });
         });
 
+    let worker_threads = available_parallelism().map(|n| n.get()).unwrap_or(1);
+
+    rt.worker_threads(worker_threads);
+    rt.max_blocking_threads(usize::MAX - worker_threads);
+
     #[cfg(not(codspeed))]
     rt.disable_lifo_slot();
Repository: ollama/ollama
Pull request: show: no template system if empty

This prevents show outputs like this:

```
ollama run mistral
>>> /show modelfile
# Modelfile generated by "ollama show"
# To build a new Modelfile based on this one, replace the FROM line with:
# FROM mistral:latest

FROM registry.ollama.ai/library/mistral:latest
TEMPLATE """
 {{ .Prompt }} 

"""
SYSTEM """"""
```

Changed files:
filename: server/images.go
patch: @@ -951,7 +951,10 @@ func ShowModelfile(model *Model) (string, error) {
 
 FROM {{ .From }}
 TEMPLATE """{{ .Template }}"""
+
+{{- if .System }}
 SYSTEM """{{ .System }}"""
+{{- end }}
 {{ .Params }}
 `
 	for _, l := range mt.Model.AdapterPaths {
Repository: ggml-org/llama.cpp
Pull request: server : don't print user inputs to console

fix #16870

These will be printed only if the `LLAMA_SERVER_SLOTS_DEBUG` env is set.

Changed files:
filename: tools/server/server.cpp
patch: @@ -3796,7 +3796,7 @@ struct server_context {
 
                                 // when the prompt prefix does not match, print the tokens around the mismatch
                                 // this is useful for debugging prompt caching
-                                {
+                                if (slots_debug) {
                                     const int np0 = std::max<int>(n_past - 4, 0);
                                     const int np1 = std::min<int>(n_past + 6, std::min(slot.prompt.tokens.size(), slot.task->tokens.size()));
Repository: facebook/react
Pull request: [Float] Don't preload images inside `<noscript>`

`<noscript>` scopes should be considered inert from the perspective of Fizz since we assume they'll only be used in rare and adverse circumstances. When we added preload support for img tags we did not include the noscript scope check in the opt-out for preloading. This change adds it in

fixes: #27910

Changed files:
filename: packages/react-dom-bindings/src/server/ReactFizzConfigDOM.js
patch: @@ -2762,7 +2762,7 @@ function pushImg(
   props: Object,
   resumableState: ResumableState,
   renderState: RenderState,
-  pictureTagInScope: boolean,
+  pictureOrNoScriptTagInScope: boolean,
 ): null {
   const {src, srcSet} = props;
   if (
@@ -2771,7 +2771,7 @@ function pushImg(
     (typeof src === 'string' || src == null) &&
     (typeof srcSet === 'string' || srcSet == null) &&
     props.fetchPriority !== 'low' &&
-    pictureTagInScope === false &&
+    pictureOrNoScriptTagInScope === false &&
     // We exclude data URIs in src and srcSet since these should not be preloaded
     !(
       typeof src === 'string' &&
@@ -3599,7 +3599,7 @@ export function pushStartInstance(
         props,
         resumableState,
         renderState,
-        !!(formatContext.tagScope & PICTURE_SCOPE),
+        !!(formatContext.tagScope & (PICTURE_SCOPE | NOSCRIPT_SCOPE)),
       );
     }
     // Omitted close tags

filename: packages/react-dom/src/__tests__/ReactDOMFloat-test.js
patch: @@ -4261,6 +4261,38 @@ body {
     );
   });
 
+  // Fixes: https://github.com/facebook/react/issues/27910
+  it('omits preloads for images inside noscript tags', async () => {
+    function App() {
+      return (
+        <html>
+          <body>
+            <img src="foo" />
+            <noscript>
+              <img src="bar" />
+            </noscript>
+          </body>
+        </html>
+      );
+    }
+
+    await act(() => {
+      renderToPipeableStream(<App />).pipe(writable);
+    });
+
+    expect(getMeaningfulChildren(document)).toEqual(
+      <html>
+        <head>
+          <link rel="preload" href="foo" as="image" />
+        </head>
+        <body>
+          <img src="foo" />
+          <noscript>&lt;img src="bar"&gt;</noscript>
+        </body>
+      </html>,
+    );
+  });
+
   it('should handle media on image preload', async () => {
     function App({isClient}) {
       ReactDOM.preload('/server', {
Repository: huggingface/transformers
Pull request: Fix collated reports uploading


Changed files:
filename: utils/collated_reports.py
patch: @@ -127,7 +127,7 @@ def upload_collated_report(job: str, report_repo_id: str, filename: str):
         report_repo_folder = f"{report_repo_folder}/{report_repo_subfolder}"
 
     api.upload_file(
-        path_or_fileobj=f"ci_results_{job}/{filename}",
+        path_or_fileobj=f"{filename}",
         path_in_repo=f"{report_repo_folder}/ci_results_{job}/{filename}",
         repo_id=report_repo_id,
         repo_type="dataset",
Repository: electron/electron
Pull request: perf: avoid redundant map lookups in `GlobalShortcut` (34-x-y backport)

Manual backport of #46229. See that PR for details.

Notes: none.


Changed files:
filename: shell/browser/api/electron_api_global_shortcut.cc
patch: @@ -6,6 +6,7 @@
 
 #include <vector>
 
+#include "base/containers/map_util.h"
 #include "extensions/common/command.h"
 #include "gin/dictionary.h"
 #include "gin/handle.h"
@@ -52,12 +53,13 @@ GlobalShortcut::~GlobalShortcut() {
 }
 
 void GlobalShortcut::OnKeyPressed(const ui::Accelerator& accelerator) {
-  if (!accelerator_callback_map_.contains(accelerator)) {
-    // This should never occur, because if it does, GlobalShortcutListener
-    // notifies us with wrong accelerator.
+  if (auto* cb = base::FindOrNull(accelerator_callback_map_, accelerator)) {
+    cb->Run();
+  } else {
+    // This should never occur, because if it does,
+    // ui::GlobalAcceleratorListener notifies us with wrong accelerator.
     NOTREACHED();
   }
-  accelerator_callback_map_[accelerator].Run();
 }
 
 bool GlobalShortcut::RegisterAll(
Repository: ggml-org/llama.cpp
Pull request: vulkan: disable spirv-opt for rope shaders

Fixes #16860.


Changed files:
filename: ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp
patch: @@ -317,7 +317,8 @@ void string_to_spv_func(std::string name, std::string in_path, std::string out_p
 
     // disable spirv-opt for coopmat shaders for https://github.com/ggerganov/llama.cpp/issues/10734
     // disable spirv-opt for bf16 shaders for https://github.com/ggml-org/llama.cpp/issues/15344
-    std::string opt_level = (coopmat || name.find("bf16") != std::string::npos) ? "" : "-O";
+    // disable spirv-opt for rope shaders for https://github.com/ggml-org/llama.cpp/issues/16860
+    std::string opt_level = (coopmat || name.find("bf16") != std::string::npos || name.find("rope") != std::string::npos) ? "" : "-O";
 
     #ifdef _WIN32
         std::vector<std::string> cmd = {GLSLC, "-fshader-stage=compute", target_env, opt_level, "\"" + in_path + "\"", "-o", "\"" + out_path + "\""};
Repository: ollama/ollama
Pull request: Fix /api/tags for no models.

When the `.ollama` folder is broken, or no models exist, `/api/tags` returns `{models: null}` instead of the expected `{models: []}`.

Please review the change as minor as it is, as my experience with Go is close to nil.

Changed files:
filename: server/routes.go
patch: @@ -481,7 +481,7 @@ func GetModelInfo(name string) (*api.ShowResponse, error) {
 }
 
 func ListModelsHandler(c *gin.Context) {
-	var models []api.ModelResponse
+	models := make([]api.ModelResponse, 0)
 	fp, err := GetManifestPath()
 	if err != nil {
 		c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
Repository: nodejs/node
Pull request: doc: fix wrong RFC number in http2

Priority signaling was deprecated in RFC 9113(not 1993).

Refs: https://github.com/nodejs/node/pull/58313

<!--
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: doc/api/http2.md
patch: @@ -1078,7 +1078,7 @@ changes:
                  runtime warning.
   - version: v24.2.0
     pr-url: https://github.com/nodejs/node/pull/58313
-    description: Following the deprecation of priority signaling as of RFC 1993,
+    description: Following the deprecation of priority signaling as of RFC 9113,
                  `weight` option is deprecated.
 -->
 
@@ -1577,7 +1577,7 @@ changes:
                  `sumDependencyWeight` is always set to 0.
   - version: v24.2.0
     pr-url: https://github.com/nodejs/node/pull/58313
-    description: Following the deprecation of priority signaling as of RFC 1993,
+    description: Following the deprecation of priority signaling as of RFC 9113,
                  `weight` and `sumDependencyWeight` options are deprecated.
 -->
Repository: facebook/react
Pull request: [tests] Assert scheduler log empty in internalAct

We should force `assertLog` to be called before each `act` block to ensure the queue is empty.

Requires fixing tests:
- https://github.com/facebook/react/pull/28745
- https://github.com/facebook/react/pull/28758
- https://github.com/facebook/react/pull/28759
- https://github.com/facebook/react/pull/28760
- https://github.com/facebook/react/pull/28761
- https://github.com/facebook/react/pull/28762
- https://github.com/facebook/react/pull/28763
- https://github.com/facebook/react/pull/28812

Changed files:
filename: packages/internal-test-utils/internalAct.js
patch: @@ -19,6 +19,7 @@ import type {Thenable} from 'shared/ReactTypes';
 import * as Scheduler from 'scheduler/unstable_mock';
 
 import enqueueTask from './enqueueTask';
+import {diff} from 'jest-diff';
 
 export let actingUpdatesScopeDepth: number = 0;
 
@@ -45,6 +46,18 @@ export async function act<T>(scope: () => Thenable<T>): Thenable<T> {
     );
   }
 
+  const actualYields = Scheduler.unstable_clearLog();
+  if (actualYields.length !== 0) {
+    const error = Error(
+      'Log of yielded values is not empty. Call assertLog first.\n\n' +
+        `Received:\n${diff('', actualYields.join('\n'), {
+          omitAnnotationLines: true,
+        })}`,
+    );
+    Error.captureStackTrace(error, act);
+    throw error;
+  }
+
   // $FlowFixMe[cannot-resolve-name]: Flow doesn't know about global Jest object
   if (!jest.isMockFunction(setTimeout)) {
     throw Error(

filename: scripts/flow/environment.js
patch: @@ -332,6 +332,31 @@ declare module 'node:worker_threads' {
   }
 }
 
+declare module 'jest-diff' {
+  declare type CompareKeys = ((a: string, b: string) => number) | void;
+  declare type DiffOptions = {
+    aAnnotation?: string,
+    aColor?: (arg: string) => string,
+    aIndicator?: string,
+    bAnnotation?: string,
+    bColor?: (arg: string) => string,
+    bIndicator?: string,
+    changeColor?: (arg: string) => string,
+    changeLineTrailingSpaceColor?: (arg: string) => string,
+    commonColor?: (arg: string) => string,
+    commonIndicator?: string,
+    commonLineTrailingSpaceColor?: (arg: string) => string,
+    contextLines?: number,
+    emptyFirstOrLastLinePlaceholder?: string,
+    expand?: boolean,
+    includeChangeCounts?: boolean,
+    omitAnnotationLines?: boolean,
+    patchColor?: (arg: string) => string,
+    compareKeys?: CompareKeys,
+  };
+  declare function diff(a: any, b: any, options?: DiffOptions): string;
+}
+
 declare const Bun: {
   hash(
     input: string | $TypedArray | DataView | ArrayBuffer | SharedArrayBuffer,
Repository: huggingface/transformers
Pull request: Fix https://github.com/huggingface/transformers/issues/40292

# What does this PR do?

Fixes #40292
https://github.com/huggingface/transformers/issues/40292#issuecomment-3220768012

## Before submitting
- [ ] 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?
- [x] 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?

@Rocketknight1 

Changed files:
filename: src/transformers/integrations/integration_utils.py
patch: @@ -41,7 +41,7 @@
 if os.getenv("WANDB_MODE") == "offline":
     print("⚙️  Running in WANDB offline mode")
 
-from .. import PreTrainedModel, TFPreTrainedModel, TrainingArguments
+from .. import PreTrainedModel, TrainingArguments
 from .. import __version__ as version
 from ..utils import (
     PushToHubMixin,
@@ -56,6 +56,9 @@
 
 logger = logging.get_logger(__name__)
 
+if is_tf_available():
+    from .. import TFPreTrainedModel
+
 if is_torch_available():
     import torch
     import torch.distributed as dist
Repository: electron/electron
Pull request: perf: avoid redundant call to virtual methods GetProcess() and GetID()

#### Description of Change

Another speed-things-up-a-little-by-not-doing-the-same-thing-twice PR.

This one is similar to #46339: don't call virtual methods `RenderViewHost::GetProcess()` and `RenderProcessHost::GetID()` twice in a row when one time will do. 

All reviews welcome. CC @VerteDinde who reviewed #46339.

#### Checklist

- [x] PR description included and stakeholders cc'd
- [x] `npm test` passes
- [x] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).

#### Release Notes

Notes: none

Changed files:
filename: shell/browser/api/electron_api_web_contents.cc
patch: @@ -1788,19 +1788,18 @@ void WebContents::FrameDeleted(content::FrameTreeNodeId frame_tree_node_id) {
 }
 
 void WebContents::RenderViewDeleted(content::RenderViewHost* render_view_host) {
+  const auto id = render_view_host->GetProcess()->GetID().GetUnsafeValue();
   // This event is necessary for tracking any states with respect to
   // intermediate render view hosts aka speculative render view hosts. Currently
   // used by object-registry.js to ref count remote objects.
-  Emit("render-view-deleted",
-       render_view_host->GetProcess()->GetID().GetUnsafeValue());
+  Emit("render-view-deleted", id);
 
   if (web_contents()->GetRenderViewHost() == render_view_host) {
     // When the RVH that has been deleted is the current RVH it means that the
     // the web contents are being closed. This is communicated by this event.
     // Currently tracked by guest-window-manager.ts to destroy the
     // BrowserWindow.
-    Emit("current-render-view-deleted",
-         render_view_host->GetProcess()->GetID().GetUnsafeValue());
+    Emit("current-render-view-deleted", id);
   }
 }