helloadhavan/github_issues huggingface dataset:
Repository: ollama/ollama
Pull request: fix: parallel queueing race condition caused silent failure

As of the most recent llama.cpp update concurrent requests had a race condition that would result in an empty response.

This was not easy to observe since the response from the llm runner subprocess was a 200 with the error {"content":"slot unavailable"} in the response stream, which just silently closed the channel.

This change resolves this by allowing multiple slots in the llm runner subprocess. We manage the queueing ourselves so this should be ok. @dhiltgen this may be a case we need to account for in the cgo changes.

Changed files:
filename: llm/llama.go
patch: @@ -341,6 +341,7 @@ func newLlama(model string, adapters, projectors []string, runners []ModelRunner
 		"--ctx-size", fmt.Sprintf("%d", opts.NumCtx),
 		"--batch-size", fmt.Sprintf("%d", opts.NumBatch),
 		"--n-gpu-layers", fmt.Sprintf("%d", numGPU),
+		"--parallel", "2",
 		"--embedding",
 	}
 
@@ -631,34 +632,37 @@ func (llm *llama) Predict(ctx context.Context, predict PredictOpts, fn func(Pred
 				continue
 			}
 
-			if evt, ok := bytes.CutPrefix(line, []byte("data: ")); ok {
-				var p prediction
-				if err := json.Unmarshal(evt, &p); err != nil {
-					return fmt.Errorf("error unmarshaling llm prediction response: %v", err)
-				}
+			evt, ok := bytes.CutPrefix(line, []byte("data: "))
+			if !ok {
+				return fmt.Errorf("error parsing llm response stream: %s", line)
+			}
 
-				if p.Content != "" {
-					fn(PredictResult{
-						Model:     predict.Model,
-						CreatedAt: time.Now().UTC(),
-						Content:   p.Content,
-					})
-				}
+			var p prediction
+			if err := json.Unmarshal(evt, &p); err != nil {
+				return fmt.Errorf("error unmarshaling llm prediction response: %v", err)
+			}
 
-				if p.Stop {
-					fn(PredictResult{
-						Model:         predict.Model,
-						CreatedAt:     time.Now().UTC(),
-						TotalDuration: time.Since(predict.CheckpointStart),
-
-						Done:               true,
-						PromptEvalCount:    p.Timings.PromptN,
-						PromptEvalDuration: parseDurationMs(p.Timings.PromptMS),
-						EvalCount:          p.Timings.PredictedN,
-						EvalDuration:       parseDurationMs(p.Timings.PredictedMS),
-					})
-					return nil
-				}
+			if p.Content != "" {
+				fn(PredictResult{
+					Model:     predict.Model,
+					CreatedAt: time.Now().UTC(),
+					Content:   p.Content,
+				})
+			}
+
+			if p.Stop {
+				fn(PredictResult{
+					Model:         predict.Model,
+					CreatedAt:     time.Now().UTC(),
+					TotalDuration: time.Since(predict.CheckpointStart),
+
+					Done:               true,
+					PromptEvalCount:    p.Timings.PromptN,
+					PromptEvalDuration: parseDurationMs(p.Timings.PromptMS),
+					EvalCount:          p.Timings.PredictedN,
+					EvalDuration:       parseDurationMs(p.Timings.PredictedMS),
+				})
+				return nil
 			}
 		}
 	}
Repository: denoland/deno
Pull request: feat(upgrade): ability to show additional message on upgrade


Changed files:
filename: cli/tools/upgrade.rs
patch: @@ -529,6 +529,12 @@ pub async fn upgrade(
     return Ok(());
   };
 
+  let banner_handle = spawn_banner_task(
+    &selected_version_to_upgrade.version_or_hash,
+    selected_version_to_upgrade.release_channel,
+    http_client_provider.get_or_create()?,
+  );
+
   let download_url = get_download_url(
     &selected_version_to_upgrade.version_or_hash,
     requested_version.release_channel(),
@@ -605,6 +611,10 @@ pub async fn upgrade(
     .await;
   }
 
+  if let Ok(Some(text)) = banner_handle.await {
+    log::info!("\n{}\n", text);
+  }
+
   drop(temp_dir); // delete the temp dir
   Ok(())
 }
@@ -881,6 +891,41 @@ fn get_download_url(
   })
 }
 
