helloadhavan/github_issues huggingface dataset:
Repository: facebook/react
Pull request: Convert ReactDOMServerIntegrationLegacyContext to createRoot


Changed files:
filename: packages/react-dom/src/__tests__/ReactDOMServerIntegrationLegacyContext-test.js
patch: @@ -14,26 +14,30 @@ const ReactDOMServerIntegrationUtils = require('./utils/ReactDOMServerIntegratio
 
 let PropTypes;
 let React;
-let ReactDOM;
+let ReactDOMClient;
 let ReactDOMServer;
 
 function initModules() {
   // Reset warning cache.
   jest.resetModules();
   PropTypes = require('prop-types');
   React = require('react');
-  ReactDOM = require('react-dom');
+  ReactDOMClient = require('react-dom/client');
   ReactDOMServer = require('react-dom/server');
 
   // Make them available to the helpers.
   return {
-    ReactDOM,
+    ReactDOMClient,
     ReactDOMServer,
   };
 }
 
-const {resetModules, itRenders, itThrowsWhenRendering} =
-  ReactDOMServerIntegrationUtils(initModules);
+const {
+  resetModules,
+  itRenders,
+  itThrowsWhenRendering,
+  clientRenderOnBadMarkup,
+} = ReactDOMServerIntegrationUtils(initModules);
 
 describe('ReactDOMServerIntegration', () => {
   beforeEach(() => {
@@ -272,7 +276,10 @@ describe('ReactDOMServerIntegration', () => {
             return {foo: 'bar'};
           }
         }
-        const e = await render(<ForgetfulParent />, 1);
+        const e = await render(
+          <ForgetfulParent />,
+          render === clientRenderOnBadMarkup ? 4 : 1,
+        );
         expect(e.textContent).toBe('nope');
       },
     );
Repository: nodejs/node
Pull request: module: fix incorrect formatting in require(esm) cycle error message

This pull request includes minor wording and punctuation tweaks to fix the formatting of the require(esm) cycle error message. The message still seems a bit confusing to me, but these changes should at least be an improvement.

I am not sure whether tests should be implemented for this change, as the original error message didn't have tests either, but I can try my hand at implementing some if that would be preferred.

Fixes: https://github.com/nodejs/node/issues/57451

Changed files:
filename: lib/internal/modules/esm/loader.js
patch: @@ -416,8 +416,8 @@ class ModuleLoader {
       if (parentFilename) {
         message += ` (from ${parentFilename})`;
       }
-      message += 'A cycle involving require(esm) is disallowed to maintain ';
-      message += 'invariants madated by the ECMAScript specification';
+      message += ' A cycle involving require(esm) is not allowed to maintain ';
+      message += 'invariants mandated by the ECMAScript specification. ';
       message += 'Try making at least part of the dependency in the graph lazily loaded.';
       throw new ERR_REQUIRE_CYCLE_MODULE(message);
Repository: ollama/ollama
Pull request: fix a typo in the tweetwriter example Modelfile


Changed files:
filename: examples/tweetwriter/Modelfile
patch: @@ -3,5 +3,5 @@
 
 FROM nous-hermes
 SYSTEM """
-You are a content marketer who needs to come up with a short but succinct tweet. Make sure to include the appropriate hashtags and links. Sometimes when appropriate, describe a meme that can be includes as well. All answers should be in the form of a tweet which has a max size of 280 characters. Every instruction will be the topic to create a tweet about.
+You are a content marketer who needs to come up with a short but succinct tweet. Make sure to include the appropriate hashtags and links. Sometimes when appropriate, describe a meme that can be included as well. All answers should be in the form of a tweet which has a max size of 280 characters. Every instruction will be the topic to create a tweet about.
 """
Repository: electron/electron
Pull request: perf: avoid double map lookup in HidChooserContext::DeviceRemoved()

Backport of #46343

See that PR for details.


Notes: none.

Changed files:
filename: shell/browser/hid/hid_chooser_context.cc
patch: @@ -253,10 +253,10 @@ void HidChooserContext::DeviceAdded(device::mojom::HidDeviceInfoPtr device) {
 
 void HidChooserContext::DeviceRemoved(device::mojom::HidDeviceInfoPtr device) {
   DCHECK(device);
-  DCHECK(devices_.contains(device->guid));
 
   // Update the device list.
-  devices_.erase(device->guid);
+  const size_t n_erased = devices_.erase(device->guid);
+  DCHECK_EQ(n_erased, 1U);
 
   // Notify all device observers.
   for (auto& observer : device_observer_list_)
Repository: ollama/ollama
Pull request: Add an example on multiline input

Source https://github.com/jmorganca/ollama/issues/169

I believe this example is useful for first-time users 😃 

Changed files:
filename: README.md
patch: @@ -54,6 +54,15 @@ ollama run llama2
 Hello! How can I help you today?
 ```
 
+For multiline input, you can wrap it with `"""`:
+
+```
+>>> """Hello,
+... world!
+... """
+I'm a basic program that prints the famous "Hello, world!" message to the console.
+```
+
 ### Create a custom model
 
 Pull a base model:
Repository: nodejs/node
Pull request: test: update parallel/test-tls-dhe for OpenSSL 3.5

The output of the `s_client` command invoked by the test has changed in the OpenSSL 3.5.0 version of `s_client`. Update the test so that it works with both the old and new output -- the `s_client` binary being run may not be at the exact same version of OpenSSL as used by Node.js so the updated test allows either output.

Refs: https://github.com/openssl/openssl/pull/26734
<!--
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: test/parallel/test-tls-dhe.js
patch: @@ -85,7 +85,10 @@ function test(dhparam, keylen, expectedCipher) {
 
     execFile(opensslCli, args, common.mustSucceed((stdout) => {
       assert(keylen === null ||
-             stdout.includes(`Server Temp Key: DH, ${keylen} bits`));
+             // s_client < OpenSSL 3.5
+             stdout.includes(`Server Temp Key: DH, ${keylen} bits`) ||
+             // s_client >= OpenSSL 3.5
+             stdout.includes(`Peer Temp Key: DH, ${keylen} bits`));
       assert(stdout.includes(`Cipher    : ${expectedCipher}`));
       server.close();
     }));
Repository: ollama/ollama
Pull request: fix embeddings invalid values

Embeddings were occasionally returning invalid values which meant we needed to reload and retry. This fix removes the cache token count which was causing this issue, and improves results. This also matches the llama.cpp example more closely.

It also adds the`unsafe.Slice` parsing that Mike suggested in my previous PR, upon further tests this actually works (and it seems faster).

Changed files:
filename: llama/llama.go
patch: @@ -94,7 +94,6 @@ import (
 	"io"
 	"log"
 	"os"
-	"reflect"
 	"strings"
 	"sync"
 	"unicode/utf8"
@@ -421,27 +420,20 @@ func (llm *LLM) Embedding(input string) ([]float64, error) {
 		return nil, errors.New("llama: tokenize embedding")
 	}
 
-	retval := C.llama_eval(llm.ctx, unsafe.SliceData(tokens), C.int(len(tokens)), C.llama_get_kv_cache_token_count(llm.ctx), C.int(llm.NumThread))
+	retval := C.llama_eval(llm.ctx, unsafe.SliceData(tokens), C.int(len(tokens)), 0, C.int(llm.NumThread))
 	if retval != 0 {
 		return nil, errors.New("llama: eval")
 	}
 
-	n := int(C.llama_n_embd(llm.ctx))
+	n := C.llama_n_embd(llm.ctx)
 	if n <= 0 {
 		return nil, errors.New("llama: no embeddings generated")
 	}
+	cEmbeddings := unsafe.Slice(C.llama_get_embeddings(llm.ctx), n)
 
-	embedPtr := C.llama_get_embeddings(llm.ctx)
-	if embedPtr == nil {
-		return nil, errors.New("llama: embedding retrieval failed")
+	embeddings := make([]float64, len(cEmbeddings))
+	for i, v := range cEmbeddings {
+		embeddings[i] = float64(v)
 	}
-
-	header := reflect.SliceHeader{
-		Data: uintptr(unsafe.Pointer(embedPtr)),
-		Len:  n,
-		Cap:  n,
-	}
-	embedSlice := *(*[]float64)(unsafe.Pointer(&header))
-
-	return embedSlice, nil
+	return embeddings, nil
 }

filename: server/images.go
patch: @@ -11,7 +11,6 @@ import (
 	"html/template"
 	"io"
 	"log"
-	"math"
 	"net/http"
 	"os"
 	"path/filepath"
@@ -480,31 +479,10 @@ func embeddingLayers(e EmbeddingParams) ([]*LayerReader, error) {
 						Total:     len(data) - 1,
 						Completed: i,
 					})
-					retry := 0
-				generate:
-					if retry > 3 {
-						log.Printf("failed to generate embedding for '%s' line %d: %v", filePath, i+1, err)
-						continue
-					}
 					embed, err := llm.Embedding(d)
 					if err != nil {
-						log.Printf("retrying embedding generation for '%s' line %d: %v", filePath, i+1, err)
-						retry++
-						goto generate
-					}
-					// Check for NaN and Inf in the embedding, which can't be stored
-					for _, value := range embed {
-						if math.IsNaN(value) || math.IsInf(value, 0) {
-							log.Printf("reloading model, embedding contains NaN or Inf")
-							// reload the model to get a new embedding, the seed can effect these outputs and reloading changes it
-							llm.Close()
-							llm, err = llama.New(e.model, e.opts)
-							if err != nil {
-								return nil, fmt.Errorf("load model to generate embeddings: %v", err)
-							}
-							retry++
-							goto generate
-						}
+						log.Printf("failed to generate embedding for '%s' line %d: %v", filePath, i+1, err)
+						continue
 					}
 					embeddings = append(embeddings, vector.Embedding{Data: d, Vector: embed})
 				}
Repository: vercel/next.js
Pull request: [turbopack] Fix the build under `--features=tokio_tracing`

## Fix the build under the `tokio_tracing` feature

https://github.com/vercel/next.js/pull/80738 changed the definition of LocalTaskSpec and moved the Display trait impl down to LocalTaskType but updating this use was missed since it is guarded by a feature.


Closes PACK-5224

Changed files:
filename: turbopack/crates/turbo-tasks/src/manager.rs
patch: @@ -810,7 +810,7 @@ impl<B: Backend + 'static> TurboTasks<B> {
         let description = format!(
             "[local] (parent: {}) {}",
             self.backend.get_task_description(parent_task_id),
-            ty,
+            ty.task_type,
         );
         #[cfg(not(feature = "tokio_tracing"))]
         let _ = parent_task_id; // suppress unused variable warning
Repository: huggingface/transformers
Pull request: Fix quantized cache with only cache_implementation in generate

# What does this PR do?

As per the title. It fixes the initialization of the Cache that changed after all the cache refactors

Changed files:
filename: src/transformers/generation/utils.py
patch: @@ -1990,19 +1990,20 @@ def _prepare_cache_for_generation(
                         "cache, please open an issue and tag @zucchini-nlp."
                     )
 
-                cache_config = (
-                    generation_config.cache_config
-                    if generation_config.cache_config is not None
-                    else {"backend": "quanto"}
-                )
-                cache_class = QUANT_BACKEND_CLASSES_MAPPING[cache_config["backend"]]
-
-                if cache_config["backend"] == "quanto" and not is_optimum_quanto_available():
+                cache_config = generation_config.cache_config if generation_config.cache_config is not None else {}
+                # Add the config if it was not provided, as it's a required argument
+                if "config" not in cache_config:
+                    cache_config["config"] = self.config.get_text_config()
+                # Pop the backend from the config (defaults to quanto if not defined)
+                backend = cache_config.pop("backend", "quanto")
+                cache_class = QUANT_BACKEND_CLASSES_MAPPING[backend]
+
+                if backend == "quanto" and not is_optimum_quanto_available():
                     raise ImportError(
                         "You need to install optimum-quanto in order to use KV cache quantization with optimum-quanto backend. "
                         "Please install it via  with `pip install optimum-quanto`"
                     )
-                elif cache_config["backend"] == "HQQ" and not is_hqq_available():
+                elif backend == "HQQ" and not is_hqq_available():
                     raise ImportError(
                         "You need to install `HQQ` in order to use KV cache quantization with HQQ backend. "
                         "Please install it via  with `pip install hqq`"
Repository: electron/electron
Pull request: perf: avoid double map lookup in HidChooserContext::DeviceRemoved()

#### Description of Change

Remove a redundant map lookup in `HidChooserContext::DeviceRemoved()`.

#### Checklist

- [x] PR description included and stakeholders cc'd
- [x] `npm test` passes
- [x] [PR release notes](https://github.com/electron/clerk/blob/main/README.md) describe the change in a way relevant to app developers, and are [capitalized, punctuated, and past tense](https://github.com/electron/clerk/blob/main/README.md#examples).

#### Release Notes

Notes: none.

Changed files:
filename: shell/browser/hid/hid_chooser_context.cc
patch: @@ -253,10 +253,10 @@ void HidChooserContext::DeviceAdded(device::mojom::HidDeviceInfoPtr device) {
 
 void HidChooserContext::DeviceRemoved(device::mojom::HidDeviceInfoPtr device) {
   DCHECK(device);
-  DCHECK(devices_.contains(device->guid));
 
   // Update the device list.
-  devices_.erase(device->guid);
+  const size_t n_erased = devices_.erase(device->guid);
+  DCHECK_EQ(n_erased, 1U);
 
   // Notify all device observers.
   for (auto& observer : device_observer_list_)
Repository: facebook/react
Pull request: Remove ReactTestUtils from refs-destruction-test

```diff
-expect(ReactTestUtils.isDOMComponent(maybeElement)).toBe(true);
+expect(maybeElement).toBeInstanceOf(Element);
```

It's not equivalent since `isDOMComponent` checks `maybeElement.nodeType === Element.ELEMENT_NODE && !!maybeElement.tagName` but `instanceof` check seems sufficient here. Checking `nodeType` is mostly for cross-realm checks and checking falsy `tagName` seems like a check specifically for incomplete DOM implementations because tagName can't be empty by spec I believe.

Changed files:
filename: packages/react-dom/src/__tests__/refs-destruction-test.js
patch: @@ -12,7 +12,6 @@
 let React;
 let ReactDOM;
 let ReactDOMClient;
-let ReactTestUtils;
 let TestComponent;
 let act;
 let theInnerDivRef;
@@ -25,7 +24,6 @@ describe('refs-destruction', () => {
     React = require('react');
     ReactDOM = require('react-dom');
     ReactDOMClient = require('react-dom/client');
-    ReactTestUtils = require('react-dom/test-utils');
     act = require('internal-test-utils').act;
 
     class ClassComponent extends React.Component {
@@ -75,7 +73,7 @@ describe('refs-destruction', () => {
       root.render(<TestComponent />);
     });
 
-    expect(ReactTestUtils.isDOMComponent(theInnerDivRef.current)).toBe(true);
+    expect(theInnerDivRef.current).toBeInstanceOf(Element);
     expect(theInnerClassComponentRef.current).toBeTruthy();
 
     root.unmount();
@@ -91,7 +89,7 @@ describe('refs-destruction', () => {
       root.render(<TestComponent />);
     });
 
-    expect(ReactTestUtils.isDOMComponent(theInnerDivRef.current)).toBe(true);
+    expect(theInnerDivRef.current).toBeInstanceOf(Element);
     expect(theInnerClassComponentRef.current).toBeTruthy();
 
     await act(async () => {
@@ -109,7 +107,7 @@ describe('refs-destruction', () => {
       root.render(<TestComponent />);
     });
 
-    expect(ReactTestUtils.isDOMComponent(theInnerDivRef.current)).toBe(true);
+    expect(theInnerDivRef.current).toBeInstanceOf(Element);
     expect(theInnerClassComponentRef.current).toBeTruthy();
 
     await act(async () => {
Repository: ggml-org/llama.cpp
Pull request: opencl: fix build targeting CL 2

`CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT` is added in OpenCL 3.0. It will become undefined when targeting OpenCL 2.x using `GGML_OPENCL_TARGET_VERSION`. This PR skips this query and assumes it's unavailable when targeting OpenCL 2.x when the implementation reports OpenCL 3.

Changed files:
filename: ggml/src/ggml-opencl/ggml-opencl.cpp
patch: @@ -2348,8 +2348,13 @@ static ggml_backend_opencl_context * ggml_cl2_init(ggml_backend_dev_t dev) {
         svm_caps & CL_DEVICE_SVM_ATOMICS ? "true" : "false");
 
     if (opencl_c_version.major >= 3) {
+        // Assume it is not available for 3.0, since it is optional in 3.0.
+        // If compiling against 3.0, then we can query.
+        backend_ctx->non_uniform_workgroups = false;
+#if CL_TARGET_OPENCL_VERSION >= 300
         CL_CHECK(clGetDeviceInfo(device, CL_DEVICE_NON_UNIFORM_WORK_GROUP_SUPPORT, sizeof(cl_bool),
                                  &backend_ctx->non_uniform_workgroups, 0));
+#endif
     } else {
         GGML_ASSERT(opencl_c_version.major == 2);
         // Non-uniform workgroup sizes is mandatory feature in v2.x.
Repository: nodejs/node
Pull request: doc: add deprecation mark to some documents in fs module

<!--
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.
-->

I added deprecation marks to the APIs that are deprecated in the fs module.

Changed files:
filename: doc/api/fs.md
patch: @@ -1119,6 +1119,8 @@ const { glob } = require('node:fs/promises');
 deprecated: v10.0.0
 -->
 
+> Stability: 0 - Deprecated
+
 * `path` {string|Buffer|URL}
 * `mode` {integer}
 * Returns: {Promise} Fulfills with `undefined` upon success.
@@ -3199,6 +3201,8 @@ changes:
                  it will emit a deprecation warning with id DEP0013.
 -->
 
+> Stability: 0 - Deprecated
+
 * `path` {string|Buffer|URL}
 * `mode` {integer}
 * `callback` {Function}
@@ -5718,6 +5722,8 @@ console.log(globSync('**/*.js'));
 deprecated: v0.4.7
 -->
 
+> Stability: 0 - Deprecated
+
 * `path` {string|Buffer|URL}
 * `mode` {integer}
Repository: electron/electron
Pull request: perf: avoid a double-map lookup in `NotificationPresenter::RemoveNotification()`

Backport of #46338

See that PR for details.


Notes: none.

Changed files:
filename: shell/browser/notifications/notification_presenter.cc
patch: @@ -27,13 +27,8 @@ base::WeakPtr<Notification> NotificationPresenter::CreateNotification(
 }
 
 void NotificationPresenter::RemoveNotification(Notification* notification) {
-  auto it = notifications_.find(notification);
-  if (it == notifications_.end()) {
-    return;
-  }
-
-  notifications_.erase(notification);
-  delete notification;
+  if (const auto nh = notifications_.extract(notification))
+    delete nh.value();
 }
 
 void NotificationPresenter::CloseNotificationWithId(
Repository: facebook/react
Pull request: Land enableClientRenderFallbackOnTextMismatch for www

This is landed, we can hardcode the flag

Changed files:
filename: packages/shared/forks/ReactFeatureFlags.www-dynamic.js
patch: @@ -29,7 +29,6 @@ export const enableUseDeferredValueInitialArg = __VARIANT__;
 export const enableRenderableContext = __VARIANT__;
 export const useModernStrictMode = __VARIANT__;
 export const enableRefAsProp = __VARIANT__;
-export const enableClientRenderFallbackOnTextMismatch = __VARIANT__;
 export const enableRetryLaneExpiration = __VARIANT__;
 export const retryLaneExpirationMs = 5000;
 export const syncLaneExpirationMs = 250;

filename: packages/shared/forks/ReactFeatureFlags.www.js
patch: @@ -38,7 +38,6 @@ export const {
   enableRenderableContext,
   useModernStrictMode,
   enableRefAsProp,
-  enableClientRenderFallbackOnTextMismatch,
 } = dynamicFeatureFlags;
 
 // On WWW, __EXPERIMENTAL__ is used for a new modern build.
@@ -49,7 +48,7 @@ export const enableProfilerTimer = __PROFILE__;
 export const enableProfilerCommitHooks = __PROFILE__;
 export const enableProfilerNestedUpdatePhase = __PROFILE__;
 export const enableUpdaterTracking = __PROFILE__;
-
+export const enableClientRenderFallbackOnTextMismatch = true;
 export const enableSuspenseAvoidThisFallback = true;
 export const enableSuspenseAvoidThisFallbackFizz = false;
Repository: ollama/ollama
Pull request: missed a backtick

somehow missed one backtick in near the top

Changed files:
filename: docs/api.md
patch: @@ -13,7 +13,7 @@
 
 ### Model name format
 
-The model name format today is model:tag`. Some examples are `orca:3b-q4_1` and `llama2:70b`. The tag is optional and if not provided will default to `latest`. The tag is used to identify a specific version.
+The model name format today is `model:tag`. Some examples are `orca:3b-q4_1` and `llama2:70b`. The tag is optional and if not provided will default to `latest`. The tag is used to identify a specific version.
 
 ### Durations