helloadhavan/github_issues huggingface dataset:
Repository: ggml-org/llama.cpp
Pull request: gritlm: add initial README.md to examples/gritlm

This commit adds a suggestion for an initial README.md for the gritlm example.

Changed files:
filename: examples/gritlm/README.md
patch: @@ -0,0 +1,62 @@
+## Generative Representational Instruction Tuning (GRIT) Example
+[gritlm] a model which can generate embeddings as well as "normal" text
+generation depending on the instructions in the prompt.
+
+* Paper: https://arxiv.org/pdf/2402.09906.pdf
+
+### Retrieval-Augmented Generation (RAG) use case
+One use case for `gritlm` is to use it with RAG. If we recall how RAG works is
+that we take documents that we want to use as context, to ground the large
+language model (LLM), and we create token embeddings for them. We then store
+these token embeddings in a vector database.
+
+When we perform a query, prompt the LLM, we will first create token embeddings
+for the query and then search the vector database to retrieve the most
+similar vectors, and return those documents so they can be passed to the LLM as
+context. Then the query and the context will be passed to the LLM which will
+have to _again_ create token embeddings for the query. But because gritlm is used
+the first query can be cached and the second query tokenization generation does
+not have to be performed at all.
+
+### Running the example
+Download a Grit model:
+```console
+$ scripts/hf.sh --repo cohesionet/GritLM-7B_gguf --file gritlm-7b_q4_1.gguf
+```
+
+Run the example using the downloaded model:
+```console
+$ ./gritlm -m gritlm-7b_q4_1.gguf
+
+Cosine similarity between "Bitcoin: A Peer-to-Peer Electronic Cash System" and "A purely peer-to-peer version of electronic cash w" is: 0.605
+Cosine similarity between "Bitcoin: A Peer-to-Peer Electronic Cash System" and "All text-based language problems can be reduced to" is: 0.103
+Cosine similarity between "Generative Representational Instruction Tuning" and "A purely peer-to-peer version of electronic cash w" is: 0.112
+Cosine similarity between "Generative Representational Instruction Tuning" and "All text-based language problems can be reduced to" is: 0.547
+
+Oh, brave adventurer, who dared to climb
+The lofty peak of Mt. Fuji in the night,
+When shadows lurk and ghosts do roam,
+And darkness reigns, a fearsome sight.
+
+Thou didst set out, with heart aglow,
+To conquer this mountain, so high,
+And reach the summit, where the stars do glow,
+And the moon shines bright, up in the sky.
+
+Through the mist and fog, thou didst press on,
+With steadfast courage, and a steadfast will,
+Through the darkness, thou didst not be gone,
+But didst climb on, with a steadfast skill.
+
+At last, thou didst reach the summit's crest,
+And gazed upon the world below,
+And saw the beauty of the night's best,
+And felt the peace, that only nature knows.
+
+Oh, brave adventurer, who dared to climb
+The lofty peak of Mt. Fuji in the night,
+Thou art a hero, in the eyes of all,
+For thou didst conquer this mountain, so bright.
+```
+
+[gritlm]: https://github.com/ContextualAI/gritlm
Repository: facebook/react
Pull request: Fix:- Fixed dev tools inspect mode on Shadow dom

Fixes #26200 

### PR explanation

I tried to induce the change by the `event.composed` to check whether the event was created in a  ShadowRoot, And replaced `pointerOver` with `pointerMove`,  pointerOver event did not fired correctly

Before PR:-

https://github.com/facebook/react/assets/72331432/67a33dcd-447f-4c68-9c3c-ad954baddeb8

After PR:-

https://github.com/facebook/react/assets/72331432/9f986ff2-785f-4cba-a504-44f82ea9fc5a





