helloadhavan/github_issues huggingface dataset:
Repository: nodejs/node
Pull request: benchmarks: add simple parse and test benchmarks for URLPattern

Add a couple of simple benchmarks for `URLPattern` that we can use to help judge performance improvements.

Changed files:
filename: benchmark/url/urlpattern-parse.js
patch: @@ -0,0 +1,28 @@
+'use strict';
+const common = require('../common.js');
+const { URLPattern } = require('url');
+const { ok } = require('assert');
+
+const tests = [
+  'https://(sub.)?example(.com/)foo',
+  { 'hostname': 'xn--caf-dma.com' },
+  { 'pathname': '/foo', 'search': 'bar', 'hash': 'baz',
+    'baseURL': 'https://example.com:8080' },
+  { 'pathname': '/([[a-z]--a])' },
+];
+
+const bench = common.createBenchmark(main, {
+  pattern: tests.map(JSON.stringify),
+  n: [1e5],
+});
+
+function main({ pattern, n }) {
+  const inputPattern = JSON.parse(pattern);
+  let deadcode;
+  bench.start();
+  for (let i = 0; i < n; i += 1) {
+    deadcode = new URLPattern(inputPattern);
+  }
+  bench.end(n);
+  ok(deadcode);
+}

filename: benchmark/url/urlpattern-test.js
patch: @@ -0,0 +1,30 @@
+'use strict';
+const common = require('../common.js');
+const { URLPattern } = require('url');
+const { notStrictEqual } = require('assert');
+
+const tests = [
+  'https://(sub.)?example(.com/)foo',
+  { 'hostname': 'xn--caf-dma.com' },
+  { 'pathname': '/foo', 'search': 'bar', 'hash': 'baz',
+    'baseURL': 'https://example.com:8080' },
+  { 'pathname': '/([[a-z]--a])' },
+];
+
+const bench = common.createBenchmark(main, {
+  pattern: tests.map(JSON.stringify),
+  n: [1e5],
+});
+
+function main({ pattern, n }) {
+  const inputPattern = JSON.parse(pattern);
+  const urlpattern = new URLPattern(inputPattern);
+
+  let deadcode;
+  bench.start();
+  for (let i = 0; i < n; i += 1) {
+    deadcode = urlpattern.test('https://sub.example.com/foo');
+  }
+  bench.end(n);
+  notStrictEqual(deadcode, undefined);  // We don't care if it is true or false.
+}
Repository: facebook/react
Pull request: feat[devtools/extension]: add dark theme for popup

## Summary

If the system/browser uses a dark theme, then the extension popup still remains with a light background. And so that the eyes do not hurt in a dark room, you need a dark theme.

## How did you test this change?

Make sure the dark theme is enabled on your system/browser.

**Before:**

![Screenshot 2023-09-02 at 22 20 56](https://github.com/facebook/react/assets/19418601/f7166ea7-f562-4d11-8851-be08fa9629a7)

**After:**

![Screenshot 2023-09-02 at 22 21 30](https://github.com/facebook/react/assets/19418601/e51ecd5f-3e71-4193-83ff-a548bce76bd4)

Changed files:
filename: packages/react-devtools-extensions/popups/shared.css
patch: @@ -4,4 +4,10 @@ html, body {
 
 body {
   margin: 8px;
-}
\ No newline at end of file
+}
+
+@media (prefers-color-scheme: dark) {
+  html {
+    color-scheme: dark;
+  }
+}
Repository: electron/electron
Pull request: build: fix `slack-github-action` for backports

#### Description of Change

Looks like [this commit](https://github.com/slackapi/slack-github-action/commit/e9b3a6beef047e819b8fb417da538f97a93a2ec8) in the action changed some of the logic around to require that a `webhook-type` be passed explicitly as an input.

This will fix backport requests not being sent to the expected Slack channel.

See sample error: https://github.com/electron/electron/actions/runs/12941904035/job/36406556780

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] PR description included and stakeholders cc'd
- [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: .github/workflows/pull-request-labeled.yml
patch: @@ -15,12 +15,12 @@ jobs:
       - name: Trigger Slack workflow
         uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
         with:
+          webhook: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }} 
+          webhook-type: webhook-trigger
           payload: |
             {
               "url": "${{ github.event.pull_request.html_url }}"
             }
-        env:
-          SLACK_WEBHOOK_URL: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
   pull-request-labeled-deprecation-review-complete:
     name: deprecation-review/complete label added
     if: github.event.label.name == 'deprecation-review/complete ✅'
Repository: huggingface/transformers
Pull request: assign the correct torchao data layout for xpu

Hi @Rocketknight1 @ArthurZucker . Same as CPU, the XPU requires a specific data layout to make torchao work. Please review this PR. Thanks! 

Changed files:
filename: src/transformers/utils/quantization_config.py
patch: @@ -1713,9 +1713,23 @@ def get_apply_tensor_subclass(self):
                 and version.parse(importlib.metadata.version("torchao")) >= version.parse("0.8.0")
                 and quant_type_kwargs.get("layout", None) is None
             ):
