helloadhavan/github_issues huggingface dataset:
Repository: ollama/ollama
Pull request: Increase minimum CUDA overhead to 1024MiB


Changed files:
filename: gpu/gpu.go
patch: @@ -191,11 +191,11 @@ func getCPUMem() (memInfo, error) {
 func CheckVRAM() (int64, error) {
 	gpuInfo := GetGPUInfo()
 	if gpuInfo.FreeMemory > 0 && (gpuInfo.Library == "cuda" || gpuInfo.Library == "rocm") {
-		// leave 10% or 512MiB of VRAM free per GPU to handle unaccounted for overhead
+		// leave 10% or 1024MiB of VRAM free per GPU to handle unaccounted for overhead
 		overhead := gpuInfo.FreeMemory / 10
 		gpus := uint64(gpuInfo.DeviceCount)
-		if overhead < gpus*512*1024*1024 {
-			overhead = gpus * 512 * 1024 * 1024
+		if overhead < gpus*1024*1024*1024 {
+			overhead = gpus * 1024 * 1024 * 1024
 		}
 		return int64(gpuInfo.FreeMemory - overhead), nil
 	}
Repository: denoland/deno
Pull request: fix(fetch): fix SOCKS5 proxy URL validation logic

## Summary

This PR fixes a logical error in the SOCKS5 proxy URL validation in `Deno.createHttpClient()`.

**The bug:** The condition for validating SOCKS5 proxy URLs was using `||` (OR) instead of `&&` (AND):
```javascript
// Before (broken)
if (
  !StringPrototypeStartsWith(url, "socks5:") ||
  !StringPrototypeStartsWith(url, "socks5h:")
) { throw ... }
```

This meant that a valid `socks5://` URL would still throw because it doesn't start with `socks5h:`, and vice versa. The condition would almost always be true, making SOCKS5 proxies unusable.

**The fix:**
```javascript
// After (fixed)
if (
  !StringPrototypeStartsWith(url, "socks5:") &&
  !StringPrototypeStartsWith(url, "socks5h:")
) { throw ... }
```

Now the error is only thrown when the URL starts with NEITHER `socks5:` nor `socks5h:`.

## Changes

- **ext/fetch/22_http_client.js**: Fixed the logical operator from `||` to `&&`
- **tests/unit/fetch_test.ts**: Added tests to verify that SOCKS5 transport accepts both `socks5://` and `socks5h://` URLs

## Test plan

- [x] Added test `createHttpClientSocks5ProxyAcceptsSocks5Url` - verifies socks5 transport accepts socks5:// URLs
- [x] Added test `createHttpClientSocks5ProxyAcceptsSocks5hUrl` - verifies socks5 transport accepts socks5h:// URLs
- [x] Manually verified with dev build that socks5:// and socks5h:// URLs now work correctly

Closes #31356

Changed files:
filename: ext/fetch/22_http_client.js
patch: @@ -64,7 +64,7 @@ function createHttpClient(options) {
         case "socks5": {
           const url = options.proxy.url;
           if (
-            !StringPrototypeStartsWith(url, "socks5:") ||
+            !StringPrototypeStartsWith(url, "socks5:") &&
             !StringPrototypeStartsWith(url, "socks5h:")
           ) {
             throw new TypeError(

filename: tests/unit/fetch_test.ts
patch: @@ -2311,6 +2311,38 @@ Deno.test(
   },
 );
 
+Deno.test(
+  {
+    permissions: { net: true },
+  },
+  function createHttpClientSocks5ProxyAcceptsSocks5Url() {
+    // Test that socks5 transport accepts socks5:// URLs
+    using client = Deno.createHttpClient({
+      proxy: {
+        transport: "socks5",
+        url: "socks5://localhost:1080",
+      },
+    });
+    assert(client instanceof Deno.HttpClient);
+  },
+);
+
+Deno.test(
+  {
+    permissions: { net: true },
+  },
+  function createHttpClientSocks5ProxyAcceptsSocks5hUrl() {
+    // Test that socks5 transport accepts socks5h:// URLs
+    using client = Deno.createHttpClient({
+      proxy: {
+        transport: "socks5",
+        url: "socks5h://localhost:1080",
+      },
+    });
+    assert(client instanceof Deno.HttpClient);
+  },
+);
+
 Deno.test(
   {
     permissions: { net: true },
Repository: huggingface/transformers
Pull request: [cache] Only use scalars in `get_mask_sizes`

# What does this PR do?

As per the title. We can rely on the scalar `self.cumulative_length` instead of tensor `cache_position[0]`, as was introduced in https://github.com/huggingface/transformers/pull/40893. It's much better for downstream masking and compilation support.

Changed files:
filename: src/transformers/cache_utils.py
patch: @@ -122,8 +122,7 @@ def get_mask_sizes(self, cache_position: torch.Tensor) -> tuple[int, int]:
         """Return the length and offset of the cache, used to generate the mask"""
         kv_offset = 0
         query_length = cache_position.shape[0]
-        past_seen_tokens = self.get_seq_length()
-        kv_length = query_length + past_seen_tokens
+        kv_length = self.get_seq_length() + query_length
         return kv_length, kv_offset
 
     def get_seq_length(self) -> int:
@@ -212,14 +211,13 @@ def update(
     def get_mask_sizes(self, cache_position: torch.Tensor) -> tuple[int, int]:
         """Return the length and offset of the cache, used to generate the attention mask"""
         query_length = cache_position.shape[0]
-        first_cache_position = cache_position[0]
+        is_full = self.cumulative_length >= self.sliding_window
 
-        kv_offset = torch.clamp(first_cache_position - self.sliding_window + 1, min=0)
-
-        if self.get_seq_length() >= self.sliding_window:
+        kv_offset = max(self.cumulative_length - self.sliding_window + 1, 0)
+        if is_full:
             kv_length = self.sliding_window - 1 + query_length
         else:
-            kv_length = self.get_seq_length() + query_length
+            kv_length = self.cumulative_length + query_length
 
         return kv_length, kv_offset
 
@@ -461,9 +459,10 @@ def get_mask_sizes(self, cache_position: torch.Tensor) -> tuple[int, int]:
         # Not yet full, but becoming full on this update
         elif self.cumulative_length + query_length > sliding_window:
             kv_length = self.cumulative_length + query_length
+        # Here the Cache is still smaller than the local size, but we return the local size as it's static
         else:
-            # Here the Cache is still smaller than the local size, but we return the local size as it's static
             kv_length = sliding_window
+
         return kv_length, kv_offset
 
     def get_seq_length(self) -> int:
Repository: vercel/next.js
Pull request: Development: Clarify TypescriptStatus in watcher

## What?

Makes it easier to reason about given there's only one variable to keep track off instead of `usingTypeScript` vs `enabledTypeScript`.

Closes PACK-5469

Changed files:
filename: packages/next/src/server/lib/router-utils/setup-dev-bundler.ts
patch: @@ -133,7 +133,6 @@ export type ServerFields = {
 }
 
 async function verifyTypeScript(opts: SetupOpts) {
-  let usingTypeScript = false
   const verifyResult = await verifyTypeScriptSetup({
     dir: opts.dir,
     distDir: opts.nextConfig.distDir,
@@ -146,9 +145,9 @@ async function verifyTypeScript(opts: SetupOpts) {
   })
 
   if (verifyResult.version) {
-    usingTypeScript = true
+    return true
   }
-  return usingTypeScript
+  return false
 }
 
 export async function propagateServerField(
@@ -242,8 +241,6 @@ async function startWatcher(
     opts.nextConfig
   )
 
-  const usingTypeScript = await verifyTypeScript(opts)
-
   const routesManifestPath = path.join(distDir, ROUTES_MANIFEST)
   const routesManifest: DevRoutesManifest = {
     version: 3,
@@ -348,14 +345,15 @@ async function startWatcher(
       },
     })
     const fileWatchTimes = new Map()
-    let enabledTypeScript = usingTypeScript
+    let enabledTypeScript = await verifyTypeScript(opts)
     let previousClientRouterFilters: any
     let previousConflictingPagePaths: Set<string> = new Set()
 
     const routeTypesFilePath = path.join(distDir, 'types', 'routes.d.ts')
     const validatorFilePath = path.join(distDir, 'types', 'validator.ts')
 
     wp.on('aggregated', async () => {
+      let typescriptStatusFromLastAggregation = enabledTypeScript
       let middlewareMatchers: MiddlewareMatcher[] | undefined
       const routedPages: string[] = []
       const knownFiles = wp.getTimeInfoEntries()
@@ -728,7 +726,8 @@ async function startWatcher(
         }
       }
 
-      if (!usingTypeScript && enabledTypeScript) {
+      // Using === false to make the check clearer.
+      if (typescriptStatusFromLastAggregation === false && enabledTypeScript) {
         // we tolerate the error here as this is best effort
         // and the manual install command will be shown
         await verifyTypeScript(opts)
@@ -753,7 +752,7 @@ async function startWatcher(
             }
           )
 
-          if (usingTypeScript && nextConfig.experimental?.typedEnv) {
+          if (enabledTypeScript && nextConfig.experimental?.typedEnv) {
             // do not await, this is not essential for further process
             createEnvDefinitions({
               distDir,
@@ -1091,7 +1090,7 @@ async function startWatcher(
         }
         prevSortedRoutes = sortedRoutes
 
-        if (usingTypeScript) {
+        if (enabledTypeScript) {
           const routeTypesManifest = await createRouteTypesManifest({
             dir,
             pageRoutes,
Repository: facebook/react
Pull request: Minify DEV bundles with closure

The goal is to improve speed of the development by inlining and DCE unused branches.

We have the ability to preserve some variable names and pretty print in the production version so might as well do the same with DEV.



Changed files:
filename: packages/shared/CheckStringCoercion.js
patch: @@ -43,6 +43,7 @@ function willCoercionThrow(value: mixed): boolean {
   }
 }
 
+/** @noinline */
 function testStringCoercion(value: mixed) {
   // If you ended up here by following an exception call stack, here's what's
   // happened: you supplied an object or symbol value to React (as a prop, key,

filename: scripts/rollup/build.js
patch: @@ -361,7 +361,8 @@ function getPlugins(
     const isProduction = isProductionBundleType(bundleType);
     const isProfiling = isProfilingBundleType(bundleType);
 
-    const needsMinifiedByClosure = isProduction && bundleType !== ESM_PROD;
+    const needsMinifiedByClosure =
+      bundleType !== ESM_PROD && bundleType !== ESM_DEV;
 
     return [
       // Keep dynamic imports as externals
Repository: ollama/ollama
Pull request: Created tutorial for running Ollama on NVIDIA Jetson devices

This pull request provides guidance for people interested in enabling NVIDIA's AI edge computing devices to run Ollama at full power (i.e. on the integrated GPU). Several people (myself included) have expressed interest in this capability (please see issue #1071).

@BruceMacD mentioned via Discord that the CLI will soon support passing `num_gpu` as a parameter when running `ollama serve`. I will update the tutorial when that becomes available.

Thanks!

Changed files:
filename: docs/tutorials.md
patch: @@ -4,5 +4,6 @@ Here is a list of ways you can use Ollama with other tools to build interesting
 
 - [Using LangChain with Ollama in JavaScript](./tutorials/langchainjs.md)
 - [Using LangChain with Ollama in Python](./tutorials/langchainpy.md)
+- [Running Ollama on NVIDIA Jetson Devices](./tutorials/nvidia-jetson.md)
 
-Also be sure to check out the [examples](../examples) directory for more ways to use Ollama.
\ No newline at end of file
+Also be sure to check out the [examples](../examples) directory for more ways to use Ollama.

filename: docs/tutorials/nvidia-jetson.md
patch: @@ -0,0 +1,38 @@
+# Running Ollama on NVIDIA Jetson Devices
+
+With some minor configuration, Ollama runs well on [NVIDIA Jetson Devices](https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/). The following has been tested on [JetPack 5.1.2](https://developer.nvidia.com/embedded/jetpack).
+
+NVIDIA Jetson devices are Linux-based embedded AI computers that are purpose-built for AI applications.
+
+Jetsons have an integrated GPU that is wired directly to the memory controller of the machine. For this reason, the `nvidia-smi` command is unrecognized, and Ollama proceeds to operate in "CPU only"
+mode. This can be verified by using a monitoring tool like jtop.
+
+In order to address this, we simply pass the path to the Jetson's pre-installed CUDA libraries into `ollama serve` (while in a tmux session). We then hardcode the num_gpu parameters into a cloned
+version of our target model.
+
+Prerequisites:
+
+- curl
+- tmux
+
+Here are the steps:
+
+- Install Ollama via standard Linux command (ignore the 404 error): `curl https://ollama.ai/install.sh | sh`
+- Stop the Ollama service: `sudo systemctl stop ollama`
+- Start Ollama serve in a tmux session called ollama_jetson and reference the CUDA libraries path: `tmux has-session -t ollama_jetson 2>/dev/null || tmux new-session -d -s ollama_jetson 
+'LD_LIBRARY_PATH=/usr/local/cuda/lib64 ollama serve'`
+- Pull the model you want to use (e.g. mistral): `ollama pull mistral`
+- Create a new Modelfile specifically for enabling GPU support on the Jetson: `touch ModelfileMistralJetson`
+- In the ModelfileMistralJetson file, specify the FROM model and the num_gpu PARAMETER as shown below:
+
+```
+FROM mistral
+PARAMETER num_gpu 999
+```
+
+- Create a new model from your Modelfile: `ollama create mistral-jetson -f ./ModelfileMistralJetson`
+- Run the new model: `ollama run mistral-jetson`
+
+If you run a monitoring tool like jtop you should now see that Ollama is using the Jetson's integrated GPU.
+
+And that's it!
Repository: nodejs/node
Pull request: test: skip tests that cause timeouts on IBM i

I missed marking a couple of test cases flaky in my previous PR:
https://github.com/nodejs/node/pull/58583

tests missed were:

- parallel.test-inspector-network-content-type
- benchmark.test-benchmark-websocket

After marking the above flaky I re-ran a test build and noticed
the build still failed.

Unfortuantely the build still fails because the build detects that
node process are left behind after the tests, presumably because tests
that spawn child processes are being timed out and only the parent
process is killed off, leaving the child processes behind.

see: https://github.com/nodejs/node/pull/59014#issuecomment-3057162303

We've decided to skip these tests until the underlying issue is
resolved.

The tests being skipped are:
- parallel.test-http-proxy-fetch
- parallel.test-https-proxy-fetch
- benchmark.test-benchmark-websocket
- parallel.test-inspector-network-fetch
- parallel.test-inspector-network-content-type
- es-module.test-wasm-web-api
- parallel.test-fetch
- parallel.test-without-async-context-frame
- report.test-report-exclude-network

Changed files:
filename: test/benchmark/benchmark.status
patch: @@ -23,3 +23,5 @@ test-benchmark-crypto: PASS, FLAKY
 
 [$arch==arm]
 
+[$system==ibmi]
+test-benchmark-websocket: SKIP

filename: test/es-module/es-module.status
patch: @@ -16,4 +16,4 @@ test-wasm-web-api: SKIP
 
 [$system==ibmi]
 # https://github.com/nodejs/node/issues/58582
-test-wasm-web-api: PASS,FLAKY
+test-wasm-web-api: SKIP

filename: test/parallel/parallel.status
patch: @@ -129,11 +129,12 @@ test-tls-write-error: PASS, FLAKY
 # https://github.com/nodejs/node/issues/48047
 test-http-pipeline-flood: SKIP
 # https://github.com/nodejs/node/issues/58582
-test-http-proxy-fetch: PASS, FLAKY
-test-https-proxy-fetch: PASS, FLAKY
-test-inspector-network-fetch:  PASS, FLAKY
-test-fetch:  PASS, FLAKY
-test-without-async-context-frame: PASS, FLAKY
+test-http-proxy-fetch: SKIP
+test-https-proxy-fetch: SKIP
+test-inspector-network-fetch:  SKIP
+test-inspector-network-content-type: SKIP
+test-fetch:  SKIP
+test-without-async-context-frame: SKIP
 test-process-cpuUsage: PASS, FLAKY
 
 

filename: test/report/report.status
patch: @@ -12,4 +12,4 @@ test-report-fatal-error: PASS, FLAKY
 
 [$system==ibmi]
 # https://github.com/nodejs/node/issues/58582
-test-report-exclude-network: PASS,FLAKY
+test-report-exclude-network: SKIP
Repository: facebook/react
Pull request: [compiler] Always emit variable decl in gating mode

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

This PR makes it so we always emit a const VariableDeclaration for
compiled functions in gating mode. If the original declaration's parent
was an ExportDefaultDeclaration we'll also append a new
ExportDefaultDeclaration pointing to the new identifier. This allows
code that adds optional properties to the function declaration to still
work in gating mode

Changed files:
filename: compiler/packages/snap/src/SproutTodoFilter.ts
patch: @@ -490,7 +490,6 @@ const skipFilter = new Set([
   "bug-invalid-hoisting-functionexpr",
   "original-reactive-scopes-fork/bug-nonmutating-capture-in-unsplittable-memo-block",
   "original-reactive-scopes-fork/bug-hoisted-declaration-with-scope",
-  "bug-gating-invalid-function-properties",
 
   // 'react-compiler-runtime' not yet supported
   "flag-enable-emit-hook-guards",
Repository: ollama/ollama
Pull request: Sign dynamic libraries on macOS

Also fixes `gzip` from erroring if `.gz` files already exist

Changed files:
filename: llm/generate/gen_common.sh
patch: @@ -83,8 +83,9 @@ build() {
 compress_libs() {
     echo "Compressing payloads to reduce overall binary size..."
     pids=""
+    rm -rf ${BUILD_DIR}/lib/*.${LIB_EXT}*.gz
     for lib in ${BUILD_DIR}/lib/*.${LIB_EXT}* ; do
-        gzip --best ${lib} &
+        gzip --best -f ${lib} &
         pids+=" $!"
     done
     echo 

filename: llm/generate/gen_darwin.sh
patch: @@ -12,6 +12,12 @@ init_vars
 git_module_setup
 apply_patches
 
+sign() {
+    if [ -n "$APPLE_IDENTITY" ]; then
+        codesign -f --timestamp --deep --options=runtime --sign "$APPLE_IDENTITY" --identifier ai.ollama.ollama $1
+    fi
+}
+
 COMMON_DARWIN_DEFS="-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DCMAKE_SYSTEM_NAME=Darwin -DLLAMA_ACCELERATE=off"
 
 case "${GOARCH}" in
@@ -25,6 +31,7 @@ case "${GOARCH}" in
     BUILD_DIR="${LLAMACPP_DIR}/build/darwin/${ARCH}/cpu"
     echo "Building LCD CPU"
     build
+    sign ${LLAMACPP_DIR}/build/darwin/${ARCH}/cpu/lib/libext_server.dylib
     compress_libs
 
     #
@@ -36,6 +43,7 @@ case "${GOARCH}" in
     BUILD_DIR="${LLAMACPP_DIR}/build/darwin/${ARCH}/cpu_avx"
     echo "Building AVX CPU"
     build
+    sign ${LLAMACPP_DIR}/build/darwin/${ARCH}/cpu_avx/lib/libext_server.dylib
     compress_libs
 
     #
@@ -47,13 +55,15 @@ case "${GOARCH}" in
     BUILD_DIR="${LLAMACPP_DIR}/build/darwin/${ARCH}/cpu_avx2"
     echo "Building AVX2 CPU"
     build
+    sign ${LLAMACPP_DIR}/build/darwin/${ARCH}/cpu_avx2/lib/libext_server.dylib
     compress_libs
     ;;
 "arm64")
     CMAKE_DEFS="${COMMON_DARWIN_DEFS} -DCMAKE_SYSTEM_PROCESSOR=${ARCH} -DCMAKE_OSX_ARCHITECTURES=${ARCH} -DLLAMA_METAL=on -DLLAMA_ACCELERATE=on ${CMAKE_DEFS}"
     BUILD_DIR="${LLAMACPP_DIR}/build/darwin/${ARCH}/metal"
     EXTRA_LIBS="${EXTRA_LIBS} -framework Accelerate -framework Foundation -framework Metal -framework MetalKit -framework MetalPerformanceShaders"
     build
+    sign ${LLAMACPP_DIR}/build/darwin/${ARCH}/metal/lib/libext_server.dylib
     compress_libs
     ;;
 *)

filename: llm/generate/gen_windows.ps1
patch: @@ -76,7 +76,7 @@ function compress_libs {
     write-host "Compressing dlls..."
     $libs = dir "${script:buildDir}/lib/*.dll"
     foreach ($file in $libs) {
-        & "$script:GZIP" --best $file
+        & "$script:GZIP" --best -f $file
     }
 }
Repository: facebook/react
Pull request: [compiler] Add repro for func properties bug with @gating

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

When gating is enabled, any function declaration properties that were
previously set (typically `Function.displayName`) would cause a crash
after compilation as the original identifier is no longer present.

Changed files:
filename: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/bug-gating-invalid-function-properties.expect.md
patch: @@ -5,15 +5,20 @@
 // @gating
 
 /**
- * Fail: bug-dropped-function-properties
+ * Fail: bug-gating-invalid-function-properties
  *   Unexpected error in Forget runner
  *   Component is not defined
  */
 export default function Component() {
   return <></>;
 }
 
-Component.displayName = "some display name";
+export function Component2() {
+  return <></>;
+}
+
+Component.displayName = "Component ONE";
+Component2.displayName = "Component TWO";
 
 export const FIXTURE_ENTRYPOINT = {
   fn: Component,
@@ -30,7 +35,7 @@ import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag";
 import { c as _c } from "react/compiler-runtime"; // @gating
 
 /**
- * Fail: bug-dropped-function-properties
+ * Fail: bug-gating-invalid-function-properties
  *   Unexpected error in Forget runner
  *   Component is not defined
  */
@@ -50,7 +55,24 @@ export default isForgetEnabled_Fixtures()
       return <></>;
     };
 
-Component.displayName = "some display name";
+export const Component2 = isForgetEnabled_Fixtures()
+  ? function Component2() {
+      const $ = _c(1);
+      let t0;
+      if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
+        t0 = <></>;
+        $[0] = t0;
+      } else {
+        t0 = $[0];
+      }
+      return t0;
+    }
+  : function Component2() {
+      return <></>;
+    };
+
+Component.displayName = "Component ONE";
+Component2.displayName = "Component TWO";
 
 export const FIXTURE_ENTRYPOINT = {
   fn: Component,

filename: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/bug-gating-invalid-function-properties.tsx
patch: @@ -9,7 +9,12 @@ export default function Component() {
   return <></>;
 }
 
-Component.displayName = "some display name";
+export function Component2() {
+  return <></>;
+}
+
+Component.displayName = "Component ONE";
+Component2.displayName = "Component TWO";
 
 export const FIXTURE_ENTRYPOINT = {
   fn: Component,
Repository: ollama/ollama
Pull request: fix: cache prompt causes kv cache to fill and not return after some time

- prompt cache causes inferance to hang after some time

This is a temporary fix to mitigate #1994 if I can't fix the root cause before the next release.

Changed files:
filename: llm/dyn_ext_server.go
patch: @@ -181,7 +181,6 @@ func (llm *dynExtServer) Predict(ctx context.Context, predict PredictOpts, fn fu
 		"seed":              predict.Options.Seed,
 		"stop":              predict.Options.Stop,
 		"image_data":        imageData,
-		"cache_prompt":      true,
 	}
 
 	if predict.Format == "json" {
Repository: ollama/ollama
Pull request: More WSL paths

Fixes #1939 

Changed files:
filename: gpu/gpu.go
patch: @@ -38,6 +38,7 @@ var CudaLinuxGlobs = []string{
 	"/usr/lib/x86_64-linux-gnu/nvidia/current/libnvidia-ml.so*",
 	"/usr/lib/x86_64-linux-gnu/libnvidia-ml.so*",
 	"/usr/lib/wsl/lib/libnvidia-ml.so*",
+	"/usr/lib/wsl/drivers/*/libnvidia-ml.so*",
 	"/opt/cuda/lib64/libnvidia-ml.so*",
 	"/opt/cuda/targets/x86_64-linux/lib/stubs/libnvidia-ml.so*",
 	"/usr/lib*/libnvidia-ml.so*",