helloadhavan/github_issues huggingface dataset:
Repository: denoland/deno
Pull request: fix(ext/http): use clone_external in op_http_metric_handle_otel_error

## Summary

- Fix use-after-take panic in HTTP OTel integration when both metrics and tracing are enabled and the `onError` handler throws
- `op_http_metric_handle_otel_error` was using `take_external!` (consuming the pointer), then `op_http_copy_span_to_otel_info` tried to `clone_external!` on the same consumed pointer — UB manifesting as a `borrow_mut` panic
- Changed to `clone_external!` since this op only sets an error attribute, not takes ownership

Closes https://github.com/denoland/deno/issues/33006

Changed files:
filename: ext/http/http_next.rs
patch: @@ -1713,8 +1713,8 @@ pub async fn op_raw_write_vectored(
 #[op2(fast)]
 pub fn op_http_metric_handle_otel_error(external: *const c_void) {
   let http =
-    // SAFETY: external is deleted before calling this op.
-    unsafe { take_external!(external, "op_http_metric_handle_otel_error") };
+    // SAFETY: op is called with external.
+    unsafe { clone_external!(external, "op_http_metric_handle_otel_error") };
 
   http.otel_info_set_error("user");
 }

filename: tests/specs/cli/otel_basic/__test__.jsonc
patch: @@ -123,6 +123,10 @@
     "log_exception": {
       "args": "run -A main.ts log_exception.ts",
       "output": "log_exception.out"
+    },
+    "http_serve_error_with_otel": {
+      "args": "run -A main.ts http_serve_error_with_otel.ts",
+      "output": "http_serve_error_with_otel.out"
     }
   }
 }

filename: tests/specs/cli/otel_basic/http_serve_error_with_otel.out
patch: @@ -0,0 +1,14 @@
+[WILDCARD]{
+  "spans": [
+[WILDCARD]
+        {
+          "key": "error.type",
+          "value": {
+            "stringValue": "500"
+          }
+        }
+[WILDCARD]
+  ],
+  "logs": [WILDCARD],
+  "metrics": [WILDCARD]
+}

filename: tests/specs/cli/otel_basic/http_serve_error_with_otel.ts
patch: @@ -0,0 +1,24 @@
+// Regression test for https://panic.deno.com/v2.7.8/aarch64-apple-darwin/g7y2Non_5uBwt-hvBwk-hvB4j-hvBow9zC434tWoq3tWw32tW
+// When both tracing and metrics are enabled and the onError handler throws,
+// op_http_metric_handle_otel_error must not consume the external pointer
+// before op_http_copy_span_to_otel_info can use it.
+
+const server = Deno.serve({
+  port: 0,
+  async onListen({ port }) {
+    try {
+      await (await fetch(`http://localhost:${port}/`)).text();
+    } finally {
+      server.shutdown();
+    }
+  },
+  handler: (_req) => {
+    throw new Error("handler error");
+  },
+  onError: (_error) => {
+    // onError itself throws, triggering the double-error path
+    // where both op_http_metric_handle_otel_error and
+    // op_http_copy_span_to_otel_info run on the same request.
+    throw new Error("onError error");
+  },
+});
Repository: facebook/react
Pull request: [compiler][ez] Include phi identifier in AssertValidMutableRanges

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

Summary:
Looks like we accidentally skipped validating this identifier.