-                from torchao.dtypes import Int4CPULayout
+                if torch.xpu.is_available():
+                    if version.parse(importlib.metadata.version("torchao")) >= version.parse(
+                        "0.11.0"
+                    ) and version.parse(importlib.metadata.version("torch")) > version.parse("2.7.9"):
+                        from torchao.dtypes import Int4XPULayout
+                        from torchao.quantization.quant_primitives import ZeroPointDomain
+
+                        quant_type_kwargs["layout"] = Int4XPULayout()
+                        quant_type_kwargs["zero_point_domain"] = ZeroPointDomain.INT
+                    else:
+                        raise ValueError(
+                            "TorchAoConfig requires torchao >= 0.11.0 and torch >= 2.8.0 for XPU support. Please upgrade the version or use run on CPU with the cpu version pytorch."
+                        )
+                else:
+                    from torchao.dtypes import Int4CPULayout
 
-                quant_type_kwargs["layout"] = Int4CPULayout()
+                    quant_type_kwargs["layout"] = Int4CPULayout()
 
             return methods[self.quant_type](**quant_type_kwargs)
         else:
Repository: ggml-org/llama.cpp
Pull request: musa: handle __hgt2_mask (available starting from MUSA SDK rc4.3.0)

*Make sure to read the [contributing guidelines](https://github.com/ggml-org/llama.cpp/blob/master/CONTRIBUTING.md) before submitting a PR*

`__hgt2_mask` will be available starting from MUSA SDK `rc4.3.0`.

The following code snippet shows how MUSART_VERSION is calculated:
```c
#define __MUSA_API_VER_MAJOR__      4
#define __MUSA_API_VER_MINOR__      2
#define __MUSA_API_VER_PATCH__      0
#define __MUSA_API_VER_TWEAK__      
#define __MUSART_API_VERSION ((__MUSA_API_VER_MAJOR__ * 10000) + (__MUSA_API_VER_MINOR__ * 100) + __MUSA_API_VER_PATCH__)
#define MUSART_VERSION              __MUSART_API_VERSION
```

### Testing Done

Extra build test on HIP with `-DGGML_HIP_ROCWMMA_FATTN=ON` passed:

```bash
HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
    cmake -S . -B build -DGGML_HIP=ON -DGGML_HIP_ROCWMMA_FATTN=ON -DCMAKE_BUILD_TYPE=Release \
    && cmake --build build --config Release -- -j $(nproc)
```

Changed files:
filename: ggml/src/ggml-cuda/common.cuh
patch: @@ -78,6 +78,8 @@
 #define GGML_CUDA_CC_IS_CDNA3(cc) (cc >= GGML_CUDA_CC_CDNA3 && cc < GGML_CUDA_CC_RDNA1)
 
 // Moore Threads
+#define MUSART_HMASK 40300 // MUSA rc4.3, min. ver. for half2 -> uint mask comparisons
+
 #define GGML_CUDA_CC_QY1 (GGML_CUDA_CC_OFFSET_MTHREADS + 0x210) // MTT S80, MTT S3000
 #define GGML_CUDA_CC_QY2 (GGML_CUDA_CC_OFFSET_MTHREADS + 0x220) // MTT S4000
 #define GGML_CUDA_CC_NG  (GGML_CUDA_CC_OFFSET_MTHREADS + 0x310) // TBD
@@ -490,13 +492,14 @@ static __device__ __forceinline__ half2 warp_reduce_max(half2 x) {
 #endif // !defined(GGML_USE_HIP) && __CUDA_ARCH__ >= GGML_CUDA_CC_PASCAL || defined(GGML_USE_HIP)
 }
 
-#if CUDART_VERSION < CUDART_HMASK
+#if (defined(CUDART_VERSION) && CUDART_VERSION < CUDART_HMASK) || defined(GGML_USE_HIP) || \
+    (defined(MUSART_VERSION) && MUSART_VERSION < MUSART_HMASK)
 static __device__ __forceinline__ uint32_t __hgt2_mask(const half2 a, const half2 b) {
     const uint32_t mask_low  = 0x0000FFFF * (float( __low2half(a)) > float( __low2half(b)));
     const uint32_t mask_high = 0xFFFF0000 * (float(__high2half(a)) > float(__high2half(b)));
     return mask_low | mask_high;
 }
-#endif // CUDART_VERSION < CUDART_HMASK
+#endif // (defined(CUDART_VERSION) && CUDART_VERSION < CUDART_HMASK) || defined(GGML_USE_HIP) || (defined(MUSART_VERSION) && MUSART_VERSION < MUSART_HMASK)
 
 static __device__ __forceinline__ int ggml_cuda_dp4a(const int a, const int b, int c) {
 #if defined(GGML_USE_HIP)
Repository: electron/electron
Pull request: build: fix `slack-github-action` for backports

Backport of #45388

See that PR for details.


Notes: none


Changed files:
filename: .github/workflows/pull-request-labeled.yml
patch: @@ -15,12 +15,12 @@ jobs:
       - name: Trigger Slack workflow
         uses: slackapi/slack-github-action@37ebaef184d7626c5f204ab8d3baff4262dd30f0 # v1.27.0
         with:
+          webhook: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }} 
+          webhook-type: webhook-trigger
           payload: |
             {
               "url": "${{ github.event.pull_request.html_url }}"
             }
