helloadhavan/github_issues huggingface dataset:
Repository: denoland/deno
Pull request: fix(http): duplicate listener should inherit onError and signal

these are relevant to both listeners

Changed files:
filename: ext/http/00_serve.ts
patch: @@ -779,7 +779,9 @@ function serve(arg1, arg2) {
     3: duplicateListener,
   } = op_http_serve_address_override();
   if (overrideKind) {
-    let envOptions = duplicateListener ? { __proto__: null } : options;
+    let envOptions = duplicateListener
+      ? { __proto__: null, signal: options.signal, onError: options.onError }
+      : options;
 
     switch (overrideKind) {
       case 1: {
Repository: facebook/react
Pull request: jsx: Remove unnecessary hasOwnProperty check

Follow up to #28768.

The modern JSX runtime (`jsx`) does not need to check if each prop is a direct property with `hasOwnProperty` because the compiler always passes a plain object.

I'll leave the check in the old JSX runtime (`createElement`) since that one can be called manually with any kind of object, and if there were old user code that relied on this for some reason, it would be using that runtime.

Changed files:
filename: packages/react/src/jsx/ReactJSXElement.js
patch: @@ -364,12 +364,8 @@ export function jsxProd(type, config, maybeKey) {
     // because in V8 it will deopt the object to dictionary mode.
     props = {};
     for (const propName in config) {
-      if (
-        hasOwnProperty.call(config, propName) &&
-        // Skip over reserved prop names
-        propName !== 'key' &&
-        (enableRefAsProp || propName !== 'ref')
-      ) {
+      // Skip over reserved prop names
+      if (propName !== 'key' && (enableRefAsProp || propName !== 'ref')) {
         if (enableRefAsProp && !disableStringRefs && propName === 'ref') {
           props.ref = coerceStringRef(
             config[propName],
@@ -603,12 +599,8 @@ export function jsxDEV(type, config, maybeKey, isStaticChildren, source, self) {
       // because in V8 it will deopt the object to dictionary mode.
       props = {};
       for (const propName in config) {
-        if (
-          hasOwnProperty.call(config, propName) &&
-          // Skip over reserved prop names
-          propName !== 'key' &&
-          (enableRefAsProp || propName !== 'ref')
-        ) {
+        // Skip over reserved prop names
+        if (propName !== 'key' && (enableRefAsProp || propName !== 'ref')) {
           if (enableRefAsProp && !disableStringRefs && propName === 'ref') {
             props.ref = coerceStringRef(
               config[propName],
Repository: ggml-org/llama.cpp
Pull request: llama-bench : clarify benchmarked parts of the computation

Clarify that tokenization and sampling are not included in the measurements.

Changed files:
filename: tools/llama-bench/README.md
patch: @@ -82,6 +82,9 @@ Using the `-d <n>` option, each test can be run at a specified context depth, pr
 
 For a description of the other options, see the [main example](../main/README.md).
 
+> [!NOTE]
+> The measurements with `llama-bench` do not include the times for tokenization and for sampling.
+
 ## Examples
 
 ### Text generation with different models
@@ -131,7 +134,7 @@ $ ./llama-bench -n 0 -n 16 -p 64 -t 1,2,4,8,16,32
 | llama 7B mostly Q4_0           |   3.56 GiB |     6.74 B | CPU        |         16 | pp 64      |     33.52 ± 0.03 |
 | llama 7B mostly Q4_0           |   3.56 GiB |     6.74 B | CPU        |         16 | tg 16      |     15.32 ± 0.05 |
 | llama 7B mostly Q4_0           |   3.56 GiB |     6.74 B | CPU        |         32 | pp 64      |     59.00 ± 1.11 |
-| llama 7B mostly Q4_0           |   3.56 GiB |     6.74 B | CPU        |         32 | tg 16      |     16.41 ± 0.79 ||
+| llama 7B mostly Q4_0           |   3.56 GiB |     6.74 B | CPU        |         32 | tg 16      |     16.41 ± 0.79 |
 
 ### Different numbers of layers offloaded to the GPU
Repository: ollama/ollama
Pull request: add feedback for reading model metadata

When creating a model from a large base layer (ex: 70B) reading model metadata is slow since the weights file is large.

Without feedback here the creation is in the "looking for model" stage for a long time, which makes it look like something has gone wrong.

New behavior:
```
parsing modelfile
looking for model
⠋ reading model metadata
```

Changed files:
filename: server/images.go
patch: @@ -372,6 +372,7 @@ func CreateModel(ctx context.Context, workDir, name string, path string, fn func
 			}
 
 			if mf != nil {
+				fn(api.ProgressResponse{Status: "reading model metadata"})
 				sourceBlobPath, err := GetBlobsPath(mf.Config.Digest)
 				if err != nil {
 					return err
Repository: electron/electron
Pull request: fix: destroy parent port backend when JS env exits

Backport of #46437

See that PR for details.


Notes: Fix a potential crash in `parentPort`.


Changed files:
filename: shell/services/node/node_service.cc
patch: @@ -96,6 +96,7 @@ NodeService::NodeService(
 NodeService::~NodeService() {
   if (!node_env_stopped_) {
     node_env_->set_trace_sync_io(false);
+    ParentPort::GetInstance()->Close();
     js_env_->DestroyMicrotasksRunner();
     node::Stop(node_env_.get(), node::StopFlags::kDoNotTerminateIsolate);
   }
@@ -147,6 +148,7 @@ void NodeService::Initialize(
       node_env_.get(), [this](node::Environment* env, int exit_code) {
         // Destroy node platform.
         env->set_trace_sync_io(false);
+        ParentPort::GetInstance()->Close();
         js_env_->DestroyMicrotasksRunner();
         node::Stop(env, node::StopFlags::kDoNotTerminateIsolate);
         node_env_stopped_ = true;

filename: shell/services/node/parent_port.cc
patch: @@ -23,8 +23,8 @@ namespace electron {
 gin::WrapperInfo ParentPort::kWrapperInfo = {gin::kEmbedderNativeGin};
 
 ParentPort* ParentPort::GetInstance() {
-  static base::NoDestructor<ParentPort> instance;
-  return instance.get();
+  static ParentPort* instance = new ParentPort();
+  return instance;
 }
 
 ParentPort::ParentPort() = default;

filename: shell/services/node/parent_port.h
patch: @@ -10,6 +10,7 @@
 #include "gin/wrappable.h"
 #include "mojo/public/cpp/bindings/connector.h"
 #include "mojo/public/cpp/bindings/message.h"
+#include "shell/common/gin_helper/cleaned_up_at_exit.h"
 #include "third_party/blink/public/common/messaging/message_port_descriptor.h"
 
 namespace v8 {
@@ -31,6 +32,7 @@ namespace electron {
 // for the lifetime of a Utility Process which
 // also means that GC lifecycle is ignored by this class.
 class ParentPort final : public gin::Wrappable<ParentPort>,
+                         public gin_helper::CleanedUpAtExit,
                          private mojo::MessageReceiver {
  public:
   static ParentPort* GetInstance();
@@ -49,9 +51,10 @@ class ParentPort final : public gin::Wrappable<ParentPort>,
       v8::Isolate* isolate) override;
   const char* GetTypeName() override;
 
+  void Close();
+
  private:
   void PostMessage(v8::Local<v8::Value> message_value);
-  void Close();
   void Start();
   void Pause();
Repository: ollama/ollama
Pull request: `Modelfile` syntax highlighting

Pertains to https://github.com/jmorganca/ollama/issues/649:
- Highlighted `Modelfile` in `modelfile.md`
- Made it clear the name can be lowercase

Changed files:
filename: docs/modelfile.md
patch: @@ -1,6 +1,6 @@
 # Ollama Model File
 
-> Note: this model file syntax is in development
+> Note: this `Modelfile` syntax is in development
 
 A model file is the blueprint to create and share models with Ollama.
 
@@ -24,7 +24,7 @@ A model file is the blueprint to create and share models with Ollama.
 
 ## Format
 
-The format of the Modelfile:
+The format of the `Modelfile`:
 
 ```modelfile
 # comment
@@ -42,7 +42,7 @@ INSTRUCTION arguments
 
 ## Examples
 
-An example of a model file creating a mario blueprint:
+An example of a `Modelfile` creating a mario blueprint:
 
 ```modelfile
 FROM llama2
@@ -57,9 +57,9 @@ SYSTEM You are Mario from super mario bros, acting as an assistant.
 
 To use this:
 
-1. Save it as a file (eg. `Modelfile`)
-2. `ollama create NAME -f <location of the file eg. ./Modelfile>'`
-3. `ollama run NAME`
+1. Save it as a file (e.g. `Modelfile`)
+2. `ollama create choose-a-model-name -f <location of the file e.g. ./Modelfile>'`
+3. `ollama run choose-a-model-name`
 4. Start using the model!
 
 More examples are available in the [examples directory](../examples).
@@ -68,7 +68,7 @@ More examples are available in the [examples directory](../examples).
 
 ### FROM (Required)
 
-The FROM instruction defines the base model to use when creating a model.
+The `FROM` instruction defines the base model to use when creating a model.
 
 ```modelfile
 FROM <model name>:<tag>
@@ -83,17 +83,17 @@ FROM llama2
 A list of available base models:
 <https://github.com/jmorganca/ollama#model-library>
 
-#### Build from a bin file
+#### Build from a `bin` file
 
 ```modelfile
 FROM ./ollama-model.bin
 ```
 
-This bin file location should be specified as an absolute path or relative to the Modelfile location.
+This bin file location should be specified as an absolute path or relative to the `Modelfile` location.
 
 ### EMBED
 
-The EMBED instruction is used to add embeddings of files to a model. This is useful for adding custom data that the model can reference when generating an answer. Note that currently only text files are supported, formatted with each line as one embedding.
+The `EMBED` instruction is used to add embeddings of files to a model. This is useful for adding custom data that the model can reference when generating an answer. Note that currently only text files are supported, formatted with each line as one embedding.
 
 ```modelfile
 FROM <model name>:<tag>
@@ -186,5 +186,5 @@ LICENSE """
 
 ## Notes
 
-- the **modelfile is not case sensitive**. In the examples, we use uppercase for instructions to make it easier to distinguish it from arguments.
+- the **`Modelfile` is not case sensitive**. In the examples, we use uppercase for instructions to make it easier to distinguish it from arguments.
 - Instructions can be in any order. In the examples, we start with FROM instruction to keep it easily readable.
Repository: nodejs/node
Pull request: doc: punctuation fix for Node-API versioning clarification

<!--
Before submitting a pull request, please read:

- the CONTRIBUTING guide at https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md
- the commit message formatting guidelines at
  https://github.com/nodejs/node/blob/HEAD/doc/contributing/pull-requests.md#commit-message-guidelines

For code changes:
1. Include tests for any bug fixes or new features.
2. Update documentation if relevant.
3. Ensure that `make -j4 test` (UNIX), or `vcbuild test` (Windows) passes.

If you believe this PR should be highlighted in the Node.js CHANGELOG
please add the `notable-change` label.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.
-->


Changed files:
filename: doc/api/n-api.md
patch: @@ -261,7 +261,7 @@ For example v18.15.0 supports only Node-API version 8. ABI stability was
 achieved because 8 was a strict superset of all previous versions.
 
 As of version 9, while Node-API versions continue to be versioned
-independently an add-on that ran with Node-API version 9 may need
+independently, an add-on that ran with Node-API version 9 may need
 code updates to run with Node-API version 10. ABI stability
 is maintained, however, because Node.js versions that support
 Node-API versions higher than 8 will support all versions
Repository: ollama/ollama
Pull request: Fix go test./... issue: fmt.Println arg list ends with redundant newline

`go test ./...` currently fails with:

```
# github.com/jmorganca/ollama/cmd
cmd/cmd.go:690:7: fmt.Println arg list ends with redundant newline
cmd/cmd.go:698:7: fmt.Println arg list ends with redundant newline
cmd/cmd.go:704:7: fmt.Println arg list ends with redundant newline
cmd/cmd.go:710:7: fmt.Println arg list ends with redundant newline
?       github.com/jmorganca/ollama     [no test files]
?       github.com/jmorganca/ollama/api [no test files]
?       github.com/jmorganca/ollama/llm [no test files]
?       github.com/jmorganca/ollama/llm/llama.cpp       [no test files]
?       github.com/jmorganca/ollama/parser      [no test files]
?       github.com/jmorganca/ollama/progressbar [no test files]
ok      github.com/jmorganca/ollama/format      0.003s
?       github.com/jmorganca/ollama/vector      [no test files]
?       github.com/jmorganca/ollama/version     [no test files]
ok      github.com/jmorganca/ollama/server      0.005s
FAIL
```

This commit changes fmt.Println to just fmt.Print so that `go test ./...` passes:

```
?       github.com/jmorganca/ollama     [no test files]
?       github.com/jmorganca/ollama/api [no test files]
?       github.com/jmorganca/ollama/cmd [no test files]
?       github.com/jmorganca/ollama/llm [no test files]
?       github.com/jmorganca/ollama/llm/llama.cpp       [no test files]
?       github.com/jmorganca/ollama/parser      [no test files]
?       github.com/jmorganca/ollama/progressbar [no test files]
ok      github.com/jmorganca/ollama/format      (cached)
?       github.com/jmorganca/ollama/vector      [no test files]
?       github.com/jmorganca/ollama/version     [no test files]
ok      github.com/jmorganca/ollama/server      (cached)
```

I'm on Arch Linux using Go 1.21.1 linux/amd64.

Changed files:
filename: cmd/cmd.go
patch: @@ -687,27 +687,27 @@ func generateInteractive(cmd *cobra.Command, model string) error {
 				switch args[1] {
 				case "license":
 					if resp.License == "" {
-						fmt.Println("No license was specified for this model.\n")
+						fmt.Print("No license was specified for this model.\n\n")
 					} else {
 						fmt.Println(resp.License)
 					}
 				case "modelfile":
 					fmt.Println(resp.Modelfile)
 				case "parameters":
 					if resp.Parameters == "" {
-						fmt.Println("No parameters were specified for this model.\n")
+						fmt.Print("No parameters were specified for this model.\n\n")
 					} else {
 						fmt.Println(resp.Parameters)
 					}
 				case "system":
 					if resp.System == "" {
-						fmt.Println("No system prompt was specified for this model.\n")
+						fmt.Print("No system prompt was specified for this model.\n\n")
 					} else {
 						fmt.Println(resp.System)
 					}
 				case "template":
 					if resp.Template == "" {
-						fmt.Println("No prompt template was specified for this model.\n")
+						fmt.Print("No prompt template was specified for this model.\n\n")
 					} else {
 						fmt.Println(resp.Template)
 					}
Repository: denoland/deno
Pull request: fix(ext/node): validate `fs.close` callback function

Towards #29972

Allows the [parallel/test-fs-close-errors.js](https://github.com/nodejs/node/blob/v24.2.0/test/parallel/test-fs-close-errors.js) test to pass, and also addresses the `prefer-primordials` lint rule #24236

Changed files:
filename: ext/node/polyfills/_fs/_fs_close.ts
patch: @@ -1,22 +1,31 @@
 // Copyright 2018-2025 the Deno authors. MIT license.
 
-// TODO(petamoriken): enable prefer-primordials for node polyfills
-// deno-lint-ignore-file prefer-primordials
-
-import type { CallbackWithError } from "ext:deno_node/_fs/_fs_common.ts";
+import {
+  type CallbackWithError,
+  makeCallback,
+} from "ext:deno_node/_fs/_fs_common.ts";
 import { getValidatedFd } from "ext:deno_node/internal/fs/utils.mjs";
-import { core } from "ext:core/mod.js";
+import { core, primordials } from "ext:core/mod.js";
+
+const {
+  Error,
+  ErrorPrototype,
+  ObjectPrototypeIsPrototypeOf,
+} = primordials;
 
 export function close(fd: number, callback: CallbackWithError) {
   fd = getValidatedFd(fd);
+  callback = makeCallback(callback);
   setTimeout(() => {
     let error = null;
     try {
       // TODO(@littledivy): Treat `fd` as real file descriptor. `rid` is an
       // implementation detail and may change.
       core.close(fd);
     } catch (err) {
-      error = err instanceof Error ? err : new Error("[non-error thrown]");
+      error = ObjectPrototypeIsPrototypeOf(ErrorPrototype, err)
+        ? err as Error
+        : new Error("[non-error thrown]");
     }
     callback(error);
   }, 0);
Repository: ggml-org/llama.cpp
Pull request: cann: improve device ID handling and aclnnArange checks

- Stop relying on CANN's internal device ID retrieval; use a global variable instead.
- Enforce stricter dimension validation in aclnnArange for better compatibility across CANN versions.

*Make sure to read the [contributing guidelines](https://github.com/ggml-org/llama.cpp/blob/master/CONTRIBUTING.md) before submitting a PR*


Changed files:
filename: ggml/src/ggml-cann/aclnn_ops.cpp
patch: @@ -2234,7 +2234,7 @@ static void aclnn_cache_init(ggml_backend_cann_context & ctx,
                               ACL_MEM_MALLOC_HUGE_FIRST));
 
         acl_theta_scale_tensor = ggml_cann_create_tensor(ctx.rope_cache.theta_scale_cache, ACL_FLOAT, sizeof(float),
-                                                         theta_scale_ne, theta_scale_nb, GGML_MAX_DIMS);
+                                                         theta_scale_ne, theta_scale_nb, 1);
 
         float start      = 0;
         float step       = 1;
@@ -2251,7 +2251,7 @@ static void aclnn_cache_init(ggml_backend_cann_context & ctx,
             yarn_ramp_allocator.alloc(theta_scale_length * sizeof(float));
             void * yarn_ramp_buffer = yarn_ramp_allocator.get();
             acl_yarn_ramp_tensor   = ggml_cann_create_tensor(yarn_ramp_buffer, ACL_FLOAT, sizeof(float), theta_scale_ne,
-                                                             theta_scale_nb, GGML_MAX_DIMS);
+                                                             theta_scale_nb, 1);
             float       zero_value = 0, one_value = 1;
             float       denom_safe_value = MAX(0.001f, corr_dims[1] - corr_dims[0]);
             aclScalar * low              = aclCreateScalar(&corr_dims[0], aclDataType::ACL_FLOAT);

filename: ggml/src/ggml-cann/ggml-cann.cpp
patch: @@ -67,19 +67,30 @@
     GGML_ABORT("CANN error");
 }
 
+// Thread-local variable to record the current device of this thread.
+thread_local int g_current_cann_device = -1;
+
 /**
- * @brief Sets the device to be used by CANN.
+ * @brief Set the CANN device to be used.
  *
- * @param device The device ID to set.
+ * @param device The target device ID to set.
  */
 void ggml_cann_set_device(const int32_t device) {
-    int current_device = -1;
-    aclrtGetDevice(&current_device);
+    // int current_device = -1;
+    // Note: In some CANN versions, if no device has been set yet,
+    //       aclrtGetDevice(&current_device) may return 0 by default.
+    // aclrtGetDevice(&current_device);
 
-    if (device == current_device) {
+    // If the current device is already the target one, no need to switch.
+    if (device == g_current_cann_device) {
         return;
     }
+
+    // Switch to the new device.
     ACL_CHECK(aclrtSetDevice(device));
+
+    // Update the global device record.
+    g_current_cann_device = device;
 }
 
 /**
Repository: ollama/ollama
Pull request: output type parsed from modelfile

This is an attempt to prevent #648 and make it easier to diagnose problems in this area in the future. I couldnt reproduce the exact problem but this could be the issue.

Changed files:
filename: api/types.go
patch: @@ -227,43 +227,43 @@ func (opts *Options) FromMap(m map[string]interface{}) error {
 						// when JSON unmarshals numbers, it uses float64, not int
 						field.SetInt(int64(t))
 					default:
-						log.Printf("could not convert model parameter %v to int, skipped", key)
+						log.Printf("could not convert model parameter %v of type %T to int, skipped", key, val)
 					}
 				case reflect.Bool:
 					val, ok := val.(bool)
 					if !ok {
-						log.Printf("could not convert model parameter %v to bool, skipped", key)
+						log.Printf("could not convert model parameter %v of type %T to bool, skipped", key, val)
 						continue
 					}
 					field.SetBool(val)
 				case reflect.Float32:
 					// JSON unmarshals to float64
 					val, ok := val.(float64)
 					if !ok {
-						log.Printf("could not convert model parameter %v to float32, skipped", key)
+						log.Printf("could not convert model parameter %v of type %T to float32, skipped", key, val)
 						continue
 					}
 					field.SetFloat(val)
 				case reflect.String:
 					val, ok := val.(string)
 					if !ok {
-						log.Printf("could not convert model parameter %v to string, skipped", key)
+						log.Printf("could not convert model parameter %v of type %T to string, skipped", key, val)
 						continue
 					}
 					field.SetString(val)
 				case reflect.Slice:
 					// JSON unmarshals to []interface{}, not []string
 					val, ok := val.([]interface{})
 					if !ok {
-						log.Printf("could not convert model parameter %v to slice, skipped", key)
+						log.Printf("could not convert model parameter %v of type %T to slice, skipped", key, val)
 						continue
 					}
 					// convert []interface{} to []string
 					slice := make([]string, len(val))
 					for i, item := range val {
 						str, ok := item.(string)
 						if !ok {
-							log.Printf("could not convert model parameter %v to slice of strings, skipped", key)
+							log.Printf("could not convert model parameter %v of type %T to slice of strings, skipped", key, item)
 							continue
 						}
 						slice[i] = str

filename: server/images.go
patch: @@ -831,7 +831,7 @@ func formatParams(params map[string][]string) (map[string]interface{}, error) {
 						return nil, fmt.Errorf("invalid int value %s", vals)
 					}
 
-					out[key] = int(intVal)
+					out[key] = intVal
 				case reflect.Bool:
 					boolVal, err := strconv.ParseBool(vals[0])
 					if err != nil {
Repository: huggingface/transformers
Pull request: [`FA`] Fix dtype in varlen with position ids

Fixes #40293

`cu_seqlens` preparation changed in #40060 and led to int64 casts. 

cc @ArthurZucker @Cyrilvallez @sfc-gh-sbekman


Changed files:
filename: src/transformers/modeling_flash_attention_utils.py
patch: @@ -336,9 +336,8 @@ def prepare_fa_kwargs_from_position_ids(position_ids, is_packed_sequence: bool =
     # If the lengths are not equal, most probably we are in decoding stage with cache
     # In that case the position ids will not always start with `0` and we need a better way to infer
     # cumulative seq lengths.
+    tensor_kwargs = {"dtype": torch.int32, "device": position_ids.device}
     if not is_packed_sequence:
-        tensor_kwargs = {"dtype": torch.int32, "device": position_ids.device}
-
         last_position_ids = position_ids[:, -1]
         q_len = (
             torch.ones(position_ids.size(0), **tensor_kwargs)
@@ -358,8 +357,8 @@ def prepare_fa_kwargs_from_position_ids(position_ids, is_packed_sequence: bool =
 
         cu_seq_lens_q = torch.cat(
             (
-                indices_q,
-                torch.tensor(position_ids.size(), device=position_ids.device, dtype=torch.int32),
+                indices_q.to(**tensor_kwargs),
+                torch.tensor(position_ids.size(), **tensor_kwargs),
             )
         )
         cu_seq_lens_k = cu_seq_lens_q