helloadhavan/github_issues huggingface dataset:
Repository: ggml-org/llama.cpp
Pull request: batch : fix sequence id ownership

cont #14482

Fix a bug where the batch data could end up pointing to dangling sequence ids.

Changed files:
filename: src/llama-batch.cpp
patch: @@ -695,6 +695,8 @@ llama_ubatch llama_batch_allocr::ubatch_add(const std::vector<int32_t> & idxs, u
     udata->seq_idx   .resize(LLAMA_MAX_SEQ, -1);
     udata->output    .resize(n_tokens);
 
+    udata->seq_id_data.reserve(n_tokens);
+
     seq_set_t seq_set_unq;
 
     for (size_t i = 0; i < idxs.size(); ++i) {
@@ -716,18 +718,26 @@ llama_ubatch llama_batch_allocr::ubatch_add(const std::vector<int32_t> & idxs, u
         }
 
         udata->n_seq_id[i] = batch.n_seq_id[idxs[i]];
-        udata->seq_id[i]   = batch.seq_id[idxs[i]];
         udata->output[i]   = batch.logits[idxs[i]];
 
         for (int s = 0; s < udata->n_seq_id[i]; ++s) {
-            seq_set_unq.set(udata->seq_id[i][s]);
+            const llama_seq_id seq_id = batch.seq_id[idxs[i]][s];
+
+            udata->seq_id_data.push_back(seq_id);
+            seq_set_unq.set(seq_id);
         }
 
         if (udata->output[i]) {
             out_ids.push_back(idxs[i]);
         }
     }
 
+    llama_seq_id * seq_id_ptr = udata->seq_id_data.data();
+    for (size_t i = 0; i < idxs.size(); ++i) {
+        udata->seq_id[i] = seq_id_ptr;
+        seq_id_ptr += udata->n_seq_id[i];
+    }
+
     for (uint32_t s = 0; s < n_seq_max; ++s) {
         if (seq_set_unq.test(s)) {
             udata->seq_idx[s] = udata->seq_id_unq.size();

filename: src/llama-batch.h
patch: @@ -56,13 +56,15 @@ struct llama_ubatch {
         std::vector<float>          embd;
         std::vector<llama_pos>      pos;
         std::vector<int32_t>        n_seq_id;
-        std::vector<llama_seq_id *> seq_id;
+        std::vector<llama_seq_id *> seq_id;      // these point into the seq_id_data below
         std::vector<llama_seq_id>   seq_id_unq;
         std::vector<int32_t>        seq_idx;
         std::vector<int8_t>         output;
+
+        std::vector<llama_seq_id> seq_id_data;
     };
 
-    // the llama_ubatch pointers above point to this data if set. otherwise - points to non-owning data
+    // the llama_ubatch pointers above point to this data if set. otherwise - point to external non-owning data
     std::shared_ptr<data_t> data;
 };
Repository: facebook/react
Pull request: Update enableLazyContextPropagation flag

- Flag set to true for FB
- Flag set to experimental for OSS

Changed files:
filename: packages/shared/ReactFeatureFlags.js
patch: @@ -94,8 +94,8 @@ export const enableObjectFiber = false;
 
 export const enableTransitionTracing = false;
 
-// No known bugs, but needs performance testing
-export const enableLazyContextPropagation = false;
+// Shipped on FB, waiting for next stable release to roll out to OSS
+export const enableLazyContextPropagation = __EXPERIMENTAL__;
 
 // Expose unstable useContext for performance testing
 export const enableContextProfiling = false;

filename: packages/shared/forks/ReactFeatureFlags.test-renderer.js
patch: @@ -51,7 +51,7 @@ export const syncLaneExpirationMs = 250;
 export const transitionLaneExpirationMs = 5000;
 
 export const disableSchedulerTimeoutInWorkLoop = false;
-export const enableLazyContextPropagation = false;
+export const enableLazyContextPropagation = __EXPERIMENTAL__;
 export const enableContextProfiling = false;
 export const enableLegacyHidden = false;
 

filename: packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
patch: @@ -54,7 +54,7 @@ export const syncLaneExpirationMs = 250;
 export const transitionLaneExpirationMs = 5000;
 
 export const disableSchedulerTimeoutInWorkLoop = false;
-export const enableLazyContextPropagation = false;
+export const enableLazyContextPropagation = true;
 export const enableContextProfiling = false;
 export const enableLegacyHidden = false;
 

filename: packages/shared/forks/ReactFeatureFlags.www-dynamic.js
patch: @@ -21,7 +21,6 @@ export const disableSchedulerTimeoutInWorkLoop = __VARIANT__;
 export const enableAddPropertiesFastPath = __VARIANT__;
 export const enableDeferRootSchedulingToMicrotask = __VARIANT__;
 export const enableDO_NOT_USE_disableStrictPassiveEffect = __VARIANT__;
-export const enableLazyContextPropagation = __VARIANT__;
 export const enableNoCloningMemoCache = __VARIANT__;
 export const enableObjectFiber = __VARIANT__;
 export const enableRenderableContext = __VARIANT__;

filename: packages/shared/forks/ReactFeatureFlags.www.js
patch: @@ -24,7 +24,6 @@ export const {
   enableDeferRootSchedulingToMicrotask,
   enableDO_NOT_USE_disableStrictPassiveEffect,
   enableInfiniteRenderLoopDetection,
-  enableLazyContextPropagation,
   enableNoCloningMemoCache,
   enableObjectFiber,
   enableRenderableContext,
@@ -59,6 +58,7 @@ export const enableFilterEmptyStringAttributesDOM = true;
 export const enableAsyncActions = true;
 export const disableInputAttributeSyncing = false;
 export const enableLegacyFBSupport = true;
+export const enableLazyContextPropagation = true;
 
 // Logs additional User Timing API marks for use with an experimental profiling tool.
 export const enableSchedulingProfiler: boolean =
Repository: ollama/ollama
Pull request: CI subprocess path fix


Changed files:
filename: .github/workflows/release.yaml
patch: @@ -99,7 +99,7 @@ jobs:
       - uses: actions/upload-artifact@v4
         with:
           name: generate-windows-cpu
-          path: llm/build/**/lib/*
+          path: llm/build/**/bin/*
 
   # ROCm generation step
   generate-windows-rocm:
@@ -170,7 +170,7 @@ jobs:
       - uses: actions/upload-artifact@v4
         with:
           name: generate-windows-rocm
-          path: llm/build/**/lib/*
+          path: llm/build/**/bin/*
       - uses: actions/upload-artifact@v4
         with:
           name: windows-rocm-deps
@@ -250,7 +250,7 @@ jobs:
       - uses: actions/upload-artifact@v4
         with:
           name: generate-windows-cuda
-          path: llm/build/**/lib/*
+          path: llm/build/**/bin/*
       - uses: actions/upload-artifact@v4
         with:
           name: windows-cuda-deps

filename: .github/workflows/test.yaml
patch: @@ -135,7 +135,7 @@ jobs:
       - uses: actions/upload-artifact@v4
         with:
           name: rocm-${{ matrix.rocm-version }}-libraries
-          path: llm/build/**/lib/*
+          path: llm/build/**/bin/*
 
   # ROCm generation step
   generate-windows-rocm:
Repository: vercel/next.js
Pull request: Development: Skip route matching when there is an existing match

## What?

Adds a fast path when there is an existing match already from matching earlier in the request lifecycle. This works for the majority of cases except for Parallel Routes as it will end up finding the wrong bundle path. That is fundamentally related to the implementation of parallel routes and where the bundles are created (under the specific parallel route name). This will need a larger refactor to fix but that doesn't have to block landing the fast path for all other cases.

Closes PACK-5606

Changed files:
filename: packages/next/src/server/base-server.ts
patch: @@ -2558,11 +2558,30 @@ export default abstract class Server<
       i18n: this.i18nProvider?.fromRequest(req, pathname),
     }
 
+    const existingMatch = getRequestMeta(ctx.req, 'match')
+
+    let fastPath = true
+    // when a specific invoke-output is meant to be matched
+    // ensure a prior dynamic route/page doesn't take priority
+    const invokeOutput = getRequestMeta(ctx.req, 'invokeOutput')
+
+    if (
+      (!this.minimalMode &&
+        typeof invokeOutput === 'string' &&
+        isDynamicRoute(invokeOutput || '') &&
+        invokeOutput !== existingMatch?.definition.pathname) ||
+      // Parallel routes are matched in `existingMatch` but since currently
+      // there can be multiple matches it's not guaranteed to be the right match
+      // therefor we need to opt-out of the fast path for parallel routes.
+      existingMatch?.definition.page.includes('/@')
+    ) {
+      fastPath = false
+    }
+
     try {
-      for await (const match of this.matchers.matchAll(pathname, options)) {
-        // when a specific invoke-output is meant to be matched
-        // ensure a prior dynamic route/page doesn't take priority
-        const invokeOutput = getRequestMeta(ctx.req, 'invokeOutput')
+      for await (const match of fastPath && existingMatch
+        ? [existingMatch]
+        : this.matchers.matchAll(pathname, options)) {
         if (
           !this.minimalMode &&
           typeof invokeOutput === 'string' &&
Repository: ollama/ollama
Pull request: Fix CI release glitches

The subprocess change moved the build directory
arm64 builds weren't setting cross-compilation flags when building on x86

Changed files:
filename: .github/workflows/release.yaml
patch: @@ -99,7 +99,7 @@ jobs:
       - uses: actions/upload-artifact@v4
         with:
           name: generate-windows-cpu
-          path: llm/llama.cpp/build/**/lib/*
+          path: llm/build/**/lib/*
 
   # ROCm generation step
   generate-windows-rocm:
@@ -170,7 +170,7 @@ jobs:
       - uses: actions/upload-artifact@v4
         with:
           name: generate-windows-rocm
-          path: llm/llama.cpp/build/**/lib/*
+          path: llm/build/**/lib/*
       - uses: actions/upload-artifact@v4
         with:
           name: windows-rocm-deps
@@ -250,7 +250,7 @@ jobs:
       - uses: actions/upload-artifact@v4
         with:
           name: generate-windows-cuda
-          path: llm/llama.cpp/build/**/lib/*
+          path: llm/build/**/lib/*
       - uses: actions/upload-artifact@v4
         with:
           name: windows-cuda-deps
@@ -303,11 +303,11 @@ jobs:
       - uses: actions/download-artifact@v4
         with:
           name: generate-windows-cpu
-          path: llm/llama.cpp/build
+          path: llm/build
       - uses: actions/download-artifact@v4
         with:
           name: generate-windows-cuda
-          path: llm/llama.cpp/build
+          path: llm/build
       - uses: actions/download-artifact@v4
         with:
           name: windows-cuda-deps
@@ -319,8 +319,8 @@ jobs:
       - uses: actions/download-artifact@v4
         with:
           name: generate-windows-rocm
-          path: llm/llama.cpp/build
-      - run: dir llm/llama.cpp/build
+          path: llm/build
+      - run: dir llm/build
       - run: |
           $gopath=(get-command go).source | split-path -parent
           & "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\Launch-VsDevShell.ps1"

filename: llm/generate/gen_darwin.sh
patch: @@ -74,7 +74,7 @@ case "${GOARCH}" in
     # Static build for linking into the Go binary
     init_vars
     CMAKE_TARGETS="--target llama --target ggml"
-    CMAKE_DEFS="-DCMAKE_OSX_DEPLOYMENT_TARGET=11.3 -DCMAKE_SYSTEM_NAME=Darwin -DBUILD_SHARED_LIBS=off -DLLAMA_METAL=off -DLLAMA_ACCELERATE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
+    CMAKE_DEFS="-DCMAKE_OSX_DEPLOYMENT_TARGET=11.3 -DCMAKE_SYSTEM_NAME=Darwin -DBUILD_SHARED_LIBS=off -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_OSX_ARCHITECTURES=${ARCH} -DLLAMA_METAL=off -DLLAMA_ACCELERATE=off -DLLAMA_AVX=off -DLLAMA_AVX2=off -DLLAMA_AVX512=off -DLLAMA_FMA=off -DLLAMA_F16C=off ${CMAKE_DEFS}"
     BUILD_DIR="../build/darwin/${ARCH}_static"
     echo "Building static library"
     build
Repository: nodejs/node
Pull request: test: unskip negative-settimeout.any.js WPT

#47834 resolved the concurrency issues of wpt/test-timers so I believe this skip is no longer needed.

Changed files:
filename: test/wpt/status/html/webappapis/timers.json
patch: @@ -1,5 +1 @@
-{
-  "negative-settimeout.any.js": {
-    "skip": "unreliable in Node.js; Refs: https://github.com/nodejs/node/issues/37672"
-  }
-}
+{}
Repository: ollama/ollama
Pull request: update graph size estimate

precise scratch space estimates for gemma and llama models with other models falling back to the previous algorithm

Changed files:
filename: llm/ggml.go
patch: @@ -303,3 +303,50 @@ func DecodeGGML(rs io.ReadSeeker) (*GGML, int64, error) {
 		model:     model,
 	}, offset, nil
 }
+
+func (llm GGML) GraphSize(context, batch int) (int64, bool) {
+	embeddingLength := llm.KV().EmbeddingLength()
+	headCount := llm.KV().HeadCount()
+	headCountKV := llm.KV().HeadCountKV()
+	vocabLength := len(llm.KV()["tokenizer.ggml.tokens"].([]any))
+
+	var attnQKVWeight1 uint64 = 0
+	for _, t := range llm.Tensors() {
+		if strings.HasSuffix(t.Name, ".attn_qkv.weight") && len(t.Shape) >= 2 {
+			attnQKVWeight1 = t.Shape[1]
+			break
+		}
+	}
+
+	var ffnGate1 uint64 = 0
+	for _, t := range llm.Tensors() {
+		if strings.Index(t.Name, ".ffn_gate") > 0 && len(t.Shape) >= 2 {
+			ffnGate1 = t.Shape[1]
+			break
+		}
+	}
+
+	switch llm.KV().Architecture() {
+	case "gemma":
+		return 4 * int64(batch) * int64(embeddingLength+uint64(vocabLength)), true
+	case "phi2":
+		return max(
+			4*int64(batch)*int64(embeddingLength+uint64(vocabLength)),
+			4*int64(batch)*int64(1+4*embeddingLength+uint64(context)+attnQKVWeight1+uint64(context)*headCount),
+		), true
+	case "qwen2":
+		return max(
+			4*int64(batch)*int64(embeddingLength+uint64(vocabLength)),
+			4*int64(batch)*int64(1+2*embeddingLength+uint64(context)+uint64(context)*headCount),
+		), true
+	case "llama":
+		if ffnGate1 > 0 {
+			// moe
+			return 4 * int64(batch) * int64(2+3*embeddingLength+uint64(context)+uint64(context)*headCount+2*headCountKV+ffnGate1), true
+		}
+	
+		return 4 * int64(batch) * int64(1+4*embeddingLength+uint64(context)+uint64(context)*headCount), true
+	}
+
+	return 0, false
+}

filename: llm/server.go
patch: @@ -79,10 +79,11 @@ func NewLlamaServer(model string, adapters, projectors []string, opts api.Option
 	// fp16 k,v = (1 (k) + 1 (v)) * sizeof(float16) * n_ctx * n_layer * n_embd / n_head * n_head_kv
 	kv := 2 * 2 * int64(opts.NumCtx) * int64(ggml.KV().BlockCount()) * int64(ggml.KV().EmbeddingLength()) / int64(ggml.KV().HeadCount()) * int64(ggml.KV().HeadCountKV())
 
-	// this amount is the overhead + tensors in memory
-	// TODO: get this from the llama.cpp's graph calculations instead of
-	// estimating it's 1/6 * kv_cache_size * num_gqa
-	graph := int64(ggml.KV().GQA()) * kv / 6
+	graph, ok := ggml.GraphSize(opts.NumCtx, min(opts.NumCtx, opts.NumBatch))
+	if !ok {
+		graph = int64(ggml.KV().GQA()) * kv / 6
+	}
+
 	usedMemory += graph
 
 	if (usedMemory > availableMemory || slices.Contains(cpuOnlyFamilies, ggml.KV().Architecture())) && info.Library != "metal" {
Repository: nodejs/node
Pull request: test: fix WPT state when process exits but workers are still running

Because `inProgress` is now a `Set<WPTTestSpec>`.

Refs: https://github.com/nodejs/node/pull/47821#issuecomment-1532015508

Changed files:
filename: test/common/wpt.js
patch: @@ -678,11 +678,8 @@ class WPTRunner {
     }
 
     process.on('exit', () => {
-      if (this.inProgress.size > 0) {
-        for (const id of this.inProgress) {
-          const spec = this.specs.get(id);
-          this.fail(spec, { name: 'Unknown' }, kIncomplete);
-        }
+      for (const spec of this.inProgress) {
+        this.fail(spec, { name: 'Unknown' }, kIncomplete);
       }
       inspect.defaultOptions.depth = Infinity;
       // Sorts the rules to have consistent output
Repository: facebook/react
Pull request: [ci] Temporarily always build from source for codesandbox

Stack from [ghstack](https://github.com/ezyang/ghstack) (oldest at bottom):
* #30512
* #30510
* #30509
* #30508
* #30507
* #30506
* __->__ #30511

We need a GitHub token to download artifacts from GitHub so
unfortunately codesandboxci will need to revert to the slower process
of building from source for now until it's possible to pass secrets to
codesandboxci.

Changed files:
filename: package.json
patch: @@ -134,7 +134,7 @@
     "publish-prereleases": "node ./scripts/release/publish-using-ci-workflow.js",
     "download-build": "node ./scripts/release/download-experimental-build.js",
     "download-build-for-head": "node ./scripts/release/download-experimental-build.js --commit=$(git rev-parse HEAD)",
-    "download-build-in-codesandbox-ci": "cd scripts/release && yarn install && cd ../../ && yarn download-build-for-head || yarn build --type=node react/index react-dom/index react-dom/src/server react-dom/test-utils scheduler/index react/jsx-runtime react/jsx-dev-runtime",
+    "download-build-in-codesandbox-ci": "yarn build --type=node react/index react-dom/index react-dom/src/server react-dom/test-utils scheduler/index react/jsx-runtime react/jsx-dev-runtime",
     "check-release-dependencies": "node ./scripts/release/check-release-dependencies",
     "generate-inline-fizz-runtime": "node ./scripts/rollup/generate-inline-fizz-runtime.js",
     "flags": "node ./scripts/flags/flags.js"
Repository: facebook/react
Pull request: [ci] Fix passing secrets to runtime_prereleases

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

Second try, seems like you need to explicitly pass secrets to reusable
workflows.

Changed files:
filename: .github/workflows/runtime_prereleases.yml
patch: @@ -13,6 +13,9 @@ on:
       dist_tag:
         required: true
         type: string
+    secrets:
+      NPM_TOKEN:
+        required: true
 
 env:
   TZ: /usr/share/zoneinfo/America/Los_Angeles

filename: .github/workflows/runtime_prereleases_manual.yml
patch: @@ -28,6 +28,8 @@ jobs:
       # downstream consumers might still expect that tag. We can remove this
       # after some time has elapsed and the change has been communicated.
       dist_tag: canary,next,rc
+    secrets:
+      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
 
   publish_prerelease_experimental:
     name: Publish to Experimental channel
@@ -41,3 +43,5 @@ jobs:
       commit_sha: ${{ inputs.prerelease_commit_sha }}
       release_channel: experimental
       dist_tag: experimental
+    secrets:
+      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

filename: .github/workflows/runtime_prereleases_nightly.yml
patch: @@ -16,6 +16,8 @@ jobs:
       commit_sha: ${{ github.sha }}
       release_channel: stable
       dist_tag: canary,next,rc
+    secrets:
+      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
 
   publish_prerelease_experimental:
     name: Publish to Experimental channel
@@ -29,3 +31,5 @@ jobs:
       commit_sha: ${{ github.sha }}
       release_channel: experimental
       dist_tag: experimental
+    secrets:
+      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Repository: ggml-org/llama.cpp
Pull request: ci : fix riscv64-native build

A forgotten `llama-cli` -> `llama-completion`.

Changed files:
filename: .github/workflows/build.yml
patch: @@ -1770,7 +1770,7 @@ jobs:
           echo "Fetch llama2c model"
           wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories260K/stories260K.bin
           ./bin/llama-convert-llama2c-to-ggml --copy-vocab-from-model ./tok512.bin --llama2c-model stories260K.bin --llama2c-output-model stories260K.gguf
-          ./bin/llama-cli -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
+          ./bin/llama-completion -m stories260K.gguf -p "One day, Lily met a Shoggoth" -n 500 -c 256
 
   ubuntu-cmake-sanitizer-riscv64-native:
     runs-on: RISCV64
Repository: ollama/ollama
Pull request: default head_kv to 1

some older models do not set this kv resulting in the kv size estimate to be 0

Changed files:
filename: llm/ggml.go
patch: @@ -148,15 +148,15 @@ func (kv KV) HeadCount() uint64 {
 }
 
 func (kv KV) HeadCountKV() uint64 {
-	return kv.u64(fmt.Sprintf("%s.attention.head_count_kv", kv.Architecture()))
+	if headCountKV := kv.u64(fmt.Sprintf("%s.attention.head_count_kv", kv.Architecture())); headCountKV > 0 {
+		return headCountKV
+	}
+
+	return 1
 }
 
 func (kv KV) GQA() uint64 {
-	if headCountKV := kv.HeadCountKV(); headCountKV > 0 {
-		return kv.HeadCount() / headCountKV
-	}
-
-	return 0
+	return kv.HeadCount() / kv.HeadCountKV()
 }
 
 func (kv KV) EmbeddingLength() uint64 {
Repository: denoland/deno
Pull request: fix(install): do not panic if lockfile incorrectly says package has a bin

Confirmed added test panics before this PR, passes after

Changed files:
filename: libs/npm_installer/bin_entries.rs
patch: @@ -81,10 +81,14 @@ impl<'a, TSys: SetupBinEntrySys> BinEntries<'a, TSys> {
     extra: &'b NpmPackageExtraInfo,
     package_path: PathBuf,
   ) {
+    let Some(bin) = extra.bin.as_ref() else {
+      // likely lockfile incorrectly said that the package has a bin
+      return;
+    };
     self.sorted = false;
     // check for a new collision, if we haven't already
     // found one
-    match extra.bin.as_ref().unwrap() {
+    match bin {
       deno_npm::registry::NpmPackageVersionBinEntry::String(_) => {
         let bin_name = default_bin_name(package);
 

filename: tests/specs/install/bad_lockfile_bin_entry/__test__.jsonc
patch: @@ -0,0 +1,9 @@
+{
+  "tempDir": true,
+  "steps": [
+    {
+      "args": "install",
+      "output": "[WILDCARD]"
+    }
+  ]
+}

filename: tests/specs/install/bad_lockfile_bin_entry/deno.json
patch: @@ -0,0 +1,6 @@
+{
+  "imports": {
+    "@denotest/add": "npm:@denotest/add@^1.0.0"
+  },
+  "nodeModulesDir": "manual"
+}

filename: tests/specs/install/bad_lockfile_bin_entry/deno.lock
patch: @@ -0,0 +1,18 @@
+{
+  "version": "5",
+  "specifiers": {
+    "npm:@denotest/add@1": "1.0.0"
+  },
+  "npm": {
+    "@denotest/add@1.0.0": {
+      "integrity": "sha512-uvNpnVPU/CC2Do/LNF3TkhoLGLLKC6jFDPiSnojuZCEwmoXJjS2+Sn+LYk7eUix4vsMKA9ctxaMhcfb6pdHQTQ==",
+      "tarball": "http://localhost:4260/@denotest/add/1.0.0.tgz",
+      "bin": true
+    }
+  },
+  "workspace": {
+    "dependencies": [
+      "npm:@denotest/add@1"
+    ]
+  }
+}
Repository: nodejs/node
Pull request: meta: add web-standards as WPTs owner

Self explanatory title.

cc @nodejs/web-standards 

Changed files:
filename: .github/CODEOWNERS
patch: @@ -178,3 +178,5 @@
 # Web Standards
 /lib/internal/bootstrap/web/* @nodejs/web-standards
 /lib/internal/navigator.js @nodejs/web-standards
+/test/fixtures/wpt/ @nodejs/web-standards
+/test/wpt/ @nodejs/web-standards
Repository: ollama/ollama
Pull request: cmd: provide feedback if OLLAMA_MODELS is set on `run` command

This also moves the checkServerHeartbeat call out of the "RunE" Cobra stuff (that's the only word I have for that) to on-site where it's after the check for OLLAMA_MODELS, which allows the helpful error message to be printed before the server heartbeat check. This also arguably makes the code more readable without the magic/superfluous "pre" function caller.

Changed files:
filename: cmd/cmd.go
patch: @@ -226,6 +226,14 @@ func createBlob(cmd *cobra.Command, client *api.Client, path string) (string, er
 }
 
 func RunHandler(cmd *cobra.Command, args []string) error {
+	if os.Getenv("OLLAMA_MODELS") != "" {
+		return errors.New("OLLAMA_MODELS must only be set for 'ollama serve'")
+	}
+
+	if err := checkServerHeartbeat(cmd, args); err != nil {
+		return err
+	}
+
 	client, err := api.ClientFromEnvironment()
 	if err != nil {
 		return err
@@ -951,11 +959,10 @@ func NewCLI() *cobra.Command {
 	showCmd.Flags().Bool("system", false, "Show system message of a model")
 
 	runCmd := &cobra.Command{
-		Use:     "run MODEL [PROMPT]",
-		Short:   "Run a model",
-		Args:    cobra.MinimumNArgs(1),
-		PreRunE: checkServerHeartbeat,
-		RunE:    RunHandler,
+		Use:   "run MODEL [PROMPT]",
+		Short: "Run a model",
+		Args:  cobra.MinimumNArgs(1),
+		RunE:  RunHandler,
 	}
 
 	runCmd.Flags().Bool("verbose", false, "Show timings for response")