-        env:
-          SLACK_WEBHOOK_URL: ${{ secrets.BACKPORT_REQUESTED_SLACK_WEBHOOK_URL }}
   pull-request-labeled-deprecation-review-complete:
     name: deprecation-review/complete label added
     if: github.event.label.name == 'deprecation-review/complete ✅'
Repository: huggingface/transformers
Pull request: update bnb tests

Update bnb tests results as bnb has new kernels, the output will be slightly different, but still reasonable.

@SunMarc @ydshieh  Please review it

cc @Titus-von-Koeller @matthewdouglas 


Changed files:
filename: tests/quantization/bnb/test_4bit.py
patch: @@ -109,6 +109,7 @@ class Base4bitTest(unittest.TestCase):
     EXPECTED_OUTPUTS.add("Hello my name is John.\nI am a friend of your father.\n")
     EXPECTED_OUTPUTS.add("Hello my name is John Doe, I am a student at the University")
     EXPECTED_OUTPUTS.add("Hello my name is John and I am 25 years old.")
+    EXPECTED_OUTPUTS.add("Hello my name is John and I am a student at the University of")
     MAX_NEW_TOKENS = 10
 
     def setUp(self):
Repository: facebook/react
Pull request: Reopen #22481 Fixed modal closing issue

@bvaughn  fix #22481 hope this is fine

Changed files:
filename: packages/react-devtools-shared/src/devtools/views/hooks.js
patch: @@ -239,7 +239,7 @@ export function useModalDismissSignal(
       ownerDocument = ((modalRef.current: any): HTMLDivElement).ownerDocument;
       ownerDocument.addEventListener('keydown', handleDocumentKeyDown);
       if (dismissOnClickOutside) {
-        ownerDocument.addEventListener('click', handleDocumentClick);
+        ownerDocument.addEventListener('click', handleDocumentClick, true);
       }
     }, 0);
 
@@ -250,7 +250,7 @@ export function useModalDismissSignal(
 
       if (ownerDocument !== null) {
         ownerDocument.removeEventListener('keydown', handleDocumentKeyDown);
-        ownerDocument.removeEventListener('click', handleDocumentClick);
+        ownerDocument.removeEventListener('click', handleDocumentClick, true);
       }
     };
   }, [modalRef, dismissCallback, dismissOnClickOutside]);
Repository: electron/electron
Pull request: build: try removing `Read/WriteBarrier` patch

#### Description of Change