Changed files:
filename: compiler/packages/babel-plugin-react-compiler/src/HIR/AssertValidMutableRanges.ts
patch: @@ -20,6 +20,7 @@ import {
 export function assertValidMutableRanges(fn: HIRFunction): void {
   for (const [, block] of fn.body.blocks) {
     for (const phi of block.phis) {
+      visitIdentifier(phi.id);
       for (const [, operand] of phi.operands) {
         visitIdentifier(operand);
       }
Repository: ollama/ollama
Pull request: Fix OLLAMA_LLM_LIBRARY with wrong map name and add more env vars to help message 

1. The first commit fix the the wrong name of `OLLAMA_LLM_LIBRARY` in `map[string]EnvVar`
2. The second commit add more env vars to help message of `ollama serve --help` to let user know what env var we can use when start the server.

Changed files:
filename: cmd/cmd.go
patch: @@ -1251,6 +1251,9 @@ func NewCLI() *cobra.Command {
 				envVars["OLLAMA_NOPRUNE"],
 				envVars["OLLAMA_ORIGINS"],
 				envVars["OLLAMA_TMPDIR"],
+				envVars["OLLAMA_FLASH_ATTENTION"],
+				envVars["OLLAMA_LLM_LIBRARY"],
+				envVars["OLLAMA_MAX_VRAM"],
 			})
 		default:
 			appendEnvDocs(cmd, envs)

filename: envconfig/config.go
patch: @@ -51,16 +51,16 @@ func AsMap() map[string]EnvVar {
 		"OLLAMA_FLASH_ATTENTION":   {"OLLAMA_FLASH_ATTENTION", FlashAttention, "Enabled flash attention"},
 		"OLLAMA_HOST":              {"OLLAMA_HOST", "", "IP Address for the ollama server (default 127.0.0.1:11434)"},
 		"OLLAMA_KEEP_ALIVE":        {"OLLAMA_KEEP_ALIVE", KeepAlive, "The duration that models stay loaded in memory (default \"5m\")"},
-		"OLLAMA_LLM_LIBRARY":       {"OLLAMA_ORIGINS", LLMLibrary, ""},
+		"OLLAMA_LLM_LIBRARY":       {"OLLAMA_LLM_LIBRARY", LLMLibrary, "Set LLM library to bypass autodetection"},
 		"OLLAMA_MAX_LOADED_MODELS": {"OLLAMA_MAX_LOADED_MODELS", MaxRunners, "Maximum number of loaded models (default 1)"},
 		"OLLAMA_MAX_QUEUE":         {"OLLAMA_MAX_QUEUE", MaxQueuedRequests, "Maximum number of queued requests"},
-		"OLLAMA_MAX_VRAM":          {"OLLAMA_MAX_VRAM", MaxVRAM, ""},
+		"OLLAMA_MAX_VRAM":          {"OLLAMA_MAX_VRAM", MaxVRAM, "Maximum VRAM"},
 		"OLLAMA_MODELS":            {"OLLAMA_MODELS", "", "The path to the models directory"},
 		"OLLAMA_NOHISTORY":         {"OLLAMA_NOHISTORY", NoHistory, "Do not preserve readline history"},
 		"OLLAMA_NOPRUNE":           {"OLLAMA_NOPRUNE", NoPrune, "Do not prune model blobs on startup"},
 		"OLLAMA_NUM_PARALLEL":      {"OLLAMA_NUM_PARALLEL", NumParallel, "Maximum number of parallel requests (default 1)"},
 		"OLLAMA_ORIGINS":           {"OLLAMA_ORIGINS", AllowOrigins, "A comma separated list of allowed origins"},
-		"OLLAMA_RUNNERS_DIR":       {"OLLAMA_RUNNERS_DIR", RunnersDir, ""},
+		"OLLAMA_RUNNERS_DIR":       {"OLLAMA_RUNNERS_DIR", RunnersDir, "Location for runners"},
 		"OLLAMA_TMPDIR":            {"OLLAMA_TMPDIR", TmpDir, "Location for temporary files"},
 	}
 }
Repository: ollama/ollama
Pull request: vocab only for tokenize

tensors are unneeded for tokenize/detokenize

Changed files:
filename: llm/llm.go
patch: @@ -47,11 +47,11 @@ func newLlamaModel(p string) *llamaModel {
 	cs := C.CString(p)
 	defer C.free(unsafe.Pointer(cs))
 
+	params := C.llama_model_default_params()
+	params.vocab_only = true
+
 	return &llamaModel{
-		C.llama_load_model_from_file(
-			cs,
-			C.llama_model_default_params(),
-		),
+		C.llama_load_model_from_file(cs, params),
 	}
 }
Repository: ggml-org/llama.cpp
Pull request: model : mtmd : make input norm optional in LFM2-VL

Upcoming LFM2-VL releases will have configurable input norm. See https://github.com/huggingface/transformers/pull/43087 for details.


Changed files:
filename: tools/mtmd/clip.cpp
patch: @@ -1552,6 +1552,14 @@ struct clip_model_loader {
                     model.projection = get_tensor(TN_MM_PROJECTOR);
                 } break;
             case PROJECTOR_TYPE_LFM2:
+                {
+                    model.mm_input_norm_w = get_tensor(TN_MM_INP_NORM, false);
+                    model.mm_input_norm_b = get_tensor(TN_MM_INP_NORM_B, false);
+                    model.mm_1_w = get_tensor(string_format(TN_LLAVA_PROJ, 1, "weight"));
+                    model.mm_1_b = get_tensor(string_format(TN_LLAVA_PROJ, 1, "bias"));
+                    model.mm_2_w = get_tensor(string_format(TN_LLAVA_PROJ, 2, "weight"));
+                    model.mm_2_b = get_tensor(string_format(TN_LLAVA_PROJ, 2, "bias"));
+                } break;
             case PROJECTOR_TYPE_KIMIVL:
                 {
                     model.mm_input_norm_w = get_tensor(TN_MM_INP_NORM);

filename: tools/mtmd/models/siglip.cpp
patch: @@ -50,10 +50,15 @@ ggml_cgraph * clip_graph_siglip::build() {
         const int scale_factor = model.hparams.n_merge;
         cur = build_patch_merge_permute(cur, scale_factor);
 
-        // projection
-        cur = ggml_norm(ctx0, cur, 1e-5); // default nn.LayerNorm
-        cur = ggml_mul(ctx0, cur, model.mm_input_norm_w);
-        cur = ggml_add(ctx0, cur, model.mm_input_norm_b);
+        // projection, in LFM2-VL input norm is optional
+        if (model.mm_input_norm_w) {
+            cur = ggml_norm(ctx0, cur, 1e-5); // default nn.LayerNorm
+            cur = ggml_mul(ctx0, cur, model.mm_input_norm_w);
+        }
+
+        if (model.mm_input_norm_b) {
+            cur = ggml_add(ctx0, cur, model.mm_input_norm_b);
+        }
 
         cur = build_ffn(cur,
             model.mm_1_w, model.mm_1_b,
Repository: vercel/next.js
Pull request: Name "cache" streams for React DevTools

This way the "rsc stream" chunk coming from these can be identified.

Changed files:
filename: packages/next/src/server/use-cache/use-cache-wrapper.ts
patch: @@ -734,6 +734,12 @@ async function generateCacheEntryImpl(
     errors
   )
 
+  if (process.env.NODE_ENV === 'development') {
+    // Name the stream for React DevTools.
+    // @ts-expect-error
+    returnStream.name = 'use cache'
+  }
+
   return {
     type: 'cached',
     // Return the stream as we're creating it. This means that if it ends up
Repository: denoland/deno
Pull request: fix(ext/node): use constant-time comparison for secret key equality

## Summary
- `KeyObjectHandle::Secret` `PartialEq` impl used standard `==` for byte slice comparison, which short-circuits on first mismatch
- Switched to `subtle::ConstantTimeEq` (`ct_eq`) to prevent potential timing side-channels when comparing secret keys via `key.equals()`
- The `subtle` crate was already a dependency of `deno_node_crypto`

## Test plan
- [x] `cargo check -p deno_node_crypto` passes
- Existing `key.equals()` tests cover correctness — this change only affects timing behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Changed files:
filename: ext/node_crypto/keys.rs
patch: @@ -411,7 +411,10 @@ impl PartialEq for KeyObjectHandle {
     match (self, other) {
       (Self::AsymmetricPrivate(a), Self::AsymmetricPrivate(b)) => a == b,
       (Self::AsymmetricPublic(a), Self::AsymmetricPublic(b)) => a == b,
-      (Self::Secret(a), Self::Secret(b)) => a == b,
+      (Self::Secret(a), Self::Secret(b)) => {
+        use subtle::ConstantTimeEq;
+        a.ct_eq(b).into()
+      }
       _ => false,
     }
   }
Repository: facebook/react
Pull request: [Flight] Serialize top-level Date

renderModelDesctructive can sometimes be called direclty on Date values. When this happens we don't first call toJSON on the Date value so we need to explicitly handle the case where where the rendered value is a Date instance as well. This change updates renderModelDesctructive to account for sometimes receiving Date instances directly.

Changed files:
filename: packages/react-client/src/__tests__/ReactFlight-test.js
patch: @@ -661,6 +661,18 @@ describe('ReactFlight', () => {
       `);
   });
 
+  it('can transport Date as a top-level value', async () => {
+    const date = new Date(0);
+    const transport = ReactNoopFlightServer.render(date);
+
+    let readValue;
+    await act(async () => {
+      readValue = await ReactNoopFlightClient.read(transport);
+    });
+
+    expect(readValue).toEqual(date);
+  });
+
   it('can transport Error objects as values', async () => {
     function ComponentClient({prop}) {
       return `

filename: packages/react-server/src/ReactFlightServer.js
patch: @@ -1962,6 +1962,12 @@ function serializeUndefined(): string {
   return '$undefined';
 }
 
+function serializeDate(date: Date): string {
+  // JSON.stringify automatically calls Date.prototype.toJSON which calls toISOString.
+  // We need only tack on a $D prefix.
+  return '$D' + date.toJSON();
+}
+
 function serializeDateFromDateJSON(dateJSON: string): string {
   // JSON.stringify automatically calls Date.prototype.toJSON which calls toISOString.
   // We need only tack on a $D prefix.
@@ -2779,6 +2785,14 @@ function renderModelDestructive(
       }
     }
 
+    // We put the Date check low b/c most of the time Date's will already have been serialized
+    // before we process it in this function but when rendering a Date() as a top level it can
+    // end up being a Date instance here. This is rare so we deprioritize it by putting it deep
+    // in this function
+    if (value instanceof Date) {
+      return serializeDate(value);
+    }
+
     // Verify that this is a simple plain object.
     const proto = getPrototypeOf(value);
     if (
@@ -3646,6 +3660,10 @@ function renderConsoleValue(
     return serializeBigInt(value);
   }
 
+  if (value instanceof Date) {
+    return serializeDate(value);
+  }
+
   return 'unknown type ' + typeof value;
 }
Repository: ggml-org/llama.cpp
Pull request: CUDA: disable cuda graph when using n-cpu-moe

Missed disabling cuda graphs when `-n-cpu-moe` is used

Changed files:
filename: ggml/src/ggml-cuda/ggml-cuda.cu
patch: @@ -3696,6 +3696,7 @@ static void evaluate_and_capture_cuda_graph(ggml_backend_cuda_context * cuda_ctx
 }
 
 static bool ggml_cuda_set_cuda_graph_enabled(ggml_backend_cuda_context * cuda_ctx) {
+
 #ifdef USE_CUDA_GRAPH
     static const bool disable_cuda_graphs_due_to_env = (getenv("GGML_CUDA_DISABLE_GRAPHS") != nullptr);
 
@@ -3736,17 +3737,15 @@ static bool ggml_cuda_set_cuda_graph_enabled(ggml_backend_cuda_context * cuda_ct
 static enum ggml_status ggml_backend_cuda_graph_compute(ggml_backend_t backend, ggml_cgraph * cgraph) {
     ggml_backend_cuda_context * cuda_ctx = (ggml_backend_cuda_context *) backend->context;
 
+    ggml_cuda_set_device(cuda_ctx->device);
+
     bool use_cuda_graph             = false;
     bool cuda_graph_update_required = false;
 
     // graph_optimize calls set_cuda_graph_enabled, in-case it not called (i.e. graph_compute is directly called)
     // we call it here instead.
 #ifdef USE_CUDA_GRAPH
-    if (!cuda_ctx->cuda_graph) {
-        use_cuda_graph = ggml_cuda_set_cuda_graph_enabled(cuda_ctx);
-    } else {
-        use_cuda_graph = cuda_ctx->cuda_graph && cuda_ctx->cuda_graph->cuda_graphs_enabled;
-    }
+    use_cuda_graph = ggml_cuda_set_cuda_graph_enabled(cuda_ctx);
 
     if (use_cuda_graph) {
         cuda_graph_update_required = is_cuda_graph_update_required(cuda_ctx, cgraph);
@@ -3762,6 +3761,7 @@ static enum ggml_status ggml_backend_cuda_graph_compute(ggml_backend_t backend,
 
         if (cuda_ctx->cuda_graph->number_consecutive_updates >= 4) {
             cuda_ctx->cuda_graph->disable_due_to_too_many_updates = true;
+            cuda_ctx->cuda_graph->cuda_graphs_enabled = false;
 #ifndef NDEBUG
             GGML_LOG_DEBUG("%s: disabling CUDA graphs due to too many consecutive updates\n", __func__);
 #endif
Repository: huggingface/transformers
Pull request: Fix Florence2 conversion script model_type KeyError

# What does this PR do?

Fixes #41738 


## Before submitting
- [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md#create-a-pull-request),
      Pull Request section?
- [x] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case.
- [ ] Did you make sure to update the documentation with your changes? Here are the
      [documentation guidelines](https://github.com/huggingface/transformers/tree/main/docs), and
      [here are tips on formatting docstrings](https://github.com/huggingface/transformers/tree/main/docs#writing-source-documentation).
- [ ] Did you write any new necessary tests?


## Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
@zucchini-nlp

Changed files:
filename: src/transformers/models/florence2/convert_florence2_original_pytorch_to_hf.py
patch: @@ -473,6 +473,9 @@ def convert_florence2_checkpoint(hf_model_id, pytorch_dump_folder, output_hub_pa
 
     vision_config = convert_config(hf_config.vision_config.__dict__)
     text_config = hf_config.text_config.__dict__
+    if text_config.get("model_type") == "florence2_language":
+        text_config["model_type"] = "bart"
+
     config = Florence2Config(
         text_config=text_config,
         vision_config=vision_config,
Repository: ggml-org/llama.cpp
Pull request: ggml-cuda: remove unused params in ggml_cuda_graph


Changed files:
filename: ggml/src/ggml-cuda/common.cuh
patch: @@ -1058,7 +1058,6 @@ struct ggml_cuda_graph {
     cudaGraphExec_t instance = nullptr;
     size_t num_nodes = 0;
     std::vector<cudaGraphNode_t> nodes;
-    std::vector<cudaKernelNodeParams> params;
     bool disable_due_to_gpu_arch = false;
     bool disable_due_to_too_many_updates = false;
     bool disable_due_to_failed_graph_capture = false;
Repository: ollama/ollama
Pull request: only generate on relevant changes

relevant change include changes to c++, generate scripts or the llama.cpp submodule

Changed files:
filename: .github/workflows/test.yaml
patch: @@ -34,13 +34,13 @@ jobs:
             git diff-tree -r --no-commit-id --name-only \
               $(git merge-base ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }}) \
               ${{ github.event.pull_request.head.sha }} \
-              | xargs python3 -c "import sys; print(any([x.startswith('$1') for x in sys.argv[1:]]))"
+              | xargs python3 -c "import sys; from pathlib import Path; print(any(Path(x).match(glob) for x in sys.argv[1:] for glob in '$*'.split(' ')))"
           }
 
           {
-            echo GENERATE=$(changed llm/)
-            echo GENERATE_CUDA=$(changed llm/)
-            echo GENERATE_ROCM=$(changed llm/)
+            echo GENERATE=$(changed 'llm/llama.cpp' 'llm/patches/**' 'llm/ext_server/**' 'llm/generate/**')
+            echo GENERATE_CUDA=$(changed 'llm/llama.cpp' 'llm/patches/**' 'llm/ext_server/**' 'llm/generate/**')
+            echo GENERATE_ROCM=$(changed 'llm/llama.cpp' 'llm/patches/**' 'llm/ext_server/**' 'llm/generate/**')
           } >>$GITHUB_OUTPUT
 
   generate:
Repository: vercel/next.js
Pull request: [Cache Components] Allow stale longer than expire in cacheLife

We previously encoded an invariant with cacheLife that required stale to be greater than expire. This doesn't really make sense because these describe completely different lifetimes. Stale starts from when the client reads the response but expire starts from when the cache entry is created. This removes the the requirement that expire be greater than stale

Changed files:
filename: packages/next/src/server/use-cache/cache-life.ts
patch: @@ -72,17 +72,6 @@ function validateCacheLife(profile: CacheLife) {
       )
     }
   }
-
-  if (profile.stale !== undefined && profile.expire !== undefined) {
-    if (profile.stale > profile.expire) {
-      throw new Error(
-        'If providing both the stale and expire options, ' +
-          'the expire option must be greater than the stale option. ' +
-          'The expire option indicates how many seconds from the start ' +
-          'until it can no longer be used.'
-      )
-    }
-  }
 }
 
 export function cacheLife(profile: CacheLifeProfiles | CacheLife): void {
Repository: electron/electron
Pull request: build: roll build-images to 933c7d6

Backport of #47880

See that PR for details.


Notes: none

Changed files:
filename: .devcontainer/docker-compose.yml
patch: @@ -2,7 +2,7 @@ version: '3'
 
 services:
   buildtools:
-    image: ghcr.io/electron/devcontainer:424eedbf277ad9749ffa9219068aa72ed4a5e373
+    image: ghcr.io/electron/devcontainer:933c7d6ff6802706875270bec2e3c891cf8add3f
 
     volumes:
       - ..:/workspaces/gclient/src/electron:cached

filename: .github/workflows/build.yml
patch: @@ -6,7 +6,7 @@ on:
       build-image-sha:
         type: string
         description: 'SHA for electron/build image'
-        default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
+        default: '933c7d6ff6802706875270bec2e3c891cf8add3f'
         required: true
       skip-macos:
         type: boolean
@@ -64,7 +64,7 @@ jobs:
       id: set-output
       run: |
         if [ -z "${{ inputs.build-image-sha }}" ]; then
-          echo "build-image-sha=424eedbf277ad9749ffa9219068aa72ed4a5e373" >> "$GITHUB_OUTPUT"
+          echo "build-image-sha=933c7d6ff6802706875270bec2e3c891cf8add3f" >> "$GITHUB_OUTPUT"
         else
           echo "build-image-sha=${{ inputs.build-image-sha }}" >> "$GITHUB_OUTPUT"
         fi

filename: .github/workflows/linux-publish.yml
patch: @@ -6,7 +6,7 @@ on:
       build-image-sha:
         type: string
         description: 'SHA for electron/build image'
-        default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
+        default: '933c7d6ff6802706875270bec2e3c891cf8add3f'
       upload-to-storage:
         description: 'Uploads to Azure storage'
         required: false

filename: .github/workflows/macos-publish.yml
patch: @@ -6,7 +6,7 @@ on:
       build-image-sha:
         type: string
         description: 'SHA for electron/build image'
-        default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
+        default: '933c7d6ff6802706875270bec2e3c891cf8add3f'
         required: true
       upload-to-storage:
         description: 'Uploads to Azure storage'

filename: .github/workflows/windows-publish.yml
patch: @@ -6,7 +6,7 @@ on:
       build-image-sha:
         type: string
         description: 'SHA for electron/build image'
-        default: '424eedbf277ad9749ffa9219068aa72ed4a5e373'
+        default: '933c7d6ff6802706875270bec2e3c891cf8add3f'
         required: true
       upload-to-storage:
         description: 'Uploads to Azure storage'
Repository: ollama/ollama
Pull request: partial offloading: allow flash attention and disable mmap


Changed files:
filename: llm/server.go
patch: @@ -191,35 +191,38 @@ func NewLlamaServer(gpus gpu.GpuInfoList, model string, ggml *GGML, adapters, pr
 		params = append(params, "--memory-f32")
 	}
 
-	if opts.UseMLock {
-		params = append(params, "--mlock")
-	}
-
-	if !opts.UseMMap {
-		params = append(params, "--no-mmap")
-	}
-
-	if opts.UseNUMA {
-		params = append(params, "--numa")
-	}
-
 	flashAttnEnabled := envconfig.FlashAttention
 
-	// partial offloading does not support flash attention
-	if uint64(opts.NumGPU) < ggml.KV().BlockCount()+1 {
-		flashAttnEnabled = false
-	}
-
-	// only cuda (compute capability 7+) and metal support flash attention
 	for _, g := range gpus {
+		// only cuda (compute capability 7+) and metal support flash attention
 		if g.Library != "metal" && (g.Library != "cuda" || g.DriverMajor < 7) {
 			flashAttnEnabled = false
 		}
+
+		// mmap has issues with partial offloading on metal
+		if g.Library == "metal" &&
+			uint64(opts.NumGPU) > 0 &&
+			uint64(opts.NumGPU) < ggml.KV().BlockCount()+1 {
+			opts.UseMMap = false
+		}
 	}
+
 	if flashAttnEnabled {
 		params = append(params, "--flash-attn")
 	}
 
+	if !opts.UseMMap {
+		params = append(params, "--no-mmap")
+	}
+
+	if opts.UseMLock {
+		params = append(params, "--mlock")
+	}
+
+	if opts.UseNUMA {
+		params = append(params, "--numa")
+	}
+
 	numParallel := envconfig.NumParallel
 
 	// TODO (jmorganca): multimodal models don't support parallel yet