helloadhavan/github_issues huggingface dataset:
Repository: ollama/ollama
Pull request: Include Show Info in Interactive Mode

Before:
<img width="226" alt="Screenshot 2024-06-27 at 2 13 32 PM" src="https://github.com/ollama/ollama/assets/65097070/b8153a26-9474-42f4-aa98-c8fc576b27e6">

After:
<img width="495" alt="Screenshot 2024-06-27 at 2 13 12 PM" src="https://github.com/ollama/ollama/assets/65097070/168699de-9d57-4a6d-9275-db3ad1e93c54">

Resolves #5281 

Changed files:
filename: cmd/cmd.go
patch: @@ -624,13 +624,13 @@ func ShowHandler(cmd *cobra.Command, args []string) error {
 		return errors.New("only one of '--license', '--modelfile', '--parameters', '--system', or '--template' can be specified")
 	}
 
-	if flagsSet == 1 {
-		req := api.ShowRequest{Name: args[0]}
-		resp, err := client.Show(cmd.Context(), &req)
-		if err != nil {
-			return err
-		}
+	req := api.ShowRequest{Name: args[0]}
+	resp, err := client.Show(cmd.Context(), &req)
+	if err != nil {
+		return err
+	}
 
+	if flagsSet == 1 {
 		switch showType {
 		case "license":
 			fmt.Println(resp.License)
@@ -647,12 +647,12 @@ func ShowHandler(cmd *cobra.Command, args []string) error {
 		return nil
 	}
 
-	req := api.ShowRequest{Name: args[0]}
-	resp, err := client.Show(cmd.Context(), &req)
-	if err != nil {
-		return err
-	}
+	showInfo(resp)
 
+	return nil
+}
+
+func showInfo(resp *api.ShowResponse) {
 	arch := resp.ModelInfo["general.architecture"].(string)
 
 	modelData := [][]string{
@@ -711,8 +711,6 @@ func ShowHandler(cmd *cobra.Command, args []string) error {
 	}
 
 	table.Render()
-
-	return nil
 }
 
 func renderSubTable(data [][]string, file bool) string {

filename: cmd/interactive.go
patch: @@ -404,15 +404,7 @@ func generateInteractive(cmd *cobra.Command, opts runOptions) error {
 
 				switch args[1] {
 				case "info":
-					fmt.Println("Model details:")
-					if len(resp.Details.Families) > 0 {
-						fmt.Printf("Family              %s\n", strings.Join(resp.Details.Families, ", "))
-					} else if resp.Details.Family != "" {
-						fmt.Printf("Family              %s\n", resp.Details.Family)
-					}
-					fmt.Printf("Parameter Size      %s\n", resp.Details.ParameterSize)
-					fmt.Printf("Quantization Level  %s\n", resp.Details.QuantizationLevel)
-					fmt.Println("")
+					showInfo(resp)
 				case "license":
 					if resp.License == "" {
 						fmt.Println("No license was specified for this model.")
Repository: nodejs/node
Pull request: tools: use cooldown property correctly

Attempt to fix https://github.com/nodejs/node/pull/59978#issuecomment-3356154065

On my local fork it doesn't seem to fail, so I assume the patch is correct.

Changed files:
filename: .github/dependabot.yml
patch: @@ -6,10 +6,10 @@ updates:
     directory: /
     schedule:
       interval: monthly
-      cooldown:
-        - semver-major-days: 5
-        - semver-minor-days: 5
-        - semver-patch-days: 5
+    cooldown:
+      semver-major-days: 5
+      semver-minor-days: 5
+      semver-patch-days: 5
 
     commit-message:
       prefix: meta
@@ -19,10 +19,10 @@ updates:
     directory: /tools/eslint
     schedule:
       interval: monthly
-      cooldown:
-        - semver-major-days: 5
-        - semver-minor-days: 5
-        - semver-patch-days: 5
+    cooldown:
+      semver-major-days: 5
+      semver-minor-days: 5
+      semver-patch-days: 5
     commit-message:
       prefix: tools
     open-pull-requests-limit: ${{secrets.OPEN_PR_LIMIT}}
@@ -36,10 +36,10 @@ updates:
     directory: /tools/lint-md
     schedule:
       interval: monthly
-      cooldown:
-        - semver-major-days: 5
-        - semver-minor-days: 5
-        - semver-patch-days: 5
+    cooldown:
+      semver-major-days: 5
+      semver-minor-days: 5
+      semver-patch-days: 5
     commit-message:
       prefix: tools
     open-pull-requests-limit: ${{secrets.OPEN_PR_LIMIT}}
@@ -53,10 +53,10 @@ updates:
     directory: /tools/doc
     schedule:
       interval: weekly
-      cooldown:
-        - semver-major-days: 5
-        - semver-minor-days: 5
-        - semver-patch-days: 5
+    cooldown:
+      semver-major-days: 5
+      semver-minor-days: 5
+      semver-patch-days: 5
     commit-message:
       prefix: tools
     open-pull-requests-limit: ${{secrets.OPEN_PR_LIMIT}}
Repository: ollama/ollama
Pull request: Ollama Show: Check for Projector Type

Fixes #5289 

<img width="410" alt="Screenshot 2024-06-26 at 11 21 57 AM" src="https://github.com/ollama/ollama/assets/65097070/4ae18164-e5c2-453b-91d4-de54569b8e11">


Changed files:
filename: cmd/cmd.go
patch: @@ -672,11 +672,17 @@ func ShowHandler(cmd *cobra.Command, args []string) error {
 		projectorData := [][]string{
 			{"arch", "clip"},
 			{"parameters", format.HumanNumber(uint64(resp.ProjectorInfo["general.parameter_count"].(float64)))},
-			{"projector type", resp.ProjectorInfo["clip.projector_type"].(string)},
-			{"embedding length", fmt.Sprintf("%v", resp.ProjectorInfo["clip.vision.embedding_length"].(float64))},
-			{"projection dimensionality", fmt.Sprintf("%v", resp.ProjectorInfo["clip.vision.projection_dim"].(float64))},
 		}
 
+		if projectorType, ok := resp.ProjectorInfo["clip.projector_type"]; ok {
+			projectorData = append(projectorData, []string{"projector type", projectorType.(string)})
+		}
+
+		projectorData = append(projectorData,
+			[]string{"embedding length", fmt.Sprintf("%v", resp.ProjectorInfo["clip.vision.embedding_length"].(float64))},
+			[]string{"projection dimensionality", fmt.Sprintf("%v", resp.ProjectorInfo["clip.vision.projection_dim"].(float64))},
+		)
+
 		mainTableData = append(mainTableData,
 			[]string{"Projector"},
 			[]string{renderSubTable(projectorData, false)},
Repository: vuejs/vue
Pull request: Add support for decimal places in currency filter

I know @yyx990803 has little intention to extend these core functionality, but IMHO you either support something fully or you don't at all. So…

Currently the "currency" filter only accepts one argument: the currency symbol. The number of decimal places is fixed as 2. This can cause troubles with several currencies out there whose number of decimal places can be 0 (e.g. Japanese Yen or Vietnamese Dong) or 3 (e.g. Jordanian Dinar).

This commit modifies the filter to accept an extra optional argument: decimal places, which defaults to 2. With this, one can write `{{ 1234 | currency '¥' 0 }}` to properly display a Yen value. Backward compatibility is maintained.

(Just realized there's a [StackOverflow question](http://stackoverflow.com/questions/35725935/need-a-flexible-currency-filter-in-vuejs) about this very issue, where the OP was recommended to create a new filter, which is anti-DRY IMO).


Changed files:
filename: src/filters/index.js
patch: @@ -64,19 +64,25 @@ export default {
    * 12345 => $12,345.00
    *
    * @param {String} sign
+   * @param {Number} decimals Decimal places
    */
 
-  currency (value, currency) {
+  currency (value, currency, decimals) {
     value = parseFloat(value)
     if (!isFinite(value) || (!value && value !== 0)) return ''
     currency = currency != null ? currency : '$'
-    var stringified = Math.abs(value).toFixed(2)
-    var _int = stringified.slice(0, -3)
+    decimals = decimals != null ? decimals : 2
+    var stringified = Math.abs(value).toFixed(decimals)
+    var _int = decimals
+      ? stringified.slice(0, -1 - decimals)
+      : stringified
     var i = _int.length % 3
     var head = i > 0
       ? (_int.slice(0, i) + (_int.length > 3 ? ',' : ''))
       : ''
-    var _float = stringified.slice(-3)
+    var _float = decimals
+      ? stringified.slice(-1 - decimals)
+      : ''
     var sign = value < 0 ? '-' : ''
     return sign + currency + head +
       _int.slice(i).replace(digitsRE, '$1,') +

filename: test/unit/specs/filters/filters_spec.js
patch: @@ -67,6 +67,12 @@ describe('Filters', function () {
     expect(filter(2134, '@')).toBe('@2,134.00')
     // no symbol
     expect(filter(2134, '')).toBe('2,134.00')
+    // decimal places
+    expect(filter(1234, '$', 0)).toBe('$1,234')
+    // if decimal places are present, currency is required
+    expect(filter(1234, '', 2)).toBe('1,234.00')
+    expect(filter(123.4, '$', 3)).toBe('$123.400')
+    expect(filter(-12345, 'VND', 0)).toBe('-VND12,345')
     // falsy, infinity and 0
     expect(filter(0)).toBe('$0.00')
     expect(filter(false)).toBe('')
Repository: facebook/react
Pull request: [devtools] allow non-coercible objects in formatConsoleArgumentsToSingleString

## Summary

We have been getting unhandled `TypeError: Cannot convert object to primitive value` errors in development that only occur when using devtools. I tracked it down to `console.error()` calls coming from Apollo Client where one of the arguments is an object without a prototype (created with `Object.create(null)`). This causes `formatConsoleArgumentsToSingleString()` in React's devtools to error as the function does not defend against `String()` throwing an error.

My attempted fix is to introduce a `safeToString` function (naming suggestions appreciated) which expects `String()` to throw on certain object and in that case falls back to returning `[object Object]`, which is what `String({})` would return. 

## How did you test this change?

Added a new unit test.


Changed files:
filename: packages/react-devtools-shared/src/__tests__/utils-test.js
patch: @@ -155,6 +155,12 @@ describe('utils', () => {
         'Symbol(abc) 123',
       );
     });
+
+    it('should gracefully handle objects with no prototype', () => {
+      expect(
+        formatConsoleArgumentsToSingleString('%o', Object.create(null)),
+      ).toEqual('%o [object Object]');
+    });
   });
 
   describe('formatWithStyles', () => {

filename: packages/react-devtools-shared/src/backend/utils/index.js
patch: @@ -167,6 +167,19 @@ export function serializeToString(data: any): string {
   );
 }
 
+function safeToString(val: any): string {
+  try {
+    return String(val);
+  } catch (err) {
+    if (typeof val === 'object') {
+      // An object with no prototype and no `[Symbol.toPrimitive]()`, `toString()`, and `valueOf()` methods would throw.
+      // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#string_coercion
+      return '[object Object]';
+    }
+    throw err;
+  }
+}
+
 // based on https://github.com/tmpfs/format-util/blob/0e62d430efb0a1c51448709abd3e2406c14d8401/format.js#L1
 // based on https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions
 // Implements s, d, i and f placeholders
@@ -176,7 +189,7 @@ export function formatConsoleArgumentsToSingleString(
 ): string {
   const args = inputArgs.slice();
 
-  let formatted: string = String(maybeMessage);
+  let formatted: string = safeToString(maybeMessage);
 
   // If the first argument is a string, check for substitutions.
   if (typeof maybeMessage === 'string') {
@@ -211,7 +224,7 @@ export function formatConsoleArgumentsToSingleString(
   // Arguments that remain after formatting.
   if (args.length) {
     for (let i = 0; i < args.length; i++) {
-      formatted += ' ' + String(args[i]);
+      formatted += ' ' + safeToString(args[i]);
     }
   }
Repository: ollama/ollama
Pull request: OpenAI Compatibility: Correct Finish Reason Documentation 

`finish_reason` is not bound to only being `stop`

```
curl http://localhost:11434/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "llama3",
        "messages": [
            {
                "role": "system",
                "content": "You are a helpful assistant."
            },
            {
                "role": "user",
                "content": "Hello!"
            }
        ],
       "max_tokens": 1
    }' | jq

{
  "id": "chatcmpl-20",
  "object": "chat.completion",
  "created": 1719437652,
  "model": "llama3",
  "system_fingerprint": "fp_ollama",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello"
      },
      "finish_reason": "length"
    }
  ],
  "usage": {
    "prompt_tokens": 23,
    "completion_tokens": 1,
    "total_tokens": 24
  }
}
```

Changed files:
filename: docs/openai.md
patch: @@ -104,7 +104,6 @@ curl http://localhost:11434/v1/chat/completions \
 
 #### Notes
 
-- `finish_reason` will always be `stop`
 - `usage.prompt_tokens` will be 0 for completions where prompt evaluation is cached
 
 ## Models
Repository: huggingface/transformers
Pull request: Correctly handle unbatched audio inputs in Gemma3nAudioFeatureExtractor

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


Changed files:
filename: src/transformers/models/gemma3n/feature_extraction_gemma3n.py
patch: @@ -305,13 +305,10 @@ def __call__(
         is_batched_sequence = isinstance(raw_speech, Sequence) and isinstance(raw_speech[0], (np.ndarray, Sequence))
         is_batched = is_batched_numpy or is_batched_sequence
 
-        if is_batched:
-            raw_speech = [np.asarray([rs]).T for rs in raw_speech]
-        elif not is_batched and not isinstance(raw_speech, np.ndarray):
-            raw_speech = np.asarray(raw_speech)
-
-        if not is_batched:  # always return a batch
-            raw_speech = [np.asarray([raw_speech])]
+        # Always return a batch
+        if not is_batched:
+            raw_speech = [raw_speech]
+        raw_speech = [np.asarray([rs]).T for rs in raw_speech]
 
         batched_speech = self.pad(
             BatchFeature({"input_features": raw_speech}),

filename: tests/models/gemma3n/test_feature_extraction_gemma3n.py
patch: @@ -228,6 +228,13 @@ def test_call(self, audio_inputs, test_truncation=False):
             for enc_seq_1, enc_seq_2 in zip(encoded_sequences_1, encoded_sequences_2):
                 self.assertTrue(np.allclose(enc_seq_1, enc_seq_2, atol=1e-3))
 
+    def test_call_unbatched(self):
+        feature_extractor = self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict())
+        np_audio = floats_list((1, 800))[0]
+        input_features = feature_extractor(np_audio, return_tensors="np").input_features
+        expected_input_features = feature_extractor([np_audio], return_tensors="np").input_features
+        np.testing.assert_allclose(input_features, expected_input_features)
+
     def test_audio_features_attn_mask_consistent(self):
         # regression test for https://github.com/huggingface/transformers/issues/39911
         # Test input_features and input_features_mask have consistent shape
Repository: nodejs/node
Pull request: meta: move Michael to emeritus

I won't have enough time to contribute to Node.js to stay as a TSC member for a while so moving myself to emeritus.

<!--
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: README.md
patch: @@ -168,8 +168,6 @@ For information about the governance of the Node.js project, see
   **Marco Ippolito** <<marcoippolito54@gmail.com>> (he/him)
 * [mcollina](https://github.com/mcollina) -
   **Matteo Collina** <<matteo.collina@gmail.com>> (he/him)
-* [mhdawson](https://github.com/mhdawson) -
-  **Michael Dawson** <<midawson@redhat.com>> (he/him)
 * [panva](https://github.com/panva) -
   **Filip Skokan** <<panva.ip@gmail.com>> (he/him)
 * [RafaelGSS](https://github.com/RafaelGSS) -
@@ -240,6 +238,8 @@ For information about the governance of the Node.js project, see
   **Isaac Z. Schlueter** <<i@izs.me>>
 * [joshgav](https://github.com/joshgav) -
   **Josh Gavant** <<josh.gavant@outlook.com>>
+* [mhdawson](https://github.com/mhdawson) -
+  **Michael Dawson** <<midawson@redhat.com>> (he/him)
 * [mmarchini](https://github.com/mmarchini) -
   **Mary Marchini** <<oss@mmarchini.me>> (she/her)
 * [mscdex](https://github.com/mscdex) -
Repository: ollama/ollama
Pull request: gemma2 graph


Changed files:
filename: llm/ggml.go
patch: @@ -366,9 +366,18 @@ func (llm GGML) GraphSize(context, batch uint64) (partialOffload, fullOffload ui
 				4*batch*(1+2*embedding+context*(1+heads))+embedding*(6*context*headsKV/heads+embedding*9/16),
 			)
 		}
-	case "gemma":
-		fullOffload = 4 * batch * (embedding + vocab)
-		partialOffload = 4*batch*(2*embedding+vocab+1) + embedding*vocab*105/128
+	case "gemma", "gemma2":
+		fullOffload = max(
+			4*batch*(embedding+vocab),
+			4*batch*(2+context+context*heads+2*embedding+2*embeddingHeadsK*heads),
+		)
+
+		partialOffload = max(
+			4*embedding*batch+embedding*vocab*105/128+4*vocab*batch,
+			4*batch*(2*embedding+1+2*embeddingHeadsK*heads+context+context*heads)+
+				4*embeddingHeadsK*context*8+
+				embedding*embeddingHeadsK*heads*9/16,
+		)
 	case "command-r":
 		fullOffload = max(
 			4*batch*(embedding+vocab),
Repository: ggml-org/llama.cpp
Pull request: llama: fix direct-io loading fallback EOF exception

The issue was that `len` can be larger than the file size due to alignment padding. This is apparently fine for the direct-io path, but in case that fails, the fallback uses `std::fread`, which just returns EOF if there are not enough bytes left in the file pointer to read another object.

To fix this, I check how many bytes are left in the file pointer and if this is smaller than `len`, use that as object size for `std::fread`. In case `to_read` is 0, `std::fread` will do nothing and return 0, so I also checked this case for the EOF exception.

@JTischbein Let me know if this looks correct to you.

I have an AMD Vulkan system affected by this loading issue, and this does fix it for me.

Related issues: #18741 and maybe #18746 #18764 #18766

Changed files:
filename: src/llama-mmap.cpp
patch: @@ -244,11 +244,14 @@ struct llama_file::impl {
         }
         errno = 0;
         if (fd == -1) {
-            std::size_t ret = std::fread(ptr, len, 1, fp);
+            const size_t curr_off = tell();
+            const size_t to_read = std::min(len, size - curr_off);
+
+            std::size_t ret = std::fread(ptr, to_read, 1, fp);
             if (ferror(fp)) {
                 throw std::runtime_error(format("read error: %s", strerror(errno)));
             }
-            if (ret != 1) {
+            if (to_read > 0 && ret != 1) {
                 throw std::runtime_error("unexpectedly reached end of file");
             }
         } else {
Repository: electron/electron
Pull request: fix: system accent color parsing hex order

Backport of #48085

See that PR for details.


Notes: Fixes an issue where the accent color would be accidentally inverted when set to match the system color.

Changed files:
filename: shell/common/color_util.cc
patch: @@ -12,6 +12,8 @@
 
 #if BUILDFLAG(IS_WIN)
 #include <dwmapi.h>
+
+#include "base/win/registry.h"
 #endif
 
 namespace {
@@ -68,12 +70,18 @@ std::string ToRGBAHex(SkColor color, bool include_hash) {
 
 #if BUILDFLAG(IS_WIN)
 std::optional<DWORD> GetSystemAccentColor() {
-  DWORD color = 0;
-  BOOL opaque = FALSE;
+  base::win::RegKey key;
+  if (key.Open(HKEY_CURRENT_USER, L"SOFTWARE\\Microsoft\\Windows\\DWM",
+               KEY_READ) != ERROR_SUCCESS) {
+    return std::nullopt;
+  }
 
-  if (FAILED(DwmGetColorizationColor(&color, &opaque)))
+  DWORD accent_color = 0;
+  if (key.ReadValueDW(L"AccentColor", &accent_color) != ERROR_SUCCESS) {
     return std::nullopt;
-  return color;
+  }
+
+  return accent_color;
 }
 #endif
Repository: vuejs/vue
Pull request: Using absolute exclude path in `build/webpack.test.config.js`

Changing the relative `exclude` path to absolute to make sure tests can be running OK even if Vue is in `node_modules` of other project.


Changed files:
filename: build/webpack.test.config.js
patch: @@ -17,7 +17,12 @@ module.exports = {
       {
         test: /\.js$/,
         loader: 'babel',
-        exclude: /test\/unit|node_modules/
+        // NOTE: use absolute path to make sure
+        // running tests is OK even if it is in node_modules of other project
+        exclude: [
+          path.resolve(__dirname, '../test/unit'),
+          path.resolve(__dirname, '../node_modules')
+        ]
       }
     ]
   },
Repository: ollama/ollama
Pull request: update readme for gemma 2


Changed files:
filename: README.md
patch: @@ -53,8 +53,8 @@ Here are some example models that can be downloaded:
 | Llama 3            | 70B        | 40GB  | `ollama run llama3:70b`        |
 | Phi 3 Mini         | 3.8B       | 2.3GB | `ollama run phi3`              |
 | Phi 3 Medium       | 14B        | 7.9GB | `ollama run phi3:medium`       |
-| Gemma              | 2B         | 1.4GB | `ollama run gemma:2b`          |
-| Gemma              | 7B         | 4.8GB | `ollama run gemma:7b`          |
+| Gemma 2            | 9B         | 5.5GB | `ollama run gemma2`            |
+| Gemma 2            | 27B        | 16GB  | `ollama run gemma2:27b`        |
 | Mistral            | 7B         | 4.1GB | `ollama run mistral`           |
 | Moondream 2        | 1.4B       | 829MB | `ollama run moondream`         |
 | Neural Chat        | 7B         | 4.1GB | `ollama run neural-chat`       |