helloadhavan/github_issues huggingface dataset:
Repository: huggingface/transformers
Pull request: bad_words_ids no longer slow on mps

# What does this PR do?
Using the `bad_words_ids` on mps is slowing down a lot the text generation, this PR tries to address that.

Fixes https://github.com/huggingface/transformers/issues/39512


## 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?

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.

 @ArthurZucker


Changed files:
filename: src/transformers/generation/logits_process.py
patch: @@ -1222,10 +1222,16 @@ def _prepare_bias_variables(self, scores: torch.FloatTensor):
         # Precompute the bias tensors to be applied. Sequences of length 1 are kept separately, as they can be applied
         # with simpler logic.
         self.length_1_bias = torch.zeros((vocabulary_size,), dtype=torch.float, device=scores.device)
+        # Extract single-token sequences and their biases
+        single_token_ids = []
+        single_token_biases = []
         for sequence_ids, bias in self.sequence_bias.items():
             if len(sequence_ids) == 1:
-                self.length_1_bias[sequence_ids[-1]] = bias
+                single_token_ids.append(sequence_ids[0])
+                single_token_biases.append(bias)
 
+        if single_token_ids:  # Only if we have any single-token sequences
+            self.length_1_bias[single_token_ids] = torch.tensor(single_token_biases, device=scores.device)
         self.prepared_bias_variables = True
 
     def _validate_arguments(self):
@@ -1340,10 +1346,10 @@ def __init__(
                     eos_token_id = [eos_token_id]
                 eos_token_id = torch.tensor(eos_token_id)
 
+            eos_token_id_list = eos_token_id.tolist()  # convert to python list before
             bad_words_ids = list(
-                filter(lambda bad_token_seq: all(bad_token_seq != [i] for i in eos_token_id), bad_words_ids)
+                filter(lambda bad_token_seq: all(bad_token_seq != [i] for i in eos_token_id_list), bad_words_ids)
             )
-
         # Forbidding a sequence is equivalent to setting its bias to -inf
         sequence_bias = {tuple(sequence): float("-inf") for sequence in bad_words_ids}
         super().__init__(sequence_bias=sequence_bias)
Repository: denoland/deno
Pull request: feat(otel): add events for boot failure and uncaught error

This commit adds "boot_failure" and "uncaught_exception"
events that are sent when a worker crashes during `deno run`.

Changed files:
filename: Cargo.toml
patch: @@ -269,7 +269,7 @@ zip = { version = "2.4.1", default-features = false, features = ["flate2"] }
 
 opentelemetry = "0.27.0"
 opentelemetry-http = "0.27.0"
-opentelemetry-otlp = { version = "0.27.0", features = ["logs", "http-proto", "http-json"] }
+opentelemetry-otlp = { version = "0.27.0", features = ["logs", "http-proto", "http-json", "populate-logs-event-name"] }
 opentelemetry-semantic-conventions = { version = "0.27.0", features = ["semconv_experimental"] }
 opentelemetry_sdk = { version = "0.27.0", features = ["rt-tokio", "trace"] }
 

filename: cli/tools/run/mod.rs
patch: @@ -94,9 +94,13 @@ pub async fn run_script(
       main_module.clone(),
       unconfigured_runtime,
     )
-    .await?;
+    .await
+    .inspect_err(|e| deno_telemetry::report_event("boot_failure", e))?;
 
-  let exit_code = worker.run().await?;
+  let exit_code = worker
+    .run()
+    .await
+    .inspect_err(|e| deno_telemetry::report_event("uncaught_exception", e))?;
   Ok(exit_code)
 }
 

filename: ext/telemetry/lib.rs
patch: @@ -1125,6 +1125,27 @@ fn op_otel_log_foreign(
   log_processor.emit(&mut log_record, builtin_instrumentation_scope);
 }
 
+pub fn report_event(name: &'static str, data: impl std::fmt::Display) {
+  let Some(OtelGlobals {
+    log_processor,
+    builtin_instrumentation_scope,
+    ..
+  }) = OTEL_GLOBALS.get()
+  else {
+    return;
+  };
+
+  let mut log_record = LogRecord::default();
+
+  log_record.set_observed_timestamp(SystemTime::now());
+  log_record.set_event_name(name);
+  log_record.set_severity_number(Severity::Trace);
+  log_record.set_severity_text(Severity::Trace.name());
+  log_record.set_body(format!("{data}").into());
+
+  log_processor.emit(&mut log_record, builtin_instrumentation_scope);
+}
+
 fn owned_string<'s>(
   scope: &mut v8::HandleScope<'s>,
   string: v8::Local<'s, v8::String>,