Changed files:
filename: packages/react-devtools-shared/src/backend/views/Highlighter/index.js
patch: @@ -46,7 +46,7 @@ export default function setupHighlighter(
       window.addEventListener('mouseover', onMouseEvent, true);
       window.addEventListener('mouseup', onMouseEvent, true);
       window.addEventListener('pointerdown', onPointerDown, true);
-      window.addEventListener('pointerover', onPointerOver, true);
+      window.addEventListener('pointermove', onPointerMove, true);
       window.addEventListener('pointerup', onPointerUp, true);
     } else {
       agent.emit('startInspectingNative');
@@ -74,7 +74,7 @@ export default function setupHighlighter(
       window.removeEventListener('mouseover', onMouseEvent, true);
       window.removeEventListener('mouseup', onMouseEvent, true);
       window.removeEventListener('pointerdown', onPointerDown, true);
-      window.removeEventListener('pointerover', onPointerOver, true);
+      window.removeEventListener('pointermove', onPointerMove, true);
       window.removeEventListener('pointerup', onPointerUp, true);
     } else {
       agent.emit('stopInspectingNative');
@@ -151,14 +151,17 @@ export default function setupHighlighter(
     event.preventDefault();
     event.stopPropagation();
 
-    selectFiberForNode(((event.target: any): HTMLElement));
+    selectFiberForNode(getEventTarget(event));
   }
 
-  function onPointerOver(event: MouseEvent) {
+  let lastHoveredNode: HTMLElement | null = null;
+  function onPointerMove(event: MouseEvent) {
     event.preventDefault();
     event.stopPropagation();
 
-    const target = ((event.target: any): HTMLElement);
+    const target: HTMLElement = getEventTarget(event);
+    if (lastHoveredNode === target) return;
+    lastHoveredNode = target;
 
     if (target.tagName === 'IFRAME') {
       const iframe: HTMLIFrameElement = (target: any);
@@ -197,4 +200,12 @@ export default function setupHighlighter(
     // because those are usually unintentional as you lift the cursor.
     {leading: false},
   );
+
+  function getEventTarget(event: MouseEvent): HTMLElement {
+    if (event.composed) {
+      return (event.composedPath()[0]: any);
+    }
+
+    return (event.target: any);
+  }
 }
Repository: nodejs/node
Pull request: lib: use SafeMap primordial for ActiveAsyncContextFrame

Not sure if this was intentional, but `(In)ActiveAsyncContextFrame` seems to extend `Map` without using primordials

Tracked down the change to ef6b9ffc8dfc7b2a395c864d2729a0ce1be9ef18

Cc @bengl

Changed files:
filename: lib/internal/async_context_frame.js
patch: @@ -2,6 +2,7 @@
 
 const {
   ObjectSetPrototypeOf,
+  SafeMap,
 } = primordials;
 
 const {
@@ -11,7 +12,7 @@ const {
 
 let enabled_;
 
-class ActiveAsyncContextFrame extends Map {
+class ActiveAsyncContextFrame extends SafeMap {
   static get enabled() {
     return true;
   }
@@ -50,7 +51,7 @@ function checkEnabled() {
   return enabled;
 }
 
-class InactiveAsyncContextFrame extends Map {
+class InactiveAsyncContextFrame extends SafeMap {
   static get enabled() {
     enabled_ ??= checkEnabled();
     return enabled_;
Repository: electron/electron
Pull request: build: bump NMV to 133

#### Description of Change

Node PR: https://github.com/nodejs/node/pull/56513

Do not merge before attached Node PR is merged. This PR updates our NMV to 133 for Electron 35

Please merge this PR before branching 35-x-y

#### Checklist
<!-- Remove items that do not apply. For completed items, change [ ] to [x]. -->

- [ ] PR description included and stakeholders cc'd
- [ ] `npm test` passes
- [ ] tests are [changed or added](https://github.com/electron/electron/blob/main/docs/development/testing.md)
- [ ] relevant documentation, tutorials, templates and examples are changed or added
- [ ] [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: build/args/all.gn
patch: @@ -2,7 +2,7 @@ is_electron_build = true
 root_extra_deps = [ "//electron" ]
 
 # Registry of NMVs --> https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json
-node_module_version = 132
+node_module_version = 133
 
 v8_promise_internal_field_count = 1
 v8_embedder_string = "-electron.0"
Repository: ggml-org/llama.cpp
Pull request: gritlm : add --outdir option to hf.sh script

This commit updates the hf.sh script usage to include the --outdir option and specifies the models directory as the output directory.

The motivation for this is to avoid cluttering the root directory with model files.

Changed files:
filename: examples/gritlm/README.md
patch: @@ -21,12 +21,12 @@ not have to be performed at all.
 ### Running the example
 Download a Grit model:
 ```console
-$ scripts/hf.sh --repo cohesionet/GritLM-7B_gguf --file gritlm-7b_q4_1.gguf
+$ scripts/hf.sh --repo cohesionet/GritLM-7B_gguf --file gritlm-7b_q4_1.gguf --outdir models
 ```
 
 Run the example using the downloaded model:
 ```console
-$ ./gritlm -m gritlm-7b_q4_1.gguf
+$ ./gritlm -m models/gritlm-7b_q4_1.gguf
 
 Cosine similarity between "Bitcoin: A Peer-to-Peer Electronic Cash System" and "A purely peer-to-peer version of electronic cash w" is: 0.605
 Cosine similarity between "Bitcoin: A Peer-to-Peer Electronic Cash System" and "All text-based language problems can be reduced to" is: 0.103
Repository: facebook/react
Pull request: Remove XHR support from Flight

We currently support passing an XHR request to Flight for broader compat and possibly better perf than `fetch()`. However, it's a little tricky because ideally the RSC protocol is really meant to support binary data too. XHR does support binary but it doesn't support it while also streaming.

We could maybe support this only when you know it's going to be only text streams but it has some limitations in how we can encode separators if we can't use binary.

Nobody is really asking for this so we might as well delete it.

Changed files:
filename: fixtures/flight-browser/index.html
patch: @@ -73,12 +73,6 @@ <h1>Flight Example</h1>
         let data = ReactServerDOMClient.createFromFetch(
           fetch(url)
         );
-        // The client also supports XHR streaming.
-        // var xhr = new XMLHttpRequest();
-        // xhr.open('GET', url);
-        // let data = ReactServerDOMClient.createFromXHR(xhr);
-        // xhr.send();
-
         renderResult(data);
       }
 

filename: packages/react-server-dom-webpack/src/ReactFlightDOMClientBrowser.js
patch: @@ -17,7 +17,6 @@ import {
   createResponse,
   getRoot,
   reportGlobalError,
-  processStringChunk,
   processBinaryChunk,
   close,
 } from 'react-client/src/ReactFlightClient';
@@ -92,32 +91,6 @@ function createFromFetch<T>(
   return getRoot(response);
 }
 
-function createFromXHR<T>(
-  request: XMLHttpRequest,
-  options?: Options,
-): Thenable<T> {
-  const response: FlightResponse = createResponseFromOptions(options);
-  let processedLength = 0;
-  function progress(e: ProgressEvent): void {
-    const chunk = request.responseText;
-    processStringChunk(response, chunk, processedLength);
-    processedLength = chunk.length;
-  }
-  function load(e: ProgressEvent): void {
-    progress(e);
-    close(response);
-  }
-  function error(e: ProgressEvent): void {
-    reportGlobalError(response, new TypeError('Network error'));
-  }
-  request.addEventListener('progress', progress);
-  request.addEventListener('load', load);
-  request.addEventListener('error', error);
-  request.addEventListener('abort', error);
-  request.addEventListener('timeout', error);
-  return getRoot(response);
-}
-
 function encodeReply(
   value: ReactServerValue,
 ): Promise<
@@ -129,7 +102,6 @@ function encodeReply(
 }
 
 export {
-  createFromXHR,
   createFromFetch,
   createFromReadableStream,
   encodeReply,
Repository: nodejs/node
Pull request: http: coerce content-length to number

Fixes: https://github.com/nodejs/node/issues/57456

Either we implictly convert or throw an error. Id would convert it.
We can use one the million tricks to convert it to integer `~~`, `+`, `*1` etc... not sure whats consistent with the rest of the project, I found `~~` used often

Changed files:
filename: lib/_http_outgoing.js
patch: @@ -650,7 +650,7 @@ function matchHeader(self, state, field, value) {
       break;
     case 'content-length':
       state.contLen = true;
-      self._contentLength = value;
+      self._contentLength = +value;
       self._removedContLen = false;
       break;
     case 'date':

filename: test/parallel/test-http-content-length-mismatch.js
patch: @@ -78,3 +78,23 @@ function shouldThrowOnFewerBytes() {
 shouldThrowOnMoreBytes();
 shouldNotThrow();
 shouldThrowOnFewerBytes();
+
+
+{
+  const server = http.createServer(common.mustCall((req, res) => {
+    res.strictContentLength = true;
+    // Pass content-length as string
+    res.setHeader('content-length', '5');
+    res.end('12345');
+  }));
+
+
+  server.listen(0, common.mustCall(() => {
+    http.get({ port: server.address().port }, common.mustCall((res) => {
+      res.resume().on('end', common.mustCall(() => {
+        assert.strictEqual(res.statusCode, 200);
+        server.close();
+      }));
+    }));
+  }));
+}
Repository: denoland/deno
Pull request: fix(unstable): lint plugin `:exit` called at wrong time

The `:exit` selectors were called at the wrong time during visiting.

They need to be called when going upwards and a node and all its children have been fully visited. Instead we called it when the node + all its sibling were visited which is wrong.

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

Changed files:
filename: cli/js/40_lint.js
patch: @@ -1186,11 +1186,6 @@ function traverse(ctx, visitors, idx, cancellationToken) {
     if (childIdx > AST_IDX_INVALID) {
       traverse(ctx, visitors, childIdx, cancellationToken);
     }
-
-    const nextIdx = readNext(buf, idx);
-    if (nextIdx > AST_IDX_INVALID) {
-      traverse(ctx, visitors, nextIdx, cancellationToken);
-    }
   } finally {
     if (exits !== null) {
       for (let i = 0; i < exits.length; i++) {
@@ -1199,6 +1194,11 @@ function traverse(ctx, visitors, idx, cancellationToken) {
       }
     }
   }
+
+  const nextIdx = readNext(buf, idx);
+  if (nextIdx > AST_IDX_INVALID) {
+    traverse(ctx, visitors, nextIdx, cancellationToken);
+  }
 }
 
 /**

filename: tests/unit/lint_plugin_test.ts
patch: @@ -101,6 +101,31 @@ Deno.test("Plugin - visitor enter/exit", () => {
   assertEquals(both.map((t) => t.selector), ["Identifier", "Identifier:exit"]);
 });
 
+// https://github.com/denoland/deno/issues/28227
+Deno.test("Plugin - visitor enter/exit #2", () => {
+  const log: string[] = [];
+
+  testPlugin("{}\nfoo;", {
+    create() {
+      return {
+        "*": (node: Deno.lint.Node) => log.push(`-> ${node.type}`),
+        "*:exit": (node: Deno.lint.Node) => log.push(`<- ${node.type}`),
+      };
+    },
+  });
+
+  assertEquals(log, [
+    "-> Program",
+    "-> BlockStatement",
+    "<- BlockStatement",
+    "-> ExpressionStatement",
+    "-> Identifier",
+    "<- Identifier",
+    "<- ExpressionStatement",
+    "<- Program",
+  ]);
+});
+
 Deno.test("Plugin - visitor descendant", () => {
   let result = testVisit(
     "if (false) foo; if (false) bar()",
Repository: vercel/next.js
Pull request: [devtools] fix: adjust width for responsiveness

It was left out of https://github.com/vercel/next.js/pull/80732, I was fooled by the offline storybook.

Changed files:
filename: packages/next/src/next-devtools/dev-overlay/components/devtools-panel/devtools-panel.tsx
patch: @@ -159,12 +159,14 @@ export const DEVTOOLS_PANEL_STYLES = css`
   [data-nextjs-devtools-panel-overlay] {
     padding: initial;
     margin: auto;
+    width: 100%;
     /* TODO: This is for fullscreen mode. */
     /* top: 10vh; */
 
     @media (max-width: 575px) {
       left: 20px !important;
       right: 20px !important;
+      width: auto;
     }
 
     @media (min-width: 576px) {
Repository: huggingface/transformers
Pull request: Create test for #38916 (custom generate from local dir with imports)

#38916 was missing a test. We check that custom generate from a local dir with relative imports works properly.

The test is not conventional, so I appreciate the review :)

Changed files:
filename: tests/generation/test_utils.py
patch: @@ -22,6 +22,7 @@
 import tempfile
 import unittest
 import warnings
+from pathlib import Path
 
 import numpy as np
 import pytest
@@ -4995,6 +4996,27 @@ def test_custom_generate_requires_trust_remote_code(self):
         with self.assertRaises(ValueError):
             model.generate(**model_inputs, custom_generate="transformers-community/custom_generate_example")
 
+    def test_custom_generate_local_directory(self):
+        """Tests that custom_generate works with local directories containing importable relative modules"""
+        with tempfile.TemporaryDirectory() as tmp_dir:
+            custom_generate_dir = Path(tmp_dir) / "custom_generate"
+            custom_generate_dir.mkdir()
+            with open(custom_generate_dir / "generate.py", "w") as f:
+                f.write("from .helper import ret_success\ndef generate(*args, **kwargs):\n    return ret_success()\n")
+            with open(custom_generate_dir / "helper.py", "w") as f:
+                f.write('def ret_success():\n    return "success"\n')
+            model = AutoModelForCausalLM.from_pretrained(
+                "hf-internal-testing/tiny-random-MistralForCausalLM", device_map="auto"
+            )
+            tokenizer = AutoTokenizer.from_pretrained("hf-internal-testing/tiny-random-MistralForCausalLM")
+            model_inputs = tokenizer("Hello, world!", return_tensors="pt").to(model.device)
+            value = model.generate(
+                **model_inputs,
+                custom_generate=str(tmp_dir),
+                trust_remote_code=True,
+            )
+            assert value == "success"
+
 
 @require_torch
 class TokenHealingTestCase(unittest.TestCase):
Repository: huggingface/transformers
Pull request: [`Generate`] Fix no grad on some models

Generate does not need gradients which is not propagated correctly for a few edge cases when the function itself is inherited and no super call is made. It a TIL for me :D 

Not the most important PR but should be done nonetheless imo.

Changed files:
filename: src/transformers/models/bark/modeling_bark.py
patch: @@ -1265,6 +1265,7 @@ def forward(
             attentions=all_self_attentions,
         )
 
+    @torch.no_grad()
     def generate(
         self,
         coarse_output: torch.Tensor,

filename: src/transformers/models/patchtsmixer/modeling_patchtsmixer.py
patch: @@ -1720,6 +1720,7 @@ def forward(
             scale=scale,
         )
 
+    @torch.no_grad()
     def generate(
         self,
         past_values: torch.Tensor,
@@ -2104,6 +2105,7 @@ def forward(
             hidden_states=model_output.hidden_states,
         )
 
+    @torch.no_grad()
     def generate(
         self,
         past_values: torch.Tensor,

filename: src/transformers/models/patchtst/modeling_patchtst.py
patch: @@ -1724,6 +1724,7 @@ def forward(
             scale=scale,
         )
 
+    @torch.no_grad()
     def generate(
         self,
         past_values: torch.Tensor,
@@ -1933,6 +1934,7 @@ def forward(
             attentions=model_output.attentions,
         )
 
+    @torch.no_grad()
     def generate(
         self,
         past_values: torch.Tensor,
Repository: nodejs/node
Pull request: src: improve error handling in `node_env_var.cc`

Refs: https://github.com/nodejs/node/pull/57707#discussion_r2029934600
<!--
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: src/node_env_var.cc
patch: @@ -436,15 +436,14 @@ static Intercepted EnvGetter(Local<Name> property,
   MaybeLocal<String> value_string =
       env->env_vars()->Get(env->isolate(), property.As<String>());
 
-  bool has_env = !value_string.IsEmpty();
   TraceEnvVar(env, "get", property.As<String>());
 
-  if (has_env) {
-    // ToLocalChecked here is ok since we check IsEmpty above.
-    info.GetReturnValue().Set(value_string.ToLocalChecked());
-    return Intercepted::kYes;
+  Local<Value> ret;
+  if (!value_string.ToLocal(&ret)) {
+    return Intercepted::kNo;
   }
-  return Intercepted::kNo;
+  info.GetReturnValue().Set(ret);
+  return Intercepted::kYes;
 }
 
 static Intercepted EnvSetter(Local<Name> property,
Repository: vercel/next.js
Pull request: Turbopack Build: Fix edge-config-validation test

## What?

This test is correct but in Turbopack we correctly leave out `/` since middleware is not a route by itself.

Closes PACK-4883

Changed files:
filename: test/production/edge-config-validations/index.test.ts
patch: @@ -25,7 +25,7 @@ describe('Edge config validations', () => {
     const res = await next.build()
     expect(res.exitCode).toBe(1)
     expect(res.cliOutput).toContain(
-      '/middleware contains invalid middleware config: Expected string, received boolean at "unstable_allowDynamic", or Expected array, received boolean at "unstable_allowDynamic"'
+      'middleware contains invalid middleware config: Expected string, received boolean at "unstable_allowDynamic", or Expected array, received boolean at "unstable_allowDynamic"'
     )
   })
 })

filename: test/turbopack-build-tests-manifest.json
patch: @@ -19040,10 +19040,10 @@
     "runtimeError": false
   },
   "test/production/edge-config-validations/index.test.ts": {
-    "passed": [],
-    "failed": [
+    "passed": [
       "Edge config validations fails to build when unstable_allowDynamic is not a string"
     ],
+    "failed": [],
     "pending": [],
     "flakey": [],
     "runtimeError": false