helloadhavan/github_issues huggingface dataset:
Repository: denoland/deno
Pull request: fix(ext/websocket): prevent sending multiple close frames

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

Changed files:
filename: Cargo.lock
patch: @@ -3975,7 +3975,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "27cea6e7f512d43b098939ff4d5a5d6fe3db07971e1d05176fe26c642d33f5b8"
 dependencies = [
  "getrandom 0.3.3",
- "rand 0.9.1",
+ "rand 0.9.2",
  "siphasher 1.0.1",
  "wide",
 ]
@@ -3998,9 +3998,9 @@ checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
 
 [[package]]
 name = "fastwebsockets"
-version = "0.8.0"
+version = "0.8.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26da0c7b5cef45c521a6f9cdfffdfeb6c9f5804fbac332deb5ae254634c7a6be"
+checksum = "9dac026e15fb7e44d768880b868a0fd5bd30ffdee272e88b3060f657a5a72947"
 dependencies = [
  "base64 0.21.7",
  "bytes",
@@ -4740,7 +4740,7 @@ dependencies = [
  "idna",
  "ipnet",
  "once_cell",
- "rand 0.9.1",
+ "rand 0.9.2",
  "ring",
  "serde",
  "thiserror 2.0.12",
@@ -4763,7 +4763,7 @@ dependencies = [
  "moka",
  "once_cell",
  "parking_lot",
- "rand 0.9.1",
+ "rand 0.9.2",
  "resolv-conf",
  "serde",
  "smallvec",
@@ -7307,7 +7307,7 @@ dependencies = [
  "fastbloom",
  "getrandom 0.3.3",
  "lru-slab",
- "rand 0.9.1",
+ "rand 0.9.2",
  "ring",
  "rustc-hash 2.1.1",
  "rustls",
@@ -7404,9 +7404,9 @@ dependencies = [
 
 [[package]]
 name = "rand"
-version = "0.9.1"
+version = "0.9.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97"
+checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1"
 dependencies = [
  "rand_chacha 0.9.0",
  "rand_core 0.9.3",
@@ -8397,9 +8397,9 @@ dependencies = [
 
 [[package]]
 name = "simdutf8"
-version = "0.1.4"
+version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a"
+checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e"
 
 [[package]]
 name = "siphasher"

filename: Cargo.toml
patch: @@ -171,7 +171,7 @@ encoding_rs = "=0.8.35"
 error_reporter = "1"
 fast-socks5 = "0.9.6"
 faster-hex = "0.10.0"
-fastwebsockets = { version = "0.8", features = ["upgrade", "unstable-split"] }
+fastwebsockets = { version = "^0.8.1", features = ["upgrade", "unstable-split"] }
 file_test_runner = "0.11.1"
 filetime = "0.2.16"
 flate2 = { version = "1.0.30", default-features = false }
Repository: ollama/ollama
Pull request: Refine debug logging for llm

This wires up logging in llama.cpp to always go to stderr, and also turns up logging if OLLAMA_DEBUG is set.

This solves a couple problems.  We used to emit one line to llama.log in verbose/debug mode before shifting to stdout.  Now all the logging from llama.cpp will go to stderr, and the verbosity can be controlled at runtime.

Changed files:
filename: llm/dyn_ext_server.go
patch: @@ -136,6 +136,12 @@ func newDynExtServer(library, model string, adapters, projectors []string, opts
 
 	sparams.n_threads = C.uint(opts.NumThread)
 
+	if debug := os.Getenv("OLLAMA_DEBUG"); debug != "" {
+		sparams.verbose_logging = C.bool(true)
+	} else {
+		sparams.verbose_logging = C.bool(false)
+	}
+
 	slog.Info("Initializing llama server")
 	initResp := newExtServerResp(128)
 	defer freeExtServerResp(initResp)

filename: llm/ext_server/ext_server.cpp
patch: @@ -30,16 +30,17 @@ std::atomic<bool> ext_server_running(false);
 std::thread ext_server_thread;
 
 void llama_server_init(ext_server_params *sparams, ext_server_resp_t *err) {
-#if SERVER_VERBOSE != 1
-  log_disable();
-#endif
-  LOG_TEE("system info: %s\n", llama_print_system_info());
   assert(err != NULL && sparams != NULL);
+  log_set_target(stderr);
+  if (!sparams->verbose_logging) {
+    log_disable();
+  }
+
+  LOG_TEE("system info: %s\n", llama_print_system_info());
   err->id = 0;
   err->msg[0] = '\0';
   try {
     llama = new llama_server_context;
-    log_set_target(stdout);
     gpt_params params;
     params.n_ctx = sparams->n_ctx;
     params.n_batch = sparams->n_batch;

filename: llm/ext_server/ext_server.h
patch: @@ -45,6 +45,7 @@ typedef struct ext_server_params {
   bool embedding;        // get only sentence embedding
   ext_server_lora_adapter_t *lora_adapters;
   char *mmproj;
+  bool verbose_logging;  // Enable verbose logging of the server
 } ext_server_params_t;
 
 typedef struct ext_server_task_result {
Repository: ollama/ollama
Pull request: Debug logging on init failure

One class of error we're seeing on ROCm looks like this in the log...
```
2024/01/21 22:00:15 dyn_ext_server.go:90: INFO Loading Dynamic llm server: /tmp/ollama1546965028/rocm_v5/libext_server.so
2024/01/21 22:00:15 dyn_ext_server.go:139: INFO Initializing llama server
free(): invalid pointer
```

I'm not sure yet what the root cause is, but hopefully this debug log will yield some more insight.

Changed files:
filename: llm/dyn_ext_server.go
patch: @@ -142,7 +142,9 @@ func newDynExtServer(library, model string, adapters, projectors []string, opts
 	C.dyn_llama_server_init(llm.s, &sparams, &initResp)
 	if initResp.id < 0 {
 		mutex.Unlock()
-		return nil, extServerResponseToErr(initResp)
+		err := extServerResponseToErr(initResp)
+		slog.Debug(fmt.Sprintf("failure during initialization: %s", err))
+		return nil, err
 	}
 
 	slog.Info("Starting llama main loop")
Repository: facebook/react
Pull request: fix[react-devtools] component badge in light mode is now not invisible

In light mode, component badges in profiler were invisible due to using the alpha channel to produce the grayish color. Instead I'm using the equivalent RGB without that alpha.

**before**
In light mode, component badges in profiler were invisible (forwardRef badge in this case):
![Screenshot 2024-06-11 at 13 15 16](https://github.com/facebook/react/assets/5188459/385b80a5-d385-4eac-bac6-7fec6938d78f)

**after**
Profiler tooltip fix. also notice there's no regression on the right menu:
![Screenshot 2024-06-11 at 13 04 41](https://github.com/facebook/react/assets/5188459/64aa27f7-35b8-4e3b-91d4-c12d5a97330e)

also works in dark mode:
![Screenshot 2024-06-11 at 13 12 17](https://github.com/facebook/react/assets/5188459/99aa55fd-23ee-4881-9676-63eca86bf761)

Still visible in components in light mode, whether selected or not:
![Screenshot 2024-06-11 at 13 04 49](https://github.com/facebook/react/assets/5188459/59c0bf63-d9b0-4d46-a145-f615249d1da0)

components dark mode:
![Screenshot 2024-06-11 at 13 10 25](https://github.com/facebook/react/assets/5188459/16e61acc-c431-4bfa-8a65-ca6701f4379b)

Changed files:
filename: packages/react-devtools-shared/src/devtools/constants.js
patch: @@ -50,7 +50,7 @@ export const THEME_STYLES: {[style: Theme | DisplayDensity]: any, ...} = {
     '--color-commit-gradient-text': '#000000',
     '--color-component-name': '#6a51b2',
     '--color-component-name-inverted': '#ffffff',
-    '--color-component-badge-background': 'rgba(0, 0, 0, 0.1)',
+    '--color-component-badge-background': '#e6e6e6',
     '--color-component-badge-background-inverted': 'rgba(255, 255, 255, 0.25)',
     '--color-component-badge-count': '#777d88',
     '--color-component-badge-count-inverted': 'rgba(255, 255, 255, 0.7)',
Repository: electron/electron
Pull request: fix: use-after-move of bus connection in xdg portal detection

#### Description of Change

Fixes https://github.com/electron/electron/issues/47007

#### Release Notes

Notes: fix crash in xdg portal version detection on startup

Changed files:
filename: shell/browser/ui/file_dialog_linux_portal.cc
patch: @@ -86,8 +86,9 @@ void CheckPortalAvailabilityOnBusThread() {
                     << (g_portal_available ? "yes" : "no");
             flag->Set();
             bus->ShutdownAndBlock();
+            bus.reset();
           },
-          std::move(bus), flag));
+          bus, flag));
 }
 
 }  // namespace
Repository: ollama/ollama
Pull request: Update submodule to `6f9939d119b2d004c264952eb510bd106455531e`


Changed files:
filename: llm/llama.cpp
patch: @@ -1 +1 @@
-Subproject commit 584d674be622fbf1578694ada6e62eebedbfd377
+Subproject commit 6f9939d119b2d004c264952eb510bd106455531e
Repository: electron/electron
Pull request: fix: use-after-move of bus connection in xdg portal detection

Backport of #47008

See that PR for details.


Notes: fix crash in xdg portal version detection on startup

Changed files:
filename: shell/browser/ui/file_dialog_linux_portal.cc
patch: @@ -86,8 +86,9 @@ void CheckPortalAvailabilityOnBusThread() {
                     << (g_portal_available ? "yes" : "no");
             flag->Set();
             bus->ShutdownAndBlock();
+            bus.reset();
           },
-          std::move(bus), flag));
+          bus, flag));
 }
 
 }  // namespace
Repository: facebook/react
Pull request: [compiler] Remove unused scripts

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



Changed files:
filename: compiler/package.json
patch: @@ -15,8 +15,6 @@
     "url": "git+https://github.com/facebook/react-forget.git"
   },
   "scripts": {
-    "bundle:meta": "scripts/bundle-meta.sh",
-    "bundle:oss": "scripts/bundle-oss.sh",
     "copyright": "node scripts/copyright.js",
     "hash": "scripts/hash.sh",
     "start": "yarn workspace playground run start",
Repository: denoland/deno
Pull request: fix(ext/node): support TypedArray and DataView targets in Buffer.copy()

Closes https://github.com/denoland/deno/issues/31637

- `parallel/test-buffer-copy.js` now passes
- Allow `Buffer.copy()` to accept any `ArrayBufferView` (TypedArray or DataView) as the target, matching Node.js behavior
- Previously only `Uint8Array` targets were accepted, causing `TypeError` for other typed arrays


Changed files:
filename: ext/node/polyfills/internal/buffer.mjs
patch: @@ -17,7 +17,9 @@ const {
   ArrayPrototypeSlice,
   ArrayPrototypeForEach,
   BigInt,
+  DataViewPrototypeGetBuffer,
   DataViewPrototypeGetByteLength,
+  DataViewPrototypeGetByteOffset,
   Float32Array,
   Float64Array,
   MathFloor,
@@ -1849,22 +1851,39 @@ Buffer.prototype.copy = function copy(
   sourceStart,
   sourceEnd,
 ) {
-  if (!isUint8Array(this)) {
+  if (!isArrayBufferView(this)) {
     throw new codes.ERR_INVALID_ARG_TYPE(
       "source",
       ["Buffer", "Uint8Array"],
       this,
     );
   }
 
-  if (!isUint8Array(target)) {
+  if (!isArrayBufferView(target)) {
     throw new codes.ERR_INVALID_ARG_TYPE(
       "target",
       ["Buffer", "Uint8Array"],
       target,
     );
   }
 
+  // For non-Uint8Array targets, create a Uint8Array view for byte-wise copying
+  if (!isUint8Array(target)) {
+    if (isDataView(target)) {
+      target = new Uint8Array(
+        DataViewPrototypeGetBuffer(target),
+        DataViewPrototypeGetByteOffset(target),
+        DataViewPrototypeGetByteLength(target),
+      );
+    } else {
+      target = new Uint8Array(
+        TypedArrayPrototypeGetBuffer(target),
+        TypedArrayPrototypeGetByteOffset(target),
+        TypedArrayPrototypeGetByteLength(target),
+      );
+    }
+  }
+
   if (targetStart === undefined) {
     targetStart = 0;
   } else {

filename: tests/node_compat/config.toml
patch: @@ -86,7 +86,7 @@
 "parallel/test-buffer-constructor-node-modules-paths.js" = {}
 "parallel/test-buffer-constructor-node-modules.js" = {}
 "parallel/test-buffer-constructor-outside-node-modules.js" = {}
-"parallel/test-buffer-copy.js" = { darwin = false, linux = false, windows = false, reason = "https://github.com/denoland/deno/issues/31637" }
+"parallel/test-buffer-copy.js" = {}
 "parallel/test-buffer-equals.js" = {}
 "parallel/test-buffer-failed-alloc-typed-arrays.js" = {}
 "parallel/test-buffer-fakes.js" = {}
Repository: ggml-org/llama.cpp
Pull request: ggml-cpu: repack: Fix chunks being too small with small matrix shapes in REPACK forward_mul_mat

For small shapes where the number of columns is small (i.e. 16), the current logic skipped some chunks due to rounding. 

The issue was observed with NB_COLS 8 and ne01 16, and could potentially happen with NB_COLS 4 and other combinations threads/shape.
This is also affected the corner case where chunking is disabled.

@max-krasnyansky I checked the performance here and didn't see any issue. Let me know if you'd like me to perform any particular test

### Performance

#### RPI5

| model          | test  | 2f416b265 (7162) t/s     | 3e18dba9f (7161) t/s     |
| -------------- | ----- | ------------------- | ------------------- |
| lfm2 350M Q4_0    | pp256 | 174.46 ± 0.07       | 173.41 ± 0.64       |
| lfm2 350M Q4_0    | tg128 |  51.58 ± 0.03       |  51.38 ± 0.26       |
| lfm2 700M Q4_0    | pp256 |  81.79 ± 0.01       |  82.55 ± 0.03       |
| lfm2 700M Q4_0   | tg128 |  25.78 ± 0.00       |  25.86 ± 0.00       |


#### M4 max

| model                        | test  | 2f416b265 (7162) t/s     | 3e18dba9f (7161) t/s     | 
| ---------------------- | ----- | ------------------- | ------------------- | 
| lfm2 1.2B Q4_K Medium  |   pp256 | 682.39 ± 3.23       | 682.82 ± 2.97       | 
| lfm2 1.2B Q4_K Medium  | tg128 | 233.77 ± 4.45       | 234.96 ± 0.57       |
| lfm2 700M Q4_K Medium   | pp256 | 1070.08 ± 2.77      | 1067.29 ± 7.14      |
| lfm2 700M Q4_K Medium  | tg128 | 331.12 ± 1.27       | 333.13 ± 1.32       | 
| llama 8B Q4_K Medium     | pp256 | 100.26 ± 0.11       |  96.65 ± 1.75       | 
| llama 8B Q4_K Medium    | tg128 |  43.10 ± 0.50       |  41.69 ± 0.72       | 
| qwen3 8B Q4_K Medium       | pp256 |  94.40 ± 0.33       |  90.45 ± 0.34       | 
| qwen3 8B Q4_K Medium    | tg128 |  40.92 ± 0.33       |  40.29 ± 0.27       | 



Changed files:
filename: ggml/src/ggml-cpu/repack.cpp
patch: @@ -1731,12 +1731,13 @@ template <typename BLOC_TYPE, int64_t INTER_SIZE, int64_t NB_COLS, ggml_type PAR
             nchunk0 = (nr0 + min_chunk_size - 1) / min_chunk_size;
         }
 
-        if (nth == 1 || nchunk0 < nth || disable_chunking) {
+        int64_t dr0 = (nr0 + nchunk0 - 1) / nchunk0;
+        // Only increase nchunk0 to nth if it won't make chunks too small
+        if (nth == 1 || ((nchunk0 < nth || disable_chunking) && (nr0 + nth - 1) / nth >= min_chunk_size)) {
             nchunk0 = nth;
+            dr0 = (nr0 + nchunk0 - 1) / nchunk0;
         }
 
-        const int64_t dr0 = (nr0 + nchunk0 - 1) / nchunk0;
-
         // Ensure nchunk doesn't exceed the number of rows divided by minimum chunk size
         // This prevents creating too many tiny chunks that could overlap after alignment
         const int64_t max_nchunk = (nr0 + min_chunk_size - 1) / min_chunk_size;
Repository: ollama/ollama
Pull request: fix: remove overwritten model layers

if create overrides a manifest, first add the older manifest's layers to the delete map so they can be cleaned up

resolves #2097 

Changed files:
filename: server/images.go
patch: @@ -412,6 +412,13 @@ func realpath(mfDir, from string) string {
 }
 
 func CreateModel(ctx context.Context, name, modelFileDir string, commands []parser.Command, fn func(resp api.ProgressResponse)) error {
+	deleteMap := make(map[string]struct{})
+	if manifest, _, err := GetManifest(ParseModelPath(name)); err == nil {
+		for _, layer := range append(manifest.Layers, manifest.Config) {
+			deleteMap[layer.Digest] = struct{}{}
+		}
+	}
+
 	config := ConfigV2{
 		OS:           "linux",
 		Architecture: "amd64",
@@ -420,8 +427,6 @@ func CreateModel(ctx context.Context, name, modelFileDir string, commands []pars
 		},
 	}
 
-	deleteMap := make(map[string]struct{})
-
 	var layers Layers
 
 	params := make(map[string][]string)
Repository: facebook/react
Pull request: [compiler] Remove playground postinstall script

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

The ci step for the playground already installs playwright browsers so
this step was unnecessary. It also doesn't work internally for our sync
scripts

Changed files:
filename: compiler/apps/playground/package.json
patch: @@ -8,7 +8,6 @@
     "vercel-build": "yarn workspaces run build",
     "start": "next start",
     "lint": "next lint",
-    "postinstall": "yarn playwright install",
     "test": "playwright test"
   },
   "dependencies": {
Repository: vercel/next.js
Pull request: fix: isRevalidate -> isStaticGeneration in fetch cache / unstable cache

When fetch/`unstable_cache` are stale during ISR, we leverage `workStore.isRevalidate` to determine if we're in an ISR revalidation scope and if so, we perform a blocking revalidation.

This same scenario could happen at build time if the data cache were being leveraged during build (ie with a custom cache handler, or once we enable it in the default Next cache handler). 

There's no need to distinguish between an ISR revalidation and build time prerender when checking to see if the cache entry needs to perform a blocking revalidate, so this refactors to switch to `isStaticGeneration` instead. This matches what we do in `use cache`: https://github.com/vercel/next.js/blob/1fc18244547263409a82db35edbe5908ba403410/packages/next/src/server/use-cache/use-cache-wrapper.ts#L1418

Changed files:
filename: packages/next/src/server/lib/patch-fetch.ts
patch: @@ -935,7 +935,7 @@ export function createPatchedFetcher(
             if (entry?.value && entry.value.kind === CachedRouteKind.FETCH) {
               // when stale and is revalidating we wait for fresh data
               // so the revalidated entry has the updated data
-              if (workStore.isRevalidate && entry.isStale) {
+              if (workStore.isStaticGeneration && entry.isStale) {
                 isForegroundRevalidate = true
               } else {
                 if (entry.isStale) {

filename: packages/next/src/server/web/spec-extension/unstable-cache.ts
patch: @@ -273,7 +273,7 @@ export function unstable_cache<T extends Callback>(
 
                   // Attach the empty catch here so we don't get a "unhandled promise
                   // rejection" warning. (Behavior is matched with patch-fetch)
-                  if (workStore.isRevalidate) {
+                  if (workStore.isStaticGeneration) {
                     revalidationPromise.catch(() => {})
                   }
 
@@ -282,7 +282,7 @@ export function unstable_cache<T extends Callback>(
                 }
 
                 // Check if we need to do foreground revalidation
-                if (workStore.isRevalidate) {
+                if (workStore.isStaticGeneration) {
                   // When the page is revalidating and the cache entry is stale,
                   // we need to wait for fresh data (blocking revalidate)
                   return workStore.pendingRevalidates[invocationKey]
Repository: huggingface/transformers
Pull request: Clarify passing is_causal in sdpa_attention_paged_forward

# What does this PR do?

`is_causal` is not forwarded in `sdpa_attention_paged_forward`. If that is intentional, a comment should be added.

Changed files:
filename: src/transformers/integrations/sdpa_paged.py
patch: @@ -23,7 +23,6 @@ def sdpa_attention_paged_forward(
     attention_mask: Optional[torch.Tensor],
     dropout: float = 0.0,
     scaling: Optional[float] = None,
-    is_causal: Optional[bool] = None,
     **kwargs,
 ) -> tuple[torch.Tensor, None]:
     # Add KV cache to the key and value tensors
@@ -58,6 +57,7 @@ def sdpa_attention_paged_forward(
         attn_mask=causal_mask,
         dropout_p=dropout,
         scale=scaling,
+        # Packed sequence format is used for input, so that it can never be causal.
         is_causal=False,
     )
     attn_output = attn_output.transpose(1, 2).contiguous()
Repository: huggingface/transformers
Pull request: Remove dict branch of attention_mask in sdpa_attention_paged_forward

# What does this PR do?
attention_mask should be an optional tensor.

Changed files:
filename: src/transformers/integrations/sdpa_paged.py
patch: @@ -39,12 +39,7 @@ def sdpa_attention_paged_forward(
         value = repeat_kv(value, module.num_key_value_groups)
 
     # Get the right causal mask for the current layer
-    if isinstance(attention_mask, dict):
-        sliding_window = getattr(module, "sliding_window", 1)
-        layer_type = "full_attention" if sliding_window == 1 or sliding_window is None else "sliding_attention"
-        causal_mask = attention_mask[layer_type]
-    else:
-        causal_mask = attention_mask
+    causal_mask = attention_mask
 
     # Run the actual attention
     query = query.contiguous()
Repository: ollama/ollama
Pull request: readline: drop not use min function

Since [Go1.21 (go.mod)](https://go.dev/doc/go1.21), Go adds min builtin function.

Changed files:
filename: readline/buffer.go
patch: @@ -133,13 +133,6 @@ func (b *Buffer) Size() int {
 	return b.Buf.Size()
 }
 
-func min(n, m int) int {
-	if n > m {
-		return m
-	}
-	return n
-}
-
 func (b *Buffer) Add(r rune) {
 	if b.Pos == b.Buf.Size() {
 		fmt.Printf("%c", r)
Repository: ggml-org/llama.cpp
Pull request: gguf_convert_endian.py: skip MXFP4 data

MXFP4 data only uses 1-byte data, there's nothing to byteswap.

Also use gguf.constants.GGML_QUANT_SIZES to determine block sizes. Don't duplicate block size constants.

Changed files:
filename: gguf-py/gguf/scripts/gguf_convert_endian.py
patch: @@ -19,6 +19,11 @@
 logger = logging.getLogger("gguf-convert-endian")
 
 
+def byteswap_noop(tensor, block_offs):
+    # this function is used when byteswapping is not needed
+    pass
+
+
 def byteswap_q4_0(tensor, block_offs):
     # Each block_q4_0 consists of an f16 delta (scaling factor) followed by 16 int8 quantizations.
 
@@ -55,22 +60,11 @@ def byteswap_q6_k(tensor, block_offs):
 
 
 byteswap_tensors = {
-    gguf.GGMLQuantizationType.Q4_0: {
-        "block_size": 18, # 18 bytes = <f16 delta scaling factor> + 16 * <int8 quant>
-        "byteswap_func": byteswap_q4_0,
-    },
-    gguf.GGMLQuantizationType.Q8_0: {
-        "block_size": 34, # 34 bytes = <f16 delta scaling factor> + 32 * <int8 quant>
-        "byteswap_func": byteswap_q8_0,
-    },
-    gguf.GGMLQuantizationType.Q4_K: {
-        "block_size": 144, # 144 bytes = 2 * <f16 delta scaling factor> + 140 * <int8 quant>
-        "byteswap_func": byteswap_q4_k,
-    },
-    gguf.GGMLQuantizationType.Q6_K: {
-        "block_size": 210, # 210 bytes = <f16 delta scaling factor> + 208 * <int8 quant>
-        "byteswap_func": byteswap_q6_k,
-    },
+    gguf.GGMLQuantizationType.Q4_0:  byteswap_q4_0,
+    gguf.GGMLQuantizationType.Q8_0:  byteswap_q8_0,
+    gguf.GGMLQuantizationType.Q4_K:  byteswap_q4_k,
+    gguf.GGMLQuantizationType.Q6_K:  byteswap_q6_k,
+    gguf.GGMLQuantizationType.MXFP4: byteswap_noop,
 }
 
 
@@ -135,8 +129,8 @@ def convert_byteorder(reader: gguf.GGUFReader, args: argparse.Namespace) -> None
 
             tensor.data.resize(newshape)
 
-            block_size    = byteswap_tensors[tensor.tensor_type]["block_size"]
-            byteswap_func = byteswap_tensors[tensor.tensor_type]["byteswap_func"]
+            block_size    = gguf.constants.GGML_QUANT_SIZES[tensor.tensor_type][1]
+            byteswap_func = byteswap_tensors[tensor.tensor_type]
 
             n_blocks = len(tensor.data) // block_size
             for block_num in (inner_pbar := tqdm(range(n_blocks), desc="Byte-swapping Blocks", leave=False)):