+fn spawn_banner_task(
+  version: &str,
+  release_channel: ReleaseChannel,
+  client: HttpClient,
+) -> deno_core::unsync::JoinHandle<Option<String>> {
+  let banner_url = get_banner_url(version, release_channel);
+  deno_core::unsync::spawn(async move {
+    let banner_url = banner_url?;
+    tokio::select! {
+      result = client.download_text(banner_url) => {
+        result.ok()
+      }
+      _ = tokio::time::sleep(Duration::from_secs(5)) => {
+        None
+      }
+    }
+  })
+}
+
+fn get_banner_url(
+  version: &str,
+  release_channel: ReleaseChannel,
+) -> Option<Url> {
+  let download_url = match release_channel {
+    ReleaseChannel::Stable => {
+      format!("{}/v{}/banner.txt", DL_RELEASE_URL, version)
+    }
+    ReleaseChannel::Rc | ReleaseChannel::Lts | ReleaseChannel::Canary => {
+      return None;
+    }
+  };
+
+  Url::parse(&download_url).ok()
+}
+
 async fn download_package(
   client: &HttpClient,
   download_url: Url,
Repository: facebook/react
Pull request: [compiler] Todo for for-await loops

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):
* __->__ #29118

Adds a todo for `for await` syntax. 

Closes #29113

