helloadhavan/github_issues huggingface dataset:
Repository: huggingface/transformers
Pull request: fix cached file error when repo type is dataset

# What does this PR do?

Pass the repo type correctly to `try_to_load_from_cache` in `cached_files`

## 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?

@SunMarc 


Changed files:
filename: src/transformers/utils/hub.py
patch: @@ -134,10 +134,16 @@ def is_offline_mode():
 
 
 def _get_cache_file_to_return(
-    path_or_repo_id: str, full_filename: str, cache_dir: Union[str, Path, None] = None, revision: Optional[str] = None
+    path_or_repo_id: str,
+    full_filename: str,
+    cache_dir: Union[str, Path, None] = None,
+    revision: Optional[str] = None,
+    repo_type: Optional[str] = None,
 ):
     # We try to see if we have a cached version (not up to date):
-    resolved_file = try_to_load_from_cache(path_or_repo_id, full_filename, cache_dir=cache_dir, revision=revision)
+    resolved_file = try_to_load_from_cache(
+        path_or_repo_id, full_filename, cache_dir=cache_dir, revision=revision, repo_type=repo_type
+    )
     if resolved_file is not None and resolved_file != _CACHED_NO_EXIST:
         return resolved_file
     return None
@@ -520,7 +526,8 @@ def cached_files(
 
         # Now we try to recover if we can find all files correctly in the cache
         resolved_files = [
-            _get_cache_file_to_return(path_or_repo_id, filename, cache_dir, revision) for filename in full_filenames
+            _get_cache_file_to_return(path_or_repo_id, filename, cache_dir, revision, repo_type)
+            for filename in full_filenames
         ]
         if all(file is not None for file in resolved_files):
             return resolved_files
Repository: ggml-org/llama.cpp
Pull request: context : fix n_outputs during reserve

fix https://github.com/ggml-org/llama.cpp/issues/15849


Changed files:
filename: src/llama-context.cpp
patch: @@ -285,8 +285,8 @@ llama_context::llama_context(
         const uint32_t n_seqs = cparams.kv_unified ? 1 : cparams.n_seq_max;
         const uint32_t n_tokens = std::min(cparams.n_ctx, cparams.n_ubatch);
 
-        // avoid reserving graphs with zero outputs
-        n_outputs = 1;
+        // avoid reserving graphs with zero outputs - assume one output per sequence
+        n_outputs = n_seqs;
 
         LLAMA_LOG_DEBUG("%s: worst-case: n_tokens = %d, n_seqs = %d, n_outputs = %d\n", __func__, n_tokens, n_seqs, n_outputs);
 

filename: src/llama-graph.cpp
patch: @@ -1431,7 +1431,8 @@ ggml_tensor * llm_graph_context::build_attn(
 
     // [TAG_NO_CACHE_PAD]
     // TODO: if ubatch.equal_seqs() == true, we can split the three tensors below into ubatch.n_seqs_unq streams
-    assert(!ubatch.equal_seqs() || (k_cur->ne[3] == 1 && k_cur->ne[3] == ubatch.n_seqs_unq));
+    //       but it might not be worth it: https://github.com/ggml-org/llama.cpp/pull/15636
+    //assert(!ubatch.equal_seqs() || (k_cur->ne[3] == 1 && k_cur->ne[3] == ubatch.n_seqs_unq));
 
     ggml_tensor * q = q_cur;
     ggml_tensor * k = k_cur;
Repository: huggingface/transformers
Pull request: Fix indentation bug in SmolVLM image processor causing KeyError

# What does this PR do?

This PR fixes an indentation bug in `SmolVLMImageProcessorFast` that causes a `KeyError` when `do_image_splitting=False`.

The issue was in line 434 where `split_images_grouped[shape] = stacked_images` was incorrectly indented outside the loop, causing only the last shape to be stored in the dictionary. When `reorder_images()` tries to access other shapes, it fails with a KeyError.

**Fix:** Move the assignment inside the loop with proper indentation (add 4 spaces).

**Before:**
```python
for shape, stacked_images in grouped_images.items():
    # ... resize code ...
split_images_grouped[shape] = stacked_images  # Outside loop - bug!
```
**After:**
```python
for shape, stacked_images in grouped_images.items():
    # ... resize code ...
    split_images_grouped[shape] = stacked_images  # Inside loop - fixed!
```

Fixes #39442
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?
 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?
@yonigozlan @amyeroberts @qubvel

Changed files:
filename: src/transformers/models/idefics3/image_processing_idefics3_fast.py
patch: @@ -441,7 +441,7 @@ def _preprocess(
                     size=SizeDict(height=max_image_size["longest_edge"], width=max_image_size["longest_edge"]),
                     interpolation=interpolation,
                 )
-            split_images_grouped[shape] = stacked_images
+                split_images_grouped[shape] = stacked_images
             processed_images = reorder_images(split_images_grouped, grouped_images_index, is_nested=True)
             rows = [[0] * len(images) for images in processed_images]
             cols = [[0] * len(images) for images in processed_images]

filename: src/transformers/models/smolvlm/image_processing_smolvlm_fast.py
patch: @@ -431,7 +431,7 @@ def _preprocess(
                     size=SizeDict(height=max_image_size["longest_edge"], width=max_image_size["longest_edge"]),
                     interpolation=interpolation,
                 )
-            split_images_grouped[shape] = stacked_images
+                split_images_grouped[shape] = stacked_images
             processed_images = reorder_images(split_images_grouped, grouped_images_index, is_nested=True)
             rows = [[0] * len(images) for images in processed_images]
             cols = [[0] * len(images) for images in processed_images]
Repository: vercel/next.js
Pull request: [turbopack] Remove a vec clone from `primary_chunkable_referenced_modules` 

Remove a vec clone when resolving module primary references.  Since it is stored in a turbotask we can just pass around a ReadRef to the Vec.

By avoiding the copy we make the `ModulesWithRefData` type a little smaller and should speed up the loop, the cost is some additional indirection when iterating, however all callers only iterate once so this ends up as a win in all cases.


Closes PACK-5005

Changed files:
filename: turbopack/crates/turbopack-core/src/reference/mod.rs
patch: @@ -3,7 +3,7 @@ use std::collections::HashSet;
 use anyhow::Result;
 use turbo_rcstr::RcStr;
 use turbo_tasks::{
-    FxIndexSet, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, ValueToString, Vc,
+    FxIndexSet, ReadRef, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, ValueToString, Vc,
     graph::{AdjacencyMap, GraphTraversal},
 };
 
@@ -285,9 +285,8 @@ pub async fn primary_referenced_modules(module: Vc<Box<dyn Module>>) -> Result<V
     Ok(Vc::cell(modules))
 }
 
-type ModulesVec = Vec<ResolvedVc<Box<dyn Module>>>;
 #[turbo_tasks::value(transparent)]
-pub struct ModulesWithRefData(Vec<(ChunkingType, ExportUsage, ModulesVec)>);
+pub struct ModulesWithRefData(Vec<(ChunkingType, ExportUsage, ReadRef<Modules>)>);
 
 /// Aggregates all primary [Module]s referenced by an [Module] via [ChunkableModuleReference]s.
 /// This does not include transitively referenced [Module]s, only includes
@@ -296,7 +295,7 @@ pub struct ModulesWithRefData(Vec<(ChunkingType, ExportUsage, ModulesVec)>);
 /// [Module]: crate::module::Module
 #[turbo_tasks::function]
 pub async fn primary_chunkable_referenced_modules(
-    module: Vc<Box<dyn Module>>,
+    module: ResolvedVc<Box<dyn Module>>,
     include_traced: bool,
 ) -> Result<Vc<ModulesWithRefData>> {
     let modules = module
@@ -317,7 +316,6 @@ pub async fn primary_chunkable_referenced_modules(
                     .resolve()
                     .await?
                     .primary_modules()
-                    .owned()
                     .await?;
                 let export = reference.export_usage().owned().await?;
Repository: nodejs/node
Pull request: test_runner: change ts default glob

This PR changes the default glob for matching.ts files.
Basically will match only `*test.{ts,mts,cts}` inside the test folder.
This is the safest and middle ground to avoid breaking users.
I'd not consider a breaking change in v23 since typescript support is experimental.

Fixes: https://github.com/nodejs/node/issues/56546

Changed files:
filename: doc/api/test.md
patch: @@ -418,12 +418,9 @@ By default, Node.js will run all files matching these patterns:
 Unless [`--no-experimental-strip-types`][] is supplied, the following
 additional patterns are also matched:
 
-* `**/*.test.{cts,mts,ts}`
-* `**/*-test.{cts,mts,ts}`
-* `**/*_test.{cts,mts,ts}`
-* `**/test-*.{cts,mts,ts}`
-* `**/test.{cts,mts,ts}`
-* `**/test/**/*.{cts,mts,ts}`
+* `**/test/**/*-test.{cts,mts,ts}`
+* `**/test/**/*.test.{cts,mts,ts}`
+* `**/test/**/*_test.{cts,mts,ts}`
 
 Alternatively, one or more glob patterns can be provided as the
 final argument(s) to the Node.js command, as shown below.

filename: lib/internal/test_runner/runner.js
patch: @@ -108,7 +108,7 @@ let kResistStopPropagation;
 function createTestFileList(patterns, cwd) {
   const hasUserSuppliedPattern = patterns != null;
   if (!patterns || patterns.length === 0) {
-    patterns = [kDefaultPattern];
+    patterns = kDefaultPattern;
   }
   const glob = new Glob(patterns, {
     __proto__: null,

filename: lib/internal/test_runner/utils.js
patch: @@ -55,10 +55,10 @@ const kRegExpPattern = /^\/(.*)\/([a-z]*)$/;
 
 const kPatterns = ['test', 'test/**/*', 'test-*', '*[._-]test'];
 const kFileExtensions = ['js', 'mjs', 'cjs'];
+const kDefaultPattern = [`**/{${ArrayPrototypeJoin(kPatterns, ',')}}.{${ArrayPrototypeJoin(kFileExtensions, ',')}}`];
 if (getOptionValue('--experimental-strip-types')) {
-  ArrayPrototypePush(kFileExtensions, 'ts', 'mts', 'cts');
+  ArrayPrototypePush(kDefaultPattern, '**/test/**/*{-,.,_}test.{cts,mts,ts}');
 }
-const kDefaultPattern = `**/{${ArrayPrototypeJoin(kPatterns, ',')}}.{${ArrayPrototypeJoin(kFileExtensions, ',')}}`;
 
 function createDeferredCallback() {
   let calledCount = 0;
@@ -290,7 +290,7 @@ function parseCommandLine() {
     if (!coverageExcludeGlobs || coverageExcludeGlobs.length === 0) {
       // TODO(pmarchini): this default should follow something similar to c8 defaults
       // Default exclusions should be also exported to be used by other tools / users
-      coverageExcludeGlobs = [kDefaultPattern];
+      coverageExcludeGlobs = kDefaultPattern;
     }
     coverageIncludeGlobs = getOptionValue('--test-coverage-include');
Repository: vercel/next.js
Pull request: Turbopack: move write_version feature to env var

This is useful for debugging infinite file write loop situations. Put it behind the env var `TURBO_ENGINE_WRITE_VERSION=1` to be able to debug this if other people want to debug this without recompiling Next.js

Closes PACK-5000

Changed files:
filename: turbopack/crates/turbo-tasks-fs/Cargo.toml
patch: @@ -18,8 +18,6 @@ default = []
 # A binary built with this option **is not portable**, the directory
 # path will be embedded into the binary.
 dynamic_embed_contents = []
-# Write a hashed version of each file to allow to debug conflicting writes
-write_version = []
 
 [lints]
 workspace = true

filename: turbopack/crates/turbo-tasks-fs/src/lib.rs
patch: @@ -32,7 +32,7 @@ use std::{
     io::{self, BufRead, BufReader, ErrorKind, Read},
     mem::take,
     path::{MAIN_SEPARATOR, Path, PathBuf},
-    sync::Arc,
+    sync::{Arc, LazyLock},
     time::Duration,
 };
 
@@ -786,8 +786,12 @@ impl FileSystem for DiskFileSystem {
                         #[cfg(target_family = "unix")]
                         f.set_permissions(file.meta.permissions.into())?;
                         f.flush()?;
-                        #[cfg(feature = "write_version")]
-                        {
+
+                        static WRITE_VERSION: LazyLock<bool> = LazyLock::new(|| {
+                            std::env::var_os("TURBO_ENGINE_WRITE_VERSION")
+                                .is_some_and(|v| v == "1" || v == "true")
+                        });
+                        if *WRITE_VERSION {
                             let mut full_path = full_path.to_owned();
                             let hash = hash_xxh3_hash64(file);
                             let ext = full_path.extension();
Repository: facebook/react
Pull request: Use createRoot for ReactTreeTraversal-test


Changed files:
filename: packages/react-dom/src/__tests__/ReactTreeTraversal-test.js
patch: @@ -10,7 +10,9 @@
 'use strict';
 
 let React;
-let ReactDOM;
+let ReactDOMClient;
+let act;
+let root;
 
 const ChildComponent = ({id, eventHandler}) => (
   <div
@@ -68,9 +70,10 @@ describe('ReactTreeTraversal', () => {
   let outerNode1;
   let outerNode2;
 
-  beforeEach(() => {
+  beforeEach(async () => {
     React = require('react');
-    ReactDOM = require('react-dom');
+    ReactDOMClient = require('react-dom/client');
+    act = require('internal-test-utils').act;
 
     mockFn.mockReset();
 
@@ -81,7 +84,10 @@ describe('ReactTreeTraversal', () => {
     document.body.appendChild(outerNode1);
     document.body.appendChild(outerNode2);
 
-    ReactDOM.render(<ParentComponent eventHandler={mockFn} />, container);
+    root = ReactDOMClient.createRoot(container);
+    await act(() => {
+      root.render(<ParentComponent eventHandler={mockFn} />);
+    });
   });
 
   afterEach(() => {
Repository: ggml-org/llama.cpp
Pull request: CANN: Switch to stream synchronization

Switch to stream synchronization because events are not effective in acl graph.

Co-authored-by: hipudding <huafengchun@gmail.com>

Changed files:
filename: ggml/src/ggml-cann/ggml-cann.cpp
patch: @@ -2092,16 +2092,17 @@ static bool ggml_backend_cann_cpy_tensor_async(
         ACL_CHECK(aclrtMemcpyAsync(dst->data, copy_size, src->data, copy_size,
                                    ACL_MEMCPY_DEVICE_TO_DEVICE,
                                    cann_ctx_src->stream()));
-
         // record event on src stream after the copy
-        if (!cann_ctx_src->copy_event) {
-            ACL_CHECK(aclrtCreateEventWithFlag(&cann_ctx_src->copy_event, ACL_EVENT_SYNC));
-        }
-        ACL_CHECK(aclrtRecordEvent(cann_ctx_src->copy_event, cann_ctx_src->stream()));
-
-        // wait on dst stream for the copy to complete
-        ggml_cann_set_device(cann_ctx_dst->device);
-        ACL_CHECK(aclrtStreamWaitEvent(cann_ctx_dst->stream(), cann_ctx_src->copy_event));
+        // TODO: this event is not effective with acl graph mode, change to use aclrtSynchronizeStream
+        // if (!cann_ctx_src->copy_event) {
+        //     ACL_CHECK(aclrtCreateEventWithFlag(&cann_ctx_src->copy_event, ACL_EVENT_SYNC));
+        // }
+        // ACL_CHECK(aclrtRecordEvent(cann_ctx_src->copy_event, cann_ctx_src->stream()));
+
+        // // wait on dst stream for the copy to complete
+        // ggml_cann_set_device(cann_ctx_dst->device);
+        // ACL_CHECK(aclrtStreamWaitEvent(cann_ctx_dst->stream(), cann_ctx_src->copy_event));
+        ACL_CHECK(aclrtSynchronizeStream(cann_ctx_src->stream()));
     } else {
         // src and dst are on the same backend
         ACL_CHECK(aclrtMemcpyAsync(dst->data, copy_size, src->data, copy_size,
Repository: denoland/deno
Pull request: fix(node:http): `ServerResponse.req` not set

This PR sets `ServerRsposne.req` properly. See https://github.com/nodejs/node/blob/e38ce27f3ca0a65f68a31cedd984cddb927d4002/lib/_http_server.js#L201

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

Changed files:
filename: ext/node/polyfills/http.ts
patch: @@ -1397,6 +1397,7 @@ function onError(self, error, cb) {
 }
 
 export type ServerResponse = {
+  req: IncomingMessageForServer;
   statusCode: number;
   statusMessage?: string;
 
@@ -1461,9 +1462,11 @@ type ServerResponseStatic = {
 
 export const ServerResponse = function (
   this: ServerResponse,
+  req: IncomingMessageForServer,
   resolve: (value: Response | PromiseLike<Response>) => void,
   socket: FakeSocket,
 ) {
+  this.req = req;
   this.statusCode = 200;
   this.statusMessage = undefined;
   this._headers = { __proto__: null };
@@ -2001,7 +2004,7 @@ export class ServerImpl extends EventEmitter {
         return response;
       } else {
         return new Promise<Response>((resolve): void => {
-          const res = new ServerResponse(resolve, socket);
+          const res = new ServerResponse(req, resolve, socket);
 
           if (request.headers.has("expect")) {
             if (/(?:^|\W)100-continue(?:$|\W)/i.test(req.headers.expect)) {

filename: tests/unit_node/http_test.ts
patch: @@ -1254,6 +1254,25 @@ Deno.test("[node/http] ServerResponse header names case insensitive", async () =
   await promise;
 });
 
+Deno.test("[node/http] ServerResponse .req", async () => {
+  const { promise, resolve } = Promise.withResolvers<void>();
+  const server = http.createServer((req, res) => {
+    assertEquals(res.req, req);
+    res.end("foo");
+  });
+
+  server.listen(async () => {
+    const { port } = server.address() as { port: number };
+    const res = await fetch(`http://localhost:${port}`);
+    assertEquals(await res.text(), "foo");
+    server.close(() => {
+      resolve();
+    });
+  });
+
+  await promise;
+});
+
 Deno.test("[node/http] IncomingMessage override", () => {
   const req = new http.IncomingMessage(new net.Socket());
   // https://github.com/dougmoscrop/serverless-http/blob/3aaa6d0fe241109a8752efb011c242d249f32368/lib/request.js#L20-L30
Repository: electron/electron
Pull request: fix: crash on `getUserMedia` with invalid `chromeMediaSourceId`

Backport of #45733

See that PR for details.


Notes: Fixed a potential crash when calling legacy `getUserMedia` with an invalid  `chromeMediaSourceId`.


Changed files:
filename: shell/browser/web_contents_permission_helper.cc
patch: @@ -101,16 +101,20 @@ void HandleUserMediaRequest(const content::MediaStreamRequest& request,
             : "");
   }
 
-  if (request.video_type == MediaStreamType::GUM_TAB_VIDEO_CAPTURE ||
-      request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE) {
+  if (request.video_type == MediaStreamType::GUM_TAB_VIDEO_CAPTURE) {
+    devices_ref.video_device =
+        blink::MediaStreamDevice(request.video_type, "", "");
+  } else if (request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE) {
+    // If the DesktopMediaID can't be successfully parsed, throw an
+    // Invalid state error to match upstream.
+    auto dm_id = GetScreenId(request.requested_video_device_ids);
+    if (dm_id.is_null()) {
+      std::move(callback).Run(blink::mojom::StreamDevicesSet(),
+                              MediaStreamRequestResult::INVALID_STATE, nullptr);
+      return;
+    }
     devices_ref.video_device = blink::MediaStreamDevice(
-        request.video_type,
-        request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE
-            ? GetScreenId(request.requested_video_device_ids).ToString()
-            : "",
-        request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE
-            ? "Screen"
-            : "");
+        request.video_type, dm_id.ToString(), "Screen");
   }
 
   bool empty = !devices_ref.audio_device.has_value() &&

filename: spec/api-media-handler-spec.ts
patch: @@ -400,6 +400,23 @@ describe('setDisplayMediaRequestHandler', () => {
     expect(ok).to.be.true(message);
   });
 
+  it('throws an error when calling legacy getUserMedia with invalid chromeMediaSourceId', async () => {
+    const w = new BrowserWindow({ show: false });
+    await w.loadURL(serverUrl);
+    const { ok, message } = await w.webContents.executeJavaScript(`
+      new Promise((resolve, reject) => navigator.getUserMedia({
+         video: {
+          mandatory: {
+            chromeMediaSource: 'desktop',
+            chromeMediaSourceId: undefined,
+          },
+        },
+      }, x => resolve({ok: x instanceof MediaStream}), e => resolve({ ok: false, message: e.message })))
+    `);
+    expect(ok).to.be.false();
+    expect(message).to.equal('Invalid state');
+  });
+
   it('can remove a displayMediaRequestHandler', async () => {
     const ses = session.fromPartition('' + Math.random());
Repository: facebook/react
Pull request: Convert describeComponentFrame to createRoot

Not gated in `yarn test packages/shared/__tests__/describeComponentFrame-test.js --env production -r=www-classic`

Changed files:
filename: packages/shared/__tests__/describeComponentFrame-test.js
patch: @@ -10,16 +10,18 @@
 'use strict';
 
 let React;
-let ReactDOM;
+let ReactDOMClient;
+let act;
 
 describe('Component stack trace displaying', () => {
   beforeEach(() => {
     React = require('react');
-    ReactDOM = require('react-dom');
+    ReactDOMClient = require('react-dom');
+    act = require('internal-test-utils').act;
   });
 
   // @gate !enableComponentStackLocations || !__DEV__
-  it('should provide filenames in stack traces', () => {
+  it('should provide filenames in stack traces', async () => {
     class Component extends React.Component {
       render() {
         return [<span>a</span>, <span>b</span>];
@@ -88,15 +90,21 @@ describe('Component stack trace displaying', () => {
       'C:\\funny long (path)/index.js': 'funny long (path)/index.js',
       'C:\\funny long (path)/index.jsx': 'funny long (path)/index.jsx',
     };
-    Object.keys(fileNames).forEach((fileName, i) => {
+
+    const root = ReactDOMClient.createRoot(container);
+
+    let i = 0;
+    for (const fileName in fileNames) {
       Component.displayName = 'Component ' + i;
-      ReactDOM.render(
-        <Component __source={{fileName, lineNumber: i}} />,
-        container,
-      );
-    });
+
+      await act(() => {
+        root.render(<Component __source={{fileName, lineNumber: i}} />);
+      });
+
+      i++;
+    }
     if (__DEV__) {
-      let i = 0;
+      i = 0;
       expect(console.error).toHaveBeenCalledTimes(
         Object.keys(fileNames).length,
       );