Repository: facebook/react
Pull request: Enable enableFilterEmptyStringAttributesDOM everywhere

## Summary

Stacked on [#28124](https://github.com/facebook/react/pull/28124) ([Diff against #28124](https://github.com/facebook/react/compare/eps1lon:fix/anchor-href-empty...eps1lon:feat/enableFilterEmptyStringAttributesDOM-canary))

Enables `enableFilterEmptyStringAttributesDOM` everywhere. I don't think this needs to be enabled behind `__VARIANT__` for RN since this flag is only used in DOM.

## How did you test this change?

- CI


Changed files:
filename: packages/shared/forks/ReactFeatureFlags.native-fb.js
patch: @@ -64,7 +64,7 @@ export const enableUseEffectEventHook = false;
 export const enableClientRenderFallbackOnTextMismatch = true;
 export const enableComponentStackLocations = false;
 export const enableLegacyFBSupport = false;
-export const enableFilterEmptyStringAttributesDOM = false;
+export const enableFilterEmptyStringAttributesDOM = true;
 export const enableGetInspectorDataForInstanceInProduction = true;
 
 export const enableRetryLaneExpiration = false;

filename: packages/shared/forks/ReactFeatureFlags.native-oss.js
patch: @@ -47,7 +47,7 @@ export const enableUseEffectEventHook = false;
 export const enableClientRenderFallbackOnTextMismatch = true;
 export const enableComponentStackLocations = false;
 export const enableLegacyFBSupport = false;
-export const enableFilterEmptyStringAttributesDOM = false;
+export const enableFilterEmptyStringAttributesDOM = true;
 export const enableGetInspectorDataForInstanceInProduction = false;
 
 export const enableRetryLaneExpiration = false;

filename: packages/shared/forks/ReactFeatureFlags.test-renderer.js
patch: @@ -47,7 +47,7 @@ export const enableUseEffectEventHook = false;
 export const enableClientRenderFallbackOnTextMismatch = true;
 export const enableComponentStackLocations = true;
 export const enableLegacyFBSupport = false;
-export const enableFilterEmptyStringAttributesDOM = false;
+export const enableFilterEmptyStringAttributesDOM = true;
 export const enableGetInspectorDataForInstanceInProduction = false;
 
 export const enableRetryLaneExpiration = false;

filename: packages/shared/forks/ReactFeatureFlags.test-renderer.native.js
patch: @@ -41,7 +41,7 @@ export const disableTextareaChildren = false;
 export const disableModulePatternComponents = false;
 export const enableComponentStackLocations = false;
 export const enableLegacyFBSupport = false;
-export const enableFilterEmptyStringAttributesDOM = false;
+export const enableFilterEmptyStringAttributesDOM = true;
 export const enableGetInspectorDataForInstanceInProduction = false;
 export const enableSuspenseAvoidThisFallback = false;
 export const enableSuspenseAvoidThisFallbackFizz = false;
Repository: ggml-org/llama.cpp
Pull request: sync : ggml


Changed files:
filename: scripts/sync-ggml.last
patch: @@ -1 +1 @@
-323951f1bdcdfbd5b5ff3a9a7c3770e63b1a560e
+978f6e1993f2eeb4e99b63d4e70b4401c0a2dae2
Repository: nodejs/node
Pull request: src: fix typo in comments

This PR fixes a typo in `node_sqlite.cc` file

Changed files:
filename: src/node_sqlite.cc
patch: @@ -1295,7 +1295,7 @@ void DatabaseSync::AggregateFunction(const FunctionCallbackInfo<Value>& args) {
       return;
     }
 
-    // Subract 1 because the first argument is the aggregate value.
+    // Subtract 1 because the first argument is the aggregate value.
     argc = js_len.As<Int32>()->Value() - 1;
     if (!inverseFunc.IsEmpty() &&
         !inverseFunc->Get(env->context(), env->length_string())
Repository: vercel/next.js
Pull request: [lint] keep lint-stage use faster linting

Using the eslint config with rules that need type information (`.eslintrc.cli.json`) takes too long when committing. This PR restores the previous commit speed by using the `.eslintrc.json` config instead, which does not require type information. Eslint rule violations for type-checked rules will now only be shown in CI, or when running `pnpm lint-eslint` locally.

Changed files:
filename: lint-staged.config.js
patch: @@ -1,7 +1,7 @@
 module.exports = {
   '*.{js,jsx,mjs,ts,tsx,mts,mdx}': [
     'prettier --with-node-modules --ignore-path .prettierignore --write',
-    'cross-env ESLINT_USE_FLAT_CONFIG=false eslint --config .eslintrc.cli.json --no-eslintrc --fix',
+    'cross-env ESLINT_USE_FLAT_CONFIG=false eslint --config .eslintrc.json --no-eslintrc --fix',
   ],
   '*.{json,md,css,html,yml,yaml,scss}': [
     'prettier --with-node-modules --ignore-path .prettierignore --write',
Repository: denoland/deno
Pull request: Revert "fix(fmt): upgrade markup_fmt and malva"

Reverts denoland/deno#29168

Ref: https://github.com/g-plane/malva/issues/34

Changed files:
filename: Cargo.lock
patch: @@ -5324,9 +5324,9 @@ dependencies = [
 
 [[package]]
 name = "malva"
-version = "0.12.0"
+version = "0.11.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5a10a4f69b1fd3c73e65e9b0446904f60019b7a746e10440d89fbb6e1659144b"
+checksum = "6a952f521471c6c8302a17fc0c64a512221a9d4ff268af4d43a02bc2be48c712"
 dependencies = [
  "aho-corasick",
  "itertools 0.14.0",
@@ -5337,9 +5337,9 @@ dependencies = [
 
 [[package]]
 name = "markup_fmt"
-version = "0.20.0"
+version = "0.19.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fbf2254c47336b12f41d91da52d985d6e5242f26e41b7cd48bf658f3446d959"
+checksum = "ff37c5cadfdf4d91c0f140d516755c055a184a4e37757ff4a071272635b9f546"
 dependencies = [
  "aho-corasick",
  "css_dataset",

filename: Cargo.toml
patch: @@ -296,8 +296,8 @@ env_logger = "=0.11.6"
 eszip = "=0.88.0"
 fancy-regex = "=0.14.0"
 libsui = "0.10.0"
-malva = "=0.12.0"
-markup_fmt = "=0.20.0"
+malva = "=0.11.2"
+markup_fmt = "=0.19.1"
 open = "5.0.1"
 pathdiff = "0.2.1"
 pretty_yaml = "=0.5.0"

filename: cli/tools/fmt.rs
patch: @@ -618,8 +618,6 @@ fn format_embedded_css(
       selector_override_comment_directive: "malva-selector-override".into(),
       ignore_comment_directive: "malva-ignore".into(),
       ignore_file_comment_directive: "malva-ignore-file".into(),
-      declaration_order_group_by:
-        config::DeclarationOrderGroupBy::NonDeclarationAndEmptyLine,
     },
   };
   // Wraps the text in a css block of `a { ... }`
@@ -722,7 +720,6 @@ fn format_embedded_html(
       script_formatter: None,
       ignore_comment_directive: "deno-fmt-ignore".into(),
       ignore_file_comment_directive: "deno-fmt-ignore-file".into(),
-      single_attr_same_line: true,
     },
   };
   let text = markup_fmt::format_text(
@@ -1477,8 +1474,6 @@ fn get_resolved_malva_config(
     selector_override_comment_directive: "deno-fmt-selector-override".into(),
     ignore_comment_directive: "deno-fmt-ignore".into(),
     ignore_file_comment_directive: "deno-fmt-ignore-file".into(),
-    declaration_order_group_by:
-      DeclarationOrderGroupBy::NonDeclarationAndEmptyLine,
   };
 
   FormatOptions {
@@ -1539,7 +1534,6 @@ fn get_resolved_markup_fmt_config(
     astro_attr_shorthand: Some(true),
     ignore_comment_directive: "deno-fmt-ignore".into(),
     ignore_file_comment_directive: "deno-fmt-ignore-file".into(),
-    single_attr_same_line: true,
   };
 
   FormatOptions {
Repository: ggml-org/llama.cpp
Pull request: server: fix SSE and OpenAI compatibility for error messages when streaming

This fixes compatibility with the SSE specification by not sending error messages out with an incompatible fieldname.
Therefore this also ensures proper exceptions when working for example with OpenAI client libraries, instead of being handled as an empty message.

Closes:
#16104

Changed files:
filename: tools/server/server.cpp
patch: @@ -4679,17 +4679,17 @@ int main(int argc, char ** argv) {
                     json res_json = result->to_json();
                     if (res_json.is_array()) {
                         for (const auto & res : res_json) {
-                            if (!server_sent_event(sink, "data", res)) {
+                            if (!server_sent_event(sink, res)) {
                                 // sending failed (HTTP connection closed), cancel the generation
                                 return false;
                             }
                         }
                         return true;
                     } else {
-                        return server_sent_event(sink, "data", res_json);
+                        return server_sent_event(sink, res_json);
                     }
                 }, [&](const json & error_data) {
-                    server_sent_event(sink, "error", error_data);
+                    server_sent_event(sink, json{{"error", error_data}});
                 }, [&sink]() {
                     // note: do not use req.is_connection_closed here because req is already destroyed
                     return !sink.is_writable();

filename: tools/server/utils.hpp
patch: @@ -459,9 +459,9 @@ static std::string tokens_to_output_formatted_string(const llama_context * ctx,
     return out;
 }
 
-static bool server_sent_event(httplib::DataSink & sink, const char * event, const json & data) {
+static bool server_sent_event(httplib::DataSink & sink, const json & data) {
     const std::string str =
-        std::string(event) + ": " +
+        "data: " +
         data.dump(-1, ' ', false, json::error_handler_t::replace) +
         "\n\n"; // required by RFC 8895 - A message is terminated by a blank line (two line terminators in a row).
Repository: electron/electron
Pull request: fix: correct electron gin embedder indices

#### Description of Change

Move Electron's extra embedders to the end of the enum so they do not interfere with Chromium embedder indices.
Also use `kEmbedderBlinkTag` directly in its index calculation without adding extra indices from other tags.

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [x] PR description included and stakeholders cc'd
- [ ] `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: Fixed invalid memory access in pdf viewer which lead to random crashes.


Changed files:
filename: patches/chromium/fix_harden_blink_scriptstate_maybefrom.patch
patch: @@ -43,15 +43,15 @@ diff --git a/gin/public/gin_embedders.h b/gin/public/gin_embedders.h
 index 8d7c5631fd8f1499c67384286f0e3c4037673b32..99b2e2f63be8a46c5546dd53bc9b05e8c54e857c 100644
 --- a/gin/public/gin_embedders.h
 +++ b/gin/public/gin_embedders.h
-@@ -18,6 +18,8 @@ namespace gin {
- enum GinEmbedder : uint16_t {
-   kEmbedderNativeGin,
+@@ -20,6 +20,8 @@ enum GinEmbedder : uint16_t {
    kEmbedderBlink,
-+  kEmbedderElectron,
-+  kEmbedderBlinkTag,
    kEmbedderPDFium,
    kEmbedderFuchsia,
++  kEmbedderElectron,
++  kEmbedderBlinkTag,
  };
+ 
+ }  // namespace gin
 diff --git a/third_party/blink/renderer/platform/bindings/script_state.cc b/third_party/blink/renderer/platform/bindings/script_state.cc
 index e4a27a24c83dd1a478b2ada8b6c8220076790791..c76dc818f38a62fff63852dbecbc85e304ac731d 100644
 --- a/third_party/blink/renderer/platform/bindings/script_state.cc
@@ -112,14 +112,13 @@ index b3cc8d819b06108386aed9465cab4f27a28b675f..a1757901e52360a9c2ec3c573adb20d0
    static constexpr int kV8ContextPerContextDataIndex =
        static_cast<int>(gin::kPerContextDataStartIndex) +
        static_cast<int>(gin::kEmbedderBlink);
-@@ -271,6 +278,11 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> {
+@@ -271,6 +278,10 @@ class PLATFORM_EXPORT ScriptState : public GarbageCollected<ScriptState> {
    // internals.idl.
    String last_compiled_script_file_name_;
    bool last_compiled_script_used_code_cache_ = false;
 +
 +  static constexpr int kV8ContextPerContextDataTagIndex =
 +      static_cast<int>(gin::kPerContextDataStartIndex) +
-+      static_cast<int>(gin::kEmbedderBlink) +
 +      static_cast<int>(gin::kEmbedderBlinkTag);
  };
Repository: denoland/deno
Pull request: ci: fix main


Changed files:
filename: .github/workflows/ci.generate.ts
patch: @@ -947,6 +947,7 @@ const ci = {
             'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.symcache gs://dl.deno.land/canary/$(git rev-parse HEAD)/',
             "echo ${{ github.sha }} > canary-latest.txt",
             'gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt',
+            "rm canary-latest.txt gha-creds-*.json",
           ].join("\n"),
         },
         {
@@ -1003,8 +1004,6 @@ const ci = {
           if: "matrix.job == 'test'",
           run: [
             'if [[ -n "$(git status --porcelain)" ]]; then',
-            'echo "🧾 Diff:"',
-            "git diff",
             'echo "❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files."',
             'echo ""',
             'echo "📋 Status:"',

filename: .github/workflows/ci.yml
patch: @@ -580,6 +580,7 @@ jobs:
           gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.symcache gs://dl.deno.land/canary/$(git rev-parse HEAD)/
           echo ${{ github.sha }} > canary-latest.txt
           gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt
+          rm canary-latest.txt gha-creds-*.json
       - name: Autobahn testsuite
         if: |-
           !(matrix.skip) && ((matrix.os == 'linux' && matrix.arch != 'aarch64') &&
@@ -616,7 +617,7 @@ jobs:
         run: cargo test --release --locked --features=panic-trace
       - name: Ensure no git changes
         if: '!(matrix.skip) && (matrix.job == ''test'')'
-        run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"\U0001F9FE Diff:\"\ngit diff\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
+        run: "if [[ -n \"$(git status --porcelain)\" ]]; then\necho \"❌ Git working directory is dirty. Ensure `cargo test` is not modifying git tracked files.\"\necho \"\"\necho \"\U0001F4CB Status:\"\ngit status\necho \"\"\nexit 1\nfi"
       - name: Configure hosts file for WPT
         if: '!(matrix.skip) && (matrix.wpt)'
         run: ./wpt make-hosts-file | sudo tee -a /etc/hosts
Repository: facebook/react
Pull request: Remove layout effect warning on the server

## Overview

This PR unfortunately removes the warning emitted when using layout effects on the server:

> useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.

## Why this warning exists
The new docs explain this really well. Adding a screenshot because as part of this change, we'll be removing these docs.

<img width="1562" alt="Screenshot 2023-03-15 at 10 56 17 AM" src="https://user-images.githubusercontent.com/2440089/225349148-f0e57c3f-95f5-4f2e-9178-d9b9b221c28d.png">

## Why are we changing it

In practice, users are not just ignoring this warning, but creating hooks to bypass this warning by switching the useLayoutEffect hook on the server instead of fixing it. This battle seems to be lost, so let's remove the warning so at least users don't need to use the indirection hook any more. In practice, if it's an issue, you should see the problems like flashing the wrong content on first load in development.


Changed files:
filename: packages/react-dom/src/__tests__/ReactDOMServerSelectiveHydration-test.internal.js
patch: @@ -1607,13 +1607,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
       );
     }
 
-    let finalHTML;
-    expect(() => {
-      finalHTML = ReactDOMServer.renderToString(<App />);
-    }).toErrorDev([
-      'useLayoutEffect does nothing on the server',
-      'useLayoutEffect does nothing on the server',
-    ]);
+    const finalHTML = ReactDOMServer.renderToString(<App />);
 
     assertLog(['App', 'A', 'B']);
 

filename: packages/react-server/src/ReactFizzHooks.js
patch: @@ -440,23 +440,6 @@ function useRef<T>(initialValue: T): {current: T} {
   }
 }
 
-export function useLayoutEffect(
-  create: () => (() => void) | void,
-  inputs: Array<mixed> | void | null,
-) {
-  if (__DEV__) {
-    currentHookNameInDev = 'useLayoutEffect';
-    console.error(
-      'useLayoutEffect does nothing on the server, because its effect cannot ' +
-        "be encoded into the server renderer's output format. This will lead " +
-        'to a mismatch between the initial, non-hydrated UI and the intended ' +
-        'UI. To avoid this, useLayoutEffect should only be used in ' +
-        'components that render exclusively on the client. ' +
-        'See https://reactjs.org/link/uselayouteffect-ssr for common fixes.',
-    );
-  }
-}
-
 function dispatchAction<A>(
   componentIdentity: Object,
   queue: UpdateQueue<A>,
@@ -633,7 +616,7 @@ export const HooksDispatcher: Dispatcher = {
   useRef,
   useState,
   useInsertionEffect: noop,
-  useLayoutEffect,
+  useLayoutEffect: noop,
   useCallback,
   // useImperativeHandle is not run in the server environment
   useImperativeHandle: noop,