Changed files:
filename: compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts
patch: @@ -1008,6 +1008,16 @@ function lowerStatement(
       const initBlock = builder.reserve("loop");
       const testBlock = builder.reserve("loop");
 
+      if (stmt.node.await) {
+        builder.errors.push({
+          reason: `(BuildHIR::lowerStatement) Handle for-await loops`,
+          severity: ErrorSeverity.Todo,
+          loc: stmt.node.loc ?? null,
+          suggestions: null,
+        });
+        return;
+      }
+
       const loopBlock = builder.enter("block", (_blockId) => {
         return builder.loop(label, initBlock.id, continuationBlock.id, () => {
           const body = stmt.get("body");

filename: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-for-await-loops.expect.md
patch: @@ -0,0 +1,32 @@
+
+## Input
+
+```javascript
+async function Component({ items }) {
+  const x = [];
+  for await (const item of items) {
+    x.push(item);
+  }
+  return x;
+}
+
+```
+
+
+## Error
+
+```
+  1 | async function Component({ items }) {
+  2 |   const x = [];
+> 3 |   for await (const item of items) {
+    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+> 4 |     x.push(item);
+    | ^^^^^^^^^^^^^^^^^
+> 5 |   }
+    | ^^^^ Todo: (BuildHIR::lowerStatement) Handle for-await loops (3:5)
+  6 |   return x;
+  7 | }
+  8 |
+```
+          
+      
\ No newline at end of file

filename: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.todo-for-await-loops.js
patch: @@ -0,0 +1,7 @@
+async function Component({ items }) {
+  const x = [];
+  for await (const item of items) {
+    x.push(item);
+  }
+  return x;
+}
Repository: electron/electron
Pull request: fix: crash when renderer process crashes while webview is reloading

Backport of #46735

See that PR for details.


Notes: Fix crash when renderer process crashes while webview is reloading


Changed files:
filename: shell/browser/api/electron_api_web_contents.cc
patch: @@ -4014,6 +4014,14 @@ void WebContents::ExitPictureInPicture() {
   PictureInPictureWindowManager::GetInstance()->ExitPictureInPicture();
 }
 
+bool WebContents::ShouldFocusPageAfterCrash(content::WebContents* source) {
+  // WebView uses WebContentsViewChildFrame, which doesn't have a Focus impl
+  // and triggers a fatal NOTREACHED.
+  if (is_guest())
+    return false;
+  return true;
+}
+
 void WebContents::DevToolsSaveToFile(const std::string& url,
                                      const std::string& content,
                                      bool save_as,

filename: shell/browser/api/electron_api_web_contents.h
patch: @@ -710,6 +710,7 @@ class WebContents final : public ExclusiveAccessContext,
   content::PictureInPictureResult EnterPictureInPicture(
       content::WebContents* web_contents) override;
   void ExitPictureInPicture() override;
+  bool ShouldFocusPageAfterCrash(content::WebContents* source) override;
 
   // InspectableWebContentsDelegate:
   void DevToolsSaveToFile(const std::string& url,

filename: spec/webview-spec.ts
patch: @@ -1895,6 +1895,28 @@ describe('<webview> tag', function () {
 
         expect(channel).to.equal('onbeforeunload');
       });
+
+      it('does not crash when renderer process crashes', async function () {
+        // It takes more time to wait for the rendering process to crash
+        this.timeout(120000);
+        await loadWebView(w, {
+          nodeintegration: 'on',
+          webpreferences: 'contextIsolation=no',
+          src: blankPageUrl
+        });
+        // Create a crash in the rendering process of a webview
+        await w.executeJavaScript(`new Promise((resolve, reject) => {
+          webview.addEventListener('render-process-gone', (e) => resolve({...e}), {once: true})
+          webview.executeJavaScript('process.crash()', true)
+        })`);
+        // Reload the webview and the main process will not crash.
+        await w.executeJavaScript(`new Promise((resolve, reject) => {
+          webview.reload()
+          webview.addEventListener('did-finish-load', () => {
+            resolve()
+          })
+        })`);
+      });
     });
 
     describe('<webview>.goForward()', () => {
Repository: nodejs/node
Pull request: doc: run license-builder

License is likely out of date. This is an automatically generated PR by the `license-builder.yml` GitHub Action, which runs `license-builder.sh` and submits a new PR or updates an existing PR.

Changed files:
filename: LICENSE
patch: @@ -2100,7 +2100,7 @@ The externally maintained libraries used by Node.js are:
 
 - inspector_protocol, located at deps/inspector_protocol, is licensed as follows:
   """
-    // Copyright 2016 The Chromium Authors. All rights reserved.
+    // Copyright 2016 The Chromium Authors.
     //
     // Redistribution and use in source and binary forms, with or without
     // modification, are permitted provided that the following conditions are
Repository: facebook/react
Pull request: [compiler:playground] Fix broken builds

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):
* __->__ #29122

Now that the compiler is public, the `*` version was grabbing the latest
version of the compiler off of npm and was resolving to my very first
push to npm (an empty package containing only a single package.json).
This was breaking the playground as it would attempt to load the
compiler but then crash the babel pipeline due to the node module not
being found.

Changed files:
filename: compiler/apps/playground/package.json
patch: @@ -25,7 +25,6 @@
     "@monaco-editor/react": "^4.4.6",
     "@playwright/test": "^1.42.1",
     "@use-gesture/react": "^10.2.22",
-    "babel-plugin-react-compiler": "*",
     "hermes-eslint": "^0.14.0",
     "invariant": "^2.2.4",
     "lz-string": "^1.5.0",

filename: compiler/packages/snap/package.json
patch: @@ -25,7 +25,6 @@
     "@babel/preset-typescript": "^7.18.6",
     "@parcel/watcher": "^2.1.0",
     "@testing-library/react": "^13.4.0",
-    "babel-plugin-react-compiler": "*",
     "babel-plugin-syntax-hermes-parser": "^0.15.1",
     "chalk": "4",
     "fbt": "^1.0.0",

filename: compiler/yarn.lock
patch: @@ -3745,11 +3745,6 @@ babel-plugin-polyfill-regenerator@^0.5.0:
   dependencies:
     "@babel/helper-define-polyfill-provider" "^0.4.0"
 
-babel-plugin-react-compiler@*:
-  version "0.0.0"
-  resolved "https://registry.yarnpkg.com/babel-plugin-react-compiler/-/babel-plugin-react-compiler-0.0.0.tgz#1a1f9867fad83f217f0b3fe6f1b94cca0b77b68b"
-  integrity sha512-Kigl0V36a/6hLVH7+CCe1CCtU3mFBqBd829V//VtuG7I/pyq+B2QZJqOefd63snQmdfCryNhO9XW1FbGPBvYDA==
-
 babel-plugin-syntax-hermes-parser@^0.15.1:
   version "0.15.1"
   resolved "https://registry.yarnpkg.com/babel-plugin-syntax-hermes-parser/-/babel-plugin-syntax-hermes-parser-0.15.1.tgz#d115ee9761a808af590a9b2a0b568115e25ea743"
Repository: vercel/next.js
Pull request: [turbopack] Add an execution test for the behavior when a module throws an error

Confirms that we don't re-evaluate modules after an error

Clearing the require.cache allows us to re-evaluate

Closes PACK-5407

Changed files:
filename: turbopack/crates/turbopack-tests/tests/execution/turbopack/evaluation-errors/basic/input/index.js
patch: @@ -0,0 +1,23 @@
+it('module evaluation rethrows but does not re-evaluate', async () => {
+  expect(globalThis.evalCounter).toBeUndefined()
+  await assertThrowsThrows()
+  expect(globalThis.evalCounter).toBe(1)
+  await assertThrowsThrows()
+  expect(globalThis.evalCounter).toBe(1)
+
+  // We do re-evaluate if the module cache is cleared
+  require.cache[require.resolve('./throws')] = undefined
+  await assertThrowsThrows()
+  expect(globalThis.evalCounter).toBe(2)
+  await assertThrowsThrows()
+  expect(globalThis.evalCounter).toBe(2)
+})
+
+async function assertThrowsThrows() {
+  try {
+    await import('./throws')
+  } catch (e) {
+    return e
+  }
+  throw new Error('should have thrown')
+}

filename: turbopack/crates/turbopack-tests/tests/execution/turbopack/evaluation-errors/basic/input/throws.js
patch: @@ -0,0 +1,4 @@
+globalThis.evalCounter ??= 0
+globalThis.evalCounter++
+
+throw new Error('uh oh')
Repository: electron/electron
Pull request: fix: vibrancy window border

Backport of #46648

See that PR for details.


Notes: Fixed the border style of windows with vibrancy on macOS.


Changed files:
filename: shell/browser/native_window_mac.h
patch: @@ -225,6 +225,7 @@ class NativeWindowMac : public NativeWindow,
   bool CanMaximize() const override;
   std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView(
       views::Widget* widget) override;
+  void OnWidgetInitialized() override;
 
   // ui::NativeThemeObserver:
   void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;

filename: shell/browser/native_window_mac.mm
patch: @@ -1861,6 +1861,28 @@ int NonClientHitTest(const gfx::Point& point) override {
   return std::nullopt;
 }
 
+void NativeWindowMac::OnWidgetInitialized() {
+  // |window_| is not yet assigned when this function is called, so we need to
+  // get the window from the widget.
+  NSWindow* window = widget()->GetNativeWindow().GetNativeNSWindow();
+
+  // In |NativeWidgetNSWindowBridge::InitCompositorView| in Chromium,
+  // translucent windows are assigned a clear background color. This causes
+  // undesirable side effects, such as a window with vibrancy losing its natural
+  // system border highlight. We undo that behavior here.
+  //
+  // Ref:
+  // https://source.chromium.org/chromium/chromium/src/+/main:components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm;l=1341-1342;drc=e7c8be576285195257b0813326b3bab154dc7e73
+  if (!transparent()) {
+    if ([[window backgroundColor] isEqual:NSColor.clearColor]) {
+      [window setBackgroundColor:NSColor.windowBackgroundColor];
+    }
+    if (![window isOpaque]) {
+      [window setOpaque:YES];
+    }
+  }
+}
+
 // static
 std::unique_ptr<NativeWindow> NativeWindow::Create(
     const gin_helper::Dictionary& options,
Repository: ollama/ollama
Pull request: fix: encode full previous prompt in context

I believe this is a bug from the chat API changes, only the most recent request/response was added to the context history. It should be the full prompt after rebuilding the history. This shouldn't be in any released version.

Changed files:
filename: server/routes.go
patch: @@ -277,7 +277,7 @@ func GenerateHandler(c *gin.Context) {
 			}
 
 			if r.Done && !req.Raw {
-				embd, err := loaded.runner.Encode(c.Request.Context(), req.Prompt+generated.String())
+				embd, err := loaded.runner.Encode(c.Request.Context(), prompt+generated.String())
 				if err != nil {
 					ch <- gin.H{"error": err.Error()}
 					return
Repository: huggingface/transformers
Pull request: Avoid `T5GemmaModelTest::test_eager_matches_sdpa_inference` being flaky

# What does this PR do?

See https://app.circleci.com/pipelines/github/huggingface/transformers/144943/workflows/f4bc060c-b21f-4528-9393-9fadc27fe49e/jobs/1916024

This is specific to `T5GemmaForTokenClassification` (maybe `T5GemmaForSequenceClassification` too), as they specify 

> self.model(use_cache=False, ...)

and goes through

```
        if attention_mask is None and past_key_values is None:
            attention_mask = make_default_2d_attention_mask(input_ids, inputs_embeds, self.config.pad_token_id)
```

The logic is correct, but a sequence of no place to attend is problematic in terms of numerical equivalence.

Changed files:
filename: tests/models/t5gemma/test_modeling_t5gemma.py
patch: @@ -202,6 +202,15 @@ def prepare_config_and_inputs(self):
         input_ids = torch.where(input_ids == self.bos_token_id, 42, input_ids)
         decoder_input_ids = torch.where(decoder_input_ids == self.bos_token_id, 42, decoder_input_ids)
 
+        # Avoid leading PAD tokens from inputs.
+        # `T5GemmaForTokenClassification` and `T5GemmaForSequenceClassification` specify `use_cache=False` when
+        # calling `self.model`. For `self.use_attention_mask=False` case below, the model goes through
+        # `make_default_2d_attention_mask`. When there are some pad tokens at the beginning of a sequence, it can't
+        # attend to any place, and the computed mask `[-3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38, -3.4028e+38]`
+        # causes larger differences in some equivalence tests.
+        # Let's avoid such leading PAD tokens.
+        decoder_input_ids[:, 0] = self.pad_token_id + 1
+
         attention_mask = None
         decoder_attention_mask = None
         if self.use_attention_mask:
Repository: nodejs/node
Pull request: doc: "if and only if" should be "if" in util.parseArgs default value

The default value is legal by means other than defaulting.

<!--
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/util.md
patch: @@ -1955,10 +1955,12 @@ changes:
       times. If `true`, all values will be collected in an array. If
       `false`, values for the option are last-wins. **Default:** `false`.
     * `short` {string} A single character alias for the option.
-    * `default` {string | boolean | string\[] | boolean\[]} The default value to
-      be used if (and only if) the option does not appear in the arguments to be
-      parsed. It must be of the same type as the `type` property. When `multiple`
-      is `true`, it must be an array.
+    * `default` {string | boolean | string\[] | boolean\[]} The value to assign to
+      the option if it does not appear in the arguments to be parsed. The value
+      must match the type specified by the `type` property. If `multiple` is
+      `true`, it must be an array. No default value is applied when the option
+      does appear in the arguments to be parsed, even if the provided value
+      is falsy.
   * `strict` {boolean} Should an error be thrown when unknown arguments
     are encountered, or when arguments are passed that do not match the
     `type` configured in `options`.
Repository: electron/electron
Pull request: fix: vibrancy window border

#### Description of Change

Chromium sets some properties on NSWindow when we initialize a widget with support for translucency (added in #46392). This causes undesirable visual effects, such as the loss of the window border (see #46586).

The easiest fix is to patch out the unintended Chromium code. We set both properties ourselves when appropriate.

Fixes #46586
Ref: #46392

#### Checklist

- [x] PR description included and stakeholders cc'd
- [x] `npm test` passes
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
- [ ] relevant API documentation, tutorials, and examples are updated and follow the [documentation style guide](https://github.com/electron/electron/blob/main/docs/development/style-guide.md)
- [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 the border style of windows with vibrancy on macOS.


Changed files:
filename: shell/browser/native_window_mac.h
patch: @@ -225,6 +225,7 @@ class NativeWindowMac : public NativeWindow,
   bool CanMaximize() const override;
   std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView(
       views::Widget* widget) override;
+  void OnWidgetInitialized() override;
 
   // ui::NativeThemeObserver:
   void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;

filename: shell/browser/native_window_mac.mm
patch: @@ -1862,6 +1862,28 @@ int NonClientHitTest(const gfx::Point& point) override {
   return std::nullopt;
 }
 
+void NativeWindowMac::OnWidgetInitialized() {
+  // |window_| is not yet assigned when this function is called, so we need to
+  // get the window from the widget.
+  NSWindow* window = widget()->GetNativeWindow().GetNativeNSWindow();
+
+  // In |NativeWidgetNSWindowBridge::InitCompositorView| in Chromium,
+  // translucent windows are assigned a clear background color. This causes
+  // undesirable side effects, such as a window with vibrancy losing its natural
+  // system border highlight. We undo that behavior here.
+  //
+  // Ref:
+  // https://source.chromium.org/chromium/chromium/src/+/main:components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm;l=1341-1342;drc=e7c8be576285195257b0813326b3bab154dc7e73
+  if (!transparent()) {
+    if ([[window backgroundColor] isEqual:NSColor.clearColor]) {
+      [window setBackgroundColor:NSColor.windowBackgroundColor];
+    }
+    if (![window isOpaque]) {
+      [window setOpaque:YES];
+    }
+  }
+}
+
 // static
 std::unique_ptr<NativeWindow> NativeWindow::Create(
     const gin_helper::Dictionary& options,