This patch no longer seems to be necessary after the GHA transition - let's delete it.

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [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: patches/node/.patches
patch: @@ -9,7 +9,6 @@ chore_allow_the_node_entrypoint_to_be_a_builtin_module.patch
 fix_handle_boringssl_and_openssl_incompatibilities.patch
 fix_crypto_tests_to_run_with_bssl.patch
 fix_account_for_debugger_agent_race_condition.patch
-fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch
 fix_serdes_test.patch
 feat_add_uv_loop_interrupt_on_io_change_option_to_uv_loop_configure.patch
 support_v8_sandboxed_pointers.patch

filename: patches/node/fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch
patch: @@ -1,29 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: Shelley Vohr <shelley.vohr@gmail.com>
-Date: Wed, 18 Aug 2021 11:25:39 +0200
-Subject: fix: _ReadBarrier undefined symbol error on WOA arm64
-
-The _ReadBarrier compiler intrinsic isn't present on WOA arm64 devices
-and as such is crashing in CI. This fixes the issue by defining them
-if they're missing.
-
-We should upstream or otherwise handle this.
-
-diff --git a/deps/histogram/src/hdr_atomic.h b/deps/histogram/src/hdr_atomic.h
-index 11b0cbd3facfdce648d7cf59ef3418e4e1049090..e1dfeaed6f0dd38aed5a0ddd5660d5b4ba4f46ab 100644
---- a/deps/histogram/src/hdr_atomic.h
-+++ b/deps/histogram/src/hdr_atomic.h
-@@ -14,6 +14,13 @@
- #include <intrin.h>
- #include <stdbool.h>
- 
-+#if !defined(_ReadBarrier) || !defined(_WriteBarrier)
-+
-+#define _ReadBarrier() __asm__ __volatile__("" ::: "memory")
-+#define _WriteBarrier() __asm__ __volatile__("" ::: "memory")
-+
-+#endif
-+
- static void __inline * hdr_atomic_load_pointer(void** pointer)
- {
- 	_ReadBarrier();
Repository: nodejs/node
Pull request: url: improve urlpattern regexp performance

Thanks to @erikcorry's recommendation, we can speed up regexp performance of URLPattern

Benchmarks show no improvement, but I believe that is due to our lack of proper benchmark cases. (we don't have any benchmarks that use *)

Benchmark CI: https://ci.nodejs.org/view/Node.js%20benchmark/job/benchmark-node-micro-benchmarks/1658

```
confidence improvement accuracy (*)   (**)  (***)
url/urlpattern-parse.js n=100000 pattern='"[https://(sub.)?example(.com/)foo](https://(sub.)/?example(.com/)foo)"'                                                                  -0.34 %       ±0.57% ±0.76% ±1.01%
url/urlpattern-parse.js n=100000 pattern='{"hostname":"xn--caf-dma.com"}'                                                                *     -0.50 %       ±0.48% ±0.64% ±0.84%
url/urlpattern-parse.js n=100000 pattern='{"pathname":"/([[a-z]--a])"}'                                                                        -0.31 %       ±0.34% ±0.45% ±0.59%
url/urlpattern-parse.js n=100000 pattern='{"pathname":"/foo","search":"bar","hash":"baz","baseURL":"https://example.com:8080/"}'                -0.07 %       ±0.34% ±0.46% ±0.59%
url/urlpattern-test.js n=100000 pattern='"[https://(sub.)?example(.com/)foo](https://(sub.)/?example(.com/)foo)"'                                                             *      0.72 %       ±0.63% ±0.84% ±1.10%
url/urlpattern-test.js n=100000 pattern='{"hostname":"xn--caf-dma.com"}'                                                                       -0.39 %       ±0.89% ±1.20% ±1.58%
url/urlpattern-test.js n=100000 pattern='{"pathname":"/([[a-z]--a])"}'                                                                   *      0.74 %       ±0.59% ±0.78% ±1.02%
url/urlpattern-test.js n=100000 pattern='{"pathname":"/foo","search":"bar","hash":"baz","baseURL":"https://example.com:8080/"}'                  0.20 %       ±0.75% ±0.99% ±1.29%
```

Changed files:
filename: src/node_url_pattern.cc
patch: @@ -77,7 +77,7 @@ URLPatternRegexProvider::create_instance(std::string_view pattern,
                                          bool ignore_case) {
   auto isolate = Isolate::GetCurrent();
   auto env = Environment::GetCurrent(isolate);
-  int flags = RegExp::Flags::kUnicodeSets;
+  int flags = RegExp::Flags::kUnicodeSets | RegExp::Flags::kDotAll;
   if (ignore_case) {
     flags |= static_cast<int>(RegExp::Flags::kIgnoreCase);
   }
Repository: denoland/deno
Pull request: fix(ext/node): `mkdir()` parse file mode

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

Changed files:
filename: ext/node/polyfills/_fs/_fs_mkdir.ts
patch: @@ -7,7 +7,10 @@ import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
 import { promisify } from "ext:deno_node/internal/util.mjs";
 import { denoErrorToNodeError } from "ext:deno_node/internal/errors.ts";
 import { getValidatedPath } from "ext:deno_node/internal/fs/utils.mjs";
-import { validateBoolean } from "ext:deno_node/internal/validators.mjs";
+import {
+  parseFileMode,
+  validateBoolean,
+} from "ext:deno_node/internal/validators.mjs";
 
 /**
  * TODO: Also accept 'path' parameter as a Node polyfill Buffer type once these
@@ -31,12 +34,14 @@ export function mkdir(
   if (typeof options == "function") {
     callback = options;
   } else if (typeof options === "number") {
-    mode = options;
+    mode = parseFileMode(options, "mode");
   } else if (typeof options === "boolean") {
     recursive = options;
   } else if (options) {
     if (options.recursive !== undefined) recursive = options.recursive;
-    if (options.mode !== undefined) mode = options.mode;
+    if (options.mode !== undefined) {
+      mode = parseFileMode(options.mode, "options.mode");
+    }
   }
   validateBoolean(recursive, "options.recursive");
 
@@ -64,12 +69,14 @@ export function mkdirSync(path: string | URL, options?: MkdirOptions) {
   let recursive = false;
 
   if (typeof options === "number") {
-    mode = options;
+    mode = parseFileMode(options, "mode");
   } else if (typeof options === "boolean") {
     recursive = options;
   } else if (options) {
     if (options.recursive !== undefined) recursive = options.recursive;
-    if (options.mode !== undefined) mode = options.mode;
+    if (options.mode !== undefined) {
+      mode = parseFileMode(options.mode, "options.mode");
+    }
   }
   validateBoolean(recursive, "options.recursive");
 

filename: tests/unit_node/_fs/_fs_mkdir_test.ts
patch: @@ -29,6 +29,23 @@ Deno.test({
   },
 });
 
+Deno.test({
+  name: "[node/fs] mkdir mode",
+  fn: () => {
+    mkdirSync(tmpDir, { mode: 0o777 });
+    assert(existsSync(tmpDir));
+    assert(Deno.statSync(tmpDir).mode! & 0o777);
+
+    Deno.removeSync(tmpDir);
+
+    mkdirSync(tmpDir, { mode: "0777" });
+    assert(existsSync(tmpDir));
+    assert(Deno.statSync(tmpDir).mode! & 0o777);
+
+    Deno.removeSync(tmpDir);
+  },
+});
+
 Deno.test("[std/node/fs] mkdir callback isn't called twice if error is thrown", async () => {
   const tempDir = await Deno.makeTempDir();
   const subdir = path.join(tempDir, "subdir");
Repository: ggml-org/llama.cpp
Pull request: server : remove swa_full warning

With `ggml_set_rows()` this warning is no longer relevant.

Changed files:
filename: src/llama-context.cpp
patch: @@ -145,11 +145,6 @@ llama_context::llama_context(
                 __func__, n_ctx_per_seq, hparams.n_ctx_train);
     }
 
-    if (!params.swa_full && cparams.n_seq_max > 1 && hparams.is_swa_any()) {
-        LLAMA_LOG_WARN("%s: requested n_seq_max (%u) > 1, but swa_full is not enabled -- performance may be degraded: %s\n",
-                __func__, cparams.n_seq_max, "https://github.com/ggml-org/llama.cpp/pull/13845#issuecomment-2924800573");
-    }
-
     if (!hparams.vocab_only) {
         // GPU backends
         for (auto * dev : model.devices) {
Repository: denoland/deno
Pull request: fix(npm): reduce occurrences of duplicate packages due to peer dep resolution

* https://github.com/denoland/deno_npm/pull/87

Closes #26626

Changed files:
filename: Cargo.lock
patch: @@ -1502,7 +1502,7 @@ dependencies = [
  "deno_lint",
  "deno_lockfile 0.25.0",
  "deno_media_type",
- "deno_npm 0.28.0",
+ "deno_npm 0.29.0",
  "deno_npm_cache",
  "deno_package_json",
  "deno_path_util",
@@ -2149,7 +2149,7 @@ dependencies = [
  "deno_fs",
  "deno_media_type",
  "deno_node",
- "deno_npm 0.28.0",
+ "deno_npm 0.29.0",
  "deno_path_util",
  "deno_resolver",
  "deno_runtime",
@@ -2384,9 +2384,9 @@ dependencies = [
 
 [[package]]
 name = "deno_npm"
-version = "0.28.0"
+version = "0.29.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "43418480889ca9de951229b9d09a9b75d2581ed9645643036207977b966246aa"
+checksum = "e9391c57ce81d58e83ef4b2e45d001a2674a758a1c914e8562512c147257bc6d"
 dependencies = [
  "async-trait",
  "capacity_builder 0.5.0",
@@ -2411,7 +2411,7 @@ dependencies = [
  "boxed_error",
  "deno_cache_dir",
  "deno_error",
- "deno_npm 0.28.0",
+ "deno_npm 0.29.0",
  "deno_path_util",
  "deno_semver",
  "deno_unsync",
@@ -2562,7 +2562,7 @@ dependencies = [
  "deno_config",
  "deno_error",
  "deno_media_type",
- "deno_npm 0.28.0",
+ "deno_npm 0.29.0",
  "deno_package_json",
  "deno_path_util",
  "deno_semver",
@@ -2966,7 +2966,7 @@ dependencies = [
  "deno_error",
  "deno_lib",
  "deno_media_type",
- "deno_npm 0.28.0",
+ "deno_npm 0.29.0",
  "deno_package_json",
  "deno_path_util",
  "deno_resolver",

filename: Cargo.toml
patch: @@ -60,7 +60,7 @@ deno_graph = "=0.89.2"
 deno_lint = "=0.74.0"
 deno_lockfile = "=0.25.0"
 deno_media_type = { version = "=0.2.8", features = ["module_specifier"] }
-deno_npm = "=0.28.0"
+deno_npm = "=0.29.0"
 deno_path_util = "=0.3.2"
 deno_permissions = { version = "0.55.0", path = "./runtime/permissions" }
 deno_runtime = { version = "0.204.0", path = "./runtime" }
Repository: huggingface/transformers
Pull request: fix mpt test of different outputs from cuda

The tests `RUN_SLOW=1 pytest -rA tests/models/mpt/test_modeling_mpt.py::MptIntegrationTests::test_generation_batched` got result error on XPU.

The outputs of the MPT model are slightly different from CUDA, we need another result check for XPU. Besides, we need to use require_deterministic_for_xpu so xpu can get stable outputs.

Hi @SunMarc , please review this PR. Thanks

Changed files:
filename: tests/models/mpt/test_modeling_mpt.py
patch: @@ -20,6 +20,7 @@
 from transformers.testing_utils import (
     Expectations,
     require_bitsandbytes,
+    require_deterministic_for_xpu,
     require_torch,
     require_torch_accelerator,
     slow,
@@ -483,6 +484,7 @@ def test_generation(self):
         decoded_output = tokenizer.decode(outputs[0], skip_special_tokens=True)
         self.assertEqual(decoded_output, expected_output)
 
+    @require_deterministic_for_xpu
     def test_generation_batched(self):
         model_id = "mosaicml/mpt-7b"
         tokenizer = AutoTokenizer.from_pretrained(model_id)
@@ -498,10 +500,19 @@ def test_generation_batched(self):
 
         inputs = tokenizer(input_texts, return_tensors="pt", padding=True).to(torch_device)
 
-        expected_output = [
-            "Hello my name is Tiffany and I am a mother of two beautiful children. I have been a nanny for the",
-            "Today I am going at the gym and then I am going to go to the grocery store. I am going to buy some food and some",
-        ]
+        expected_outputs = Expectations(
+            {
+                ("xpu", 3): [
+                    "Hello my name is Tiffany. I am a mother of two beautiful children. I have been a nanny for over",
+                    "Today I am going at the gym and then I am going to go to the mall with my mom. I am going to go to the",
+                ],
+                ("cuda", 7): [
+                    "Hello my name is Tiffany and I am a mother of two beautiful children. I have been a nanny for the",
+                    "Today I am going at the gym and then I am going to go to the grocery store. I am going to buy some food and some",
+                ],
+            }
+        )
+        expected_output = expected_outputs.get_expectation()
         outputs = model.generate(**inputs, max_new_tokens=20)
 
         decoded_outputs = tokenizer.batch_decode(outputs, skip_special_tokens=True)