helloadhavan/github_issues huggingface dataset:
Repository: ggml-org/llama.cpp
Pull request: examples : switch retrieval to llama_encode

Also enable `--no-warmup` option for retrieval.

Warmup calls `llama_decode`, would it make sense to disable this for embedding models somehow?

Changed files:
filename: common/arg.cpp
patch: @@ -1678,7 +1678,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
         [](common_params & params) {
             params.warmup = false;
         }
-    ).set_examples({LLAMA_EXAMPLE_MAIN, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_EMBEDDING}));
+    ).set_examples({LLAMA_EXAMPLE_MAIN, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_EMBEDDING, LLAMA_EXAMPLE_RETRIEVAL}));
     add_opt(common_arg(
         {"--spm-infill"},
         string_format(

filename: examples/retrieval/retrieval.cpp
patch: @@ -81,14 +81,14 @@ static void batch_add_seq(llama_batch & batch, const std::vector<int32_t> & toke
     }
 }
 
-static void batch_decode(llama_context * ctx, llama_batch & batch, float * output, int n_seq, int n_embd) {
+static void batch_encode(llama_context * ctx, llama_batch & batch, float * output, int n_seq, int n_embd) {
     // clear previous kv_cache values (irrelevant for embeddings)
     llama_kv_self_clear(ctx);
 
     // run model
     LOG_INF("%s: n_tokens = %d, n_seq = %d\n", __func__, batch.n_tokens, n_seq);
-    if (llama_decode(ctx, batch) < 0) {
-        LOG_ERR("%s : failed to decode\n", __func__);
+    if (llama_encode(ctx, batch) < 0) {
+        LOG_ERR("%s : failed to encode\n", __func__);
     }
 
     for (int i = 0; i < batch.n_tokens; i++) {
@@ -233,7 +233,7 @@ int main(int argc, char ** argv) {
         // encode if at capacity
         if (batch.n_tokens + n_toks > n_batch) {
             float * out = emb + p * n_embd;
-            batch_decode(ctx, batch, out, s, n_embd);
+            batch_encode(ctx, batch, out, s, n_embd);
             common_batch_clear(batch);
             p += s;
             s = 0;
@@ -246,7 +246,7 @@ int main(int argc, char ** argv) {
 
     // final batch
     float * out = emb + p * n_embd;
-    batch_decode(ctx, batch, out, s, n_embd);
+    batch_encode(ctx, batch, out, s, n_embd);
 
     // save embeddings to chunks
     for (int i = 0; i < n_chunks; i++) {
@@ -267,7 +267,7 @@ int main(int argc, char ** argv) {
         batch_add_seq(query_batch, query_tokens, 0);
 
         std::vector<float> query_emb(n_embd, 0);
-        batch_decode(ctx, query_batch, query_emb.data(), 1, n_embd);
+        batch_encode(ctx, query_batch, query_emb.data(), 1, n_embd);
 
         common_batch_clear(query_batch);
Repository: huggingface/transformers
Pull request: Define warmup allocator for torchao quantization

# What does this PR do?

Since when computing the total number of bytes of a torchao quantized model using : `param_byte_count = param.numel() * param.element_size()` the `param.element_size()` is not correct, we need to account for that and have a factor of 4 for `int8` models and a factor of `8` for `int4` models

Changed files:
filename: src/transformers/quantizers/quantizer_torchao.py
patch: @@ -277,6 +277,45 @@ def is_serializable(self, safe_serialization=None) -> bool:
             return False
         return _is_torchao_serializable
 
+    def get_cuda_warm_up_factor(self):
+        """
+        This factor is used in caching_allocator_warmup to determine how many bytes to pre-allocate for CUDA warmup.
+        - A factor of 2 means we pre-allocate the full memory footprint of the model.
+        - A factor of 4 means we pre-allocate half of that, and so on
+
+        However, when using TorchAO, calculating memory usage with param.numel() * param.element_size() doesn't give the correct size for quantized weights (like int4 or int8)
+        That's because TorchAO internally represents quantized tensors using subtensors and metadata, and the reported element_size() still corresponds to the torch_dtype
+        not the actual bit-width of the quantized data.
+
+        To correct for this:
+        - Use a division factor of 8 for int4 weights
+        - Use a division factor of 4 for int8 weights
+        """
+        if self.quantization_config._get_ao_version() > version.Version("0.9.0"):
+            from torchao.core.config import AOBaseConfig
+
+            quant_type = self.quantization_config.quant_type
+            # For autoquant case, it will be treated in the string implementation below in map_to_target_dtype
+            if isinstance(quant_type, AOBaseConfig):
+                # Extract size digit using fuzzy match on the class name
+                config_name = quant_type.__class__.__name__
+                size_digit = fuzzy_match_size(config_name)
+
+                if size_digit == "4":
+                    return 8
+                else:
+                    return 4
+
+        # Original mapping for non-AOBaseConfig types
+        map_to_target_dtype = {
+            "int4_weight_only": 8,
+            "int8_weight_only": 4,
+            "int8_dynamic_activation_int8_weight": 4,
+            "autoquant": 4,
+        }
+
+        return map_to_target_dtype[self.quantization_config.quant_type]
+
     @property
     def is_trainable(self) -> bool:
         supported_quant_types_for_training = [
Repository: vercel/next.js
Pull request: @next/mdx: Use stable turbopack config options

Backport of #78261 to 15.3.x


Changed files:
filename: packages/next-mdx/index.js
patch: @@ -23,6 +23,9 @@ module.exports =
           },
         }
 
+    /**
+     * @type {import('next').NextConfig}
+     */
     let nextConfig = Object.assign({}, inputConfig, {
       webpack(config, options) {
         config.resolve.alias['next-mdx-import-source-file'] = [
@@ -44,22 +47,16 @@ module.exports =
     })
 
     if (process.env.TURBOPACK) {
-      nextConfig.experimental = Object.assign({}, nextConfig?.experimental, {
-        turbo: Object.assign({}, nextConfig?.experimental?.turbo, {
-          rules: Object.assign({}, nextConfig?.experimental?.turbo?.rules, {
-            '*.mdx': {
-              loaders: [loader],
-              as: '*.tsx',
-            },
-          }),
-          resolveAlias: Object.assign(
-            {},
-            nextConfig?.experimental?.turbo?.resolveAlias,
-            {
-              'next-mdx-import-source-file':
-                '@vercel/turbopack-next/mdx-import-source',
-            }
-          ),
+      nextConfig.turbopack = Object.assign({}, nextConfig?.turbopack, {
+        rules: Object.assign({}, nextConfig?.turbopack?.rules, {
+          '*.mdx': {
+            loaders: [loader],
+            as: '*.tsx',
+          },
+        }),
+        resolveAlias: Object.assign({}, nextConfig?.turbopack?.resolveAlias, {
+          'next-mdx-import-source-file':
+            '@vercel/turbopack-next/mdx-import-source',
         }),
       })
     }
Repository: nodejs/node
Pull request: test: remove test-macos-app-sandbox flaky designation

Fixes: https://github.com/nodejs/node/issues/54811
Refs: https://github.com/nodejs/node/issues/54811#issuecomment-2334463112

<!--
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/parallel.status
patch: @@ -44,8 +44,6 @@ test-runner-watch-mode: PASS,FLAKY
 # https://github.com/nodejs/node/issues/42741
 test-http-server-headers-timeout-keepalive: PASS,FLAKY
 test-http-server-request-timeout-keepalive: PASS,FLAKY
-# https://github.com/nodejs/node/issues/54811
-test-macos-app-sandbox: PASS, FLAKY
 
 [$arch==arm || $arch==arm64]
 # https://github.com/nodejs/node/pull/31178
Repository: ggml-org/llama.cpp
Pull request: gguf-py : display the invalid gguf type

# PR Summary
This small PR evaluates and displays the invalid gguf type in the error message.

Changed files:
filename: gguf-py/gguf/gguf_reader.py
patch: @@ -251,7 +251,7 @@ def _get_field_parts(
                 offs += curr_size
             return offs - orig_offs, aparts, data_idxs, types
         # We can't deal with this one.
-        raise ValueError('Unknown/unhandled field type {gtype}')
+        raise ValueError(f'Unknown/unhandled field type {gtype}')
 
     def _get_tensor_info_field(self, orig_offs: int) -> ReaderField:
         offs = orig_offs
Repository: facebook/react
Pull request: [DevTools] Rename react-dom/testing to react-dom/unstable_testing in yarn build-for-devtools

The shell package wasn't compiling because `yarn build-for-devtools` was incorrect. The `react-dom/test` package was renamed to `react-dom/unstable_testing`. This PR fixes this in the `package.json`.

Note: Adding packages to the `yarn build-for-devtools` command isn't great in the long run. Eventually we should make devtools have its own build script.

Changed files:
filename: package.json
patch: @@ -108,7 +108,7 @@
   "scripts": {
     "build": "node ./scripts/rollup/build.js",
     "build-combined": "node ./scripts/rollup/build-all-release-channels.js",
-    "build-for-devtools": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react/jsx,react-dom/index,react-dom/test,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh,react-art --type=NODE && cp -r ./build/node_modules build/oss-experimental/",
+    "build-for-devtools": "cross-env RELEASE_CHANNEL=experimental yarn build react/index,react/jsx,react-dom/index,react-dom/unstable_testing,react-is,react-debug-tools,scheduler,react-test-renderer,react-refresh,react-art --type=NODE && cp -r ./build/node_modules build/oss-experimental/",
     "build-for-devtools-dev": "yarn build-for-devtools --type=NODE_DEV",
     "build-for-devtools-prod": "yarn build-for-devtools --type=NODE_PROD",
     "linc": "node ./scripts/tasks/linc.js",
Repository: vercel/next.js
Pull request: Run export child process with runtime's default `max-old-space-size`

We ended up always forwarding `NODE_OPTIONS` even if the callsites of `new Worker` removed `max-old-space-size` on purpose like https://github.com/vercel/next.js/blob/e3adfeb8160041f697840c94671cb141a0a40039/packages/next/src/build/index.ts#L753-L767 did.

This will also fix a bunch of "port is already in use" issues when you set `NODE_OPTIONS=--inspect`. 

## Test plan

`NODE_OPTIONS=--max-old-space-size=4096` and then `console.log('worker NODE_OPTIONS', process.env.NODE_OPTIONS)` in `packages/next/src/build/worker.ts`

Changed files:
filename: packages/next/src/build/index.ts
patch: @@ -764,7 +764,9 @@ export function createStaticWorker(
       progress?.clear()
     },
     forkOptions: {
-      env: { ...process.env, NODE_OPTIONS: formatNodeOptions(nodeOptions) },
+      env: {
+        NODE_OPTIONS: formatNodeOptions(nodeOptions),
+      },
     },
     enableWorkerThreads: config.experimental.workerThreads,
     exposedMethods: staticWorkerExposedMethods,

filename: packages/next/src/build/turbopack-build/index.ts
patch: @@ -16,7 +16,6 @@ async function turbopackBuildWithWorker() {
       maxRetries: 0,
       forkOptions: {
         env: {
-          ...process.env,
           NEXT_PRIVATE_BUILD_WORKER: '1',
           NODE_OPTIONS: formatNodeOptions(nodeOptions),
         },

filename: packages/next/src/build/webpack-build/index.ts
patch: @@ -57,7 +57,6 @@ async function webpackBuildWithWorker(
       maxRetries: 0,
       forkOptions: {
         env: {
-          ...process.env,
           NEXT_PRIVATE_BUILD_WORKER: '1',
           NODE_OPTIONS: formatNodeOptions(nodeOptions),
         },

filename: packages/next/src/lib/worker.ts
patch: @@ -2,7 +2,7 @@ import type { ChildProcess } from 'child_process'
 import { Worker as JestWorker } from 'next/dist/compiled/jest-worker'
 import { Transform } from 'stream'
 
-type FarmOptions = ConstructorParameters<typeof JestWorker>[1]
+type FarmOptions = NonNullable<ConstructorParameters<typeof JestWorker>[1]>
 
 const RESTARTED = Symbol('restarted')
 
@@ -19,7 +19,12 @@ export class Worker {
 
   constructor(
     workerPath: string,
-    options: FarmOptions & {
+    options: Omit<FarmOptions, 'forkOptions'> & {
+      forkOptions?:
+        | (Omit<NonNullable<FarmOptions['forkOptions']>, 'env'> & {
+            env?: Partial<NodeJS.ProcessEnv> | undefined
+          })
+        | undefined
       timeout?: number
       onActivity?: () => void
       onActivityAbort?: () => void
@@ -48,8 +53,8 @@ export class Worker {
         forkOptions: {
           ...farmOptions.forkOptions,
           env: {
-            ...((farmOptions.forkOptions?.env || {}) as any),
             ...process.env,
+            ...((farmOptions.forkOptions?.env || {}) as any),
             IS_NEXT_WORKER: 'true',
           } as any,
         },
Repository: nodejs/node
Pull request: src: drain platform tasks before taking startup snapshot

Drain the loop and platform tasks before creating a snapshot. This is
necessary to ensure that the no roots are held by the the platform
tasks, which may reference objects associated with a context. For
example, a WeakRef may schedule an per-isolate platform task as a GC
root, and referencing an object in a context, causing an assertion in
the snapshot creator that objects must be serialized with a context.

Refs: https://github.com/nodejs/node/pull/56292

Changed files:
filename: src/node_snapshotable.cc
patch: @@ -973,25 +973,29 @@ ExitCode BuildSnapshotWithoutCodeCache(
       }
     });
 
+    Context::Scope context_scope(setup->context());
+    Environment* env = setup->env();
+
     // Run the custom main script for fully customized snapshots.
     if (snapshot_type == SnapshotMetadata::Type::kFullyCustomized) {
-      Context::Scope context_scope(setup->context());
-      Environment* env = setup->env();
 #if HAVE_INSPECTOR
         env->InitializeInspector({});
 #endif
         if (LoadEnvironment(env, builder_script_content.value()).IsEmpty()) {
           return ExitCode::kGenericUserError;
         }
+    }
 
-        // FIXME(joyeecheung): right now running the loop in the snapshot
-        // builder might introduce inconsistencies in JS land that need to
-        // be synchronized again after snapshot restoration.
-        ExitCode exit_code =
-            SpinEventLoopInternal(env).FromMaybe(ExitCode::kGenericUserError);
-        if (exit_code != ExitCode::kNoFailure) {
-          return exit_code;
-        }
+    // Drain the loop and platform tasks before creating a snapshot. This is
+    // necessary to ensure that the no roots are held by the the platform
+    // tasks, which may reference objects associated with a context. For
+    // example, a WeakRef may schedule an per-isolate platform task as a GC
+    // root, and referencing an object in a context, causing an assertion in
+    // the snapshot creator.
+    ExitCode exit_code =
+        SpinEventLoopInternal(env).FromMaybe(ExitCode::kGenericUserError);
+    if (exit_code != ExitCode::kNoFailure) {
+      return exit_code;
     }
   }
Repository: electron/electron
Pull request: build: let darwin/mas run concurrently

Backport of #43788

See that PR for details.


Notes: none

Changed files:
filename: .github/workflows/pipeline-segment-electron-build.yml
patch: @@ -61,7 +61,7 @@ on:
 
 
 concurrency:
-  group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
+  group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref }}
   cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
 
 env:
Repository: ggml-org/llama.cpp
Pull request: vulkan: small fixes

Basically I just cleared a warning and set the correct extension for iq1_m.

Changed files:
filename: ggml/src/ggml-vulkan/ggml-vulkan.cpp
patch: @@ -4513,6 +4513,8 @@ static vk_pipeline ggml_vk_guess_matmul_pipeline(ggml_backend_vk_context * ctx,
         return aligned ? mmp->a_m : mmp->m;
     }
     return aligned ? mmp->a_l : mmp->l;
+
+    GGML_UNUSED(src1_type);
 }
 
 static uint32_t ggml_vk_guess_matmul_pipeline_align(ggml_backend_vk_context * ctx, vk_matmul_pipeline& mmp, int m, int n, ggml_type src0_type, ggml_type src1_type) {

filename: ggml/src/ggml-vulkan/vulkan-shaders/dequant_iq1_m.comp
patch: @@ -1,6 +1,6 @@
 #version 450
 
-#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require
+#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
 
 #include "dequant_head.comp"
 

filename: ggml/src/ggml-vulkan/vulkan-shaders/mul_mm.comp
patch: @@ -7,7 +7,7 @@
 #extension GL_EXT_shader_explicit_arithmetic_types_float16 : require
 #endif
 #if defined(DATA_A_IQ1_M)
-#extension GL_EXT_shader_explicit_arithmetic_types_float16 : require
+#extension GL_EXT_shader_explicit_arithmetic_types_int16 : require
 #endif
 
 #if defined(DATA_A_BF16) && defined(COOPMAT)
Repository: denoland/deno
Pull request: fix(publish): ensure provenance is spec compliant

Fixes: #25199 

Ensures that for the SLSA provenance document generated on publishing, `subject` is an array of ResourceDescriptor objects per the in-toto specification [requirements](https://github.com/in-toto/attestation/blob/main/spec/v1/statement.md#fields).


Changed files:
filename: cli/tools/registry/mod.rs
patch: @@ -1049,7 +1049,8 @@ async fn publish_package(
         sha256: faster_hex::hex_string(&sha2::Sha256::digest(&meta_bytes)),
       },
     };
-    let bundle = provenance::generate_provenance(http_client, subject).await?;
+    let bundle =
+      provenance::generate_provenance(http_client, vec![subject]).await?;
 
     let tlog_entry = &bundle.verification_material.tlog_entries[0];
     log::info!("{}",

filename: cli/tools/registry/provenance.rs
patch: @@ -229,16 +229,16 @@ impl Predicate {
 struct ProvenanceAttestation {
   #[serde(rename = "type")]
   _type: &'static str,
-  subject: Subject,
+  subject: Vec<Subject>,
   predicate_type: &'static str,
   predicate: Predicate,
 }
 
 impl ProvenanceAttestation {
-  pub fn new_github_actions(subject: Subject) -> Self {
+  pub fn new_github_actions(subjects: Vec<Subject>) -> Self {
     Self {
       _type: INTOTO_STATEMENT_TYPE,
-      subject,
+      subject: subjects,
       predicate_type: SLSA_PREDICATE_TYPE,
       predicate: Predicate::new_github_actions(),
     }
@@ -296,7 +296,7 @@ pub struct ProvenanceBundle {
 
 pub async fn generate_provenance(
   http_client: &HttpClient,
-  subject: Subject,
+  subjects: Vec<Subject>,
 ) -> Result<ProvenanceBundle, AnyError> {
   if !is_gha() {
     bail!("Automatic provenance is only available in GitHub Actions");
@@ -308,7 +308,7 @@ pub async fn generate_provenance(
     );
   };
 
-  let slsa = ProvenanceAttestation::new_github_actions(subject);
+  let slsa = ProvenanceAttestation::new_github_actions(subjects);
 
   let attestation = serde_json::to_string(&slsa)?;
   let bundle = attest(http_client, &attestation, INTOTO_PAYLOAD_TYPE).await?;
@@ -738,8 +738,13 @@ mod tests {
         sha256: "yourmom".to_string(),
       },
     };
-    let slsa = ProvenanceAttestation::new_github_actions(subject);
-    assert_eq!(slsa.subject.name, "jsr:@divy/sdl2@0.0.1");
-    assert_eq!(slsa.subject.digest.sha256, "yourmom");
+    let slsa = ProvenanceAttestation::new_github_actions(vec![subject]);
+    assert_eq!(
+      slsa.subject.len(),
+      1,
+      "Subject should be an array per the in-toto specification"
+    );
+    assert_eq!(slsa.subject[0].name, "jsr:@divy/sdl2@0.0.1");
+    assert_eq!(slsa.subject[0].digest.sha256, "yourmom");
   }
 }
Repository: electron/electron
Pull request: build: let darwin/mas run concurrently

Fixes the macOS release

---

Notes: none

Changed files:
filename: .github/workflows/pipeline-segment-electron-build.yml
patch: @@ -61,7 +61,7 @@ on:
 
 
 concurrency:
-  group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.is-asan }}-${{ github.ref }}
+  group: electron-build-${{ inputs.target-platform }}-${{ inputs.target-arch }}-${{ inputs.target-variant }}-${{ inputs.is-asan }}-${{ github.ref }}
   cancel-in-progress: ${{ github.ref != 'refs/heads/main' && !endsWith(github.ref, '-x-y') }}
 
 env:
Repository: ggml-org/llama.cpp
Pull request: model : fix llama4 graph

ref https://github.com/ggml-org/llama.cpp/pull/13194#issuecomment-2894681469

Accidentally broke the L4 graph in #13194.

Changed files:
filename: src/llama-model.cpp
patch: @@ -4803,8 +4803,21 @@ struct llm_build_llama_iswa : public llm_graph_context {
             ggml_tensor * ffn_inp = ggml_add(ctx0, cur, inpSA);
             cb(ffn_inp, "ffn_inp", il);
 
-            {
-                // llama4 MoE
+            // feed-forward network (non-MoE)
+            if (model.layers[il].ffn_gate_inp == nullptr) {
+                cur = build_norm(ffn_inp,
+                        model.layers[il].ffn_norm, NULL,
+                        LLM_NORM_RMS, il);
+                cb(cur, "ffn_norm", il);
+
+                cur = build_ffn(cur,
+                        model.layers[il].ffn_up,   model.layers[il].ffn_up_b,   NULL,
+                        model.layers[il].ffn_gate, model.layers[il].ffn_gate_b, NULL,
+                        model.layers[il].ffn_down, model.layers[il].ffn_down_b, NULL,
+                        NULL,
+                        LLM_FFN_SILU, LLM_FFN_PAR, il);
+                cb(cur, "ffn_out", il);
+            } else {
                 ggml_tensor * ffn_inp_normed = build_norm(ffn_inp,
                         model.layers[il].ffn_norm, NULL,
                         LLM_NORM_RMS, il);