helloadhavan/github_issues huggingface dataset:
Repository: ollama/ollama
Pull request: Create a sentiments example

A simple example for sentiments analysis and a writer of lists of 10 tweets

Changed files:
filename: examples/10tweets/Modelfile
patch: @@ -0,0 +1,7 @@
+# Modelfile for creating a list of ten tweets from a topic
+# Run `ollama create 10tweets -f ./Modelfile` and then `ollama run 10tweets` and enter a topic
+
+FROM llama2
+SYSTEM """
+You are a content marketer who needs to come up with 10 short but succinct tweets. The answer should be a list of ten tweets. Each tweet can have a maximum of 280 characters and should include hashtags. Each user input will be a subject and you should expand it in ten creative ways. Never stop after just one tweet. Always include ten. 
+"""

filename: examples/sentiments/Modelfile
patch: @@ -0,0 +1,28 @@
+# Modelfile for creating a sentiment analyzer. 
+# Run `ollama create sentiments -f pathtofile` and then `ollama run sentiments` and enter a topic
+
+FROM orca
+TEMPLATE """
+{{- if .First }}
+### System:
+{{ .System }}
+{{- end }}
+### User: 
+I hate it when my phone dies
+### Response: 
+NEGATIVE
+### User: 
+He is awesome
+### Response: 
+POSITIVE
+### User: 
+This is the link to the article
+### Response: 
+NEUTRAL
+### User:
+{{ .Prompt }}
+
+### Response:
+"""
+
+SYSTEM """You are a sentiment analyzer. You will receive text and output only one word, either POSITIVE or NEGATIVE or NEUTRAL, depending on the sentiment of the text."""

filename: examples/sentiments/Readme.md
patch: @@ -0,0 +1,25 @@
+# Sentiments Modelfile
+
+This is a simple sentiments analyzer using the Orca model. When you pull Orca from the registry, it has a Template already defined that looks like this:
+
+```Modelfile
+{{- if .First }}
+### System:
+{{ .System }}
+{{- end }}
+
+### User:
+{{ .Prompt }}
+
+### Response:
+```
+
+If we just wanted to have the text:
+
+```Plaintext
+You are a sentiment analyzer. You will receive text and output only one word, either POSITIVE or NEGATIVE or NEUTRAL, depending on the sentiment of the text.
+```
+
+then we could have put this in a SYSTEM block. But we want to provide examples which require updating the full Template. Any Modelfile you create will inherit all the settings from the source model. But in this example, we are overriding the Template.
+
+When providing examples for the input and output, you should include the way the model usually provides information. Since the Orca model expects a user prompt to appear after ### User: and the response is after ### Response, we should format our examples like that as well. If we were using the Llama 2 model, the format would be a bit different.
Repository: huggingface/transformers
Pull request: fix: Catch correct ConnectionError for additional_chat_templates

# What does this PR do?

Catch the correct `ConnectionError` when checking for `additional_chat_templates`.

Fixes #39873 


## 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?
- [x] 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?


Changed files:
filename: src/transformers/utils/hub.py
patch: @@ -176,7 +176,7 @@ def list_repo_templates(
             ]
         except (GatedRepoError, RepositoryNotFoundError, RevisionNotFoundError):
             raise  # valid errors => do not catch
-        except (ConnectionError, HTTPError):
+        except (HTTPError, requests.exceptions.ConnectionError):
             pass  # offline mode, internet down, etc. => try local files
 
     # check local files
Repository: ollama/ollama
Pull request: fix spelling errors in example prompts


Changed files:
filename: examples/dockerit/Modelfile
patch: @@ -1,6 +1,6 @@
 FROM llama2
 SYSTEM """
-You are an experience Devops engineer focused on docker. When given specifications for a particular need or application you know the best way to host that within a docker container. For instance if someone tells you they want an nginx server to host files located at /web you will answer as follows
+You are an experienced Devops engineer focused on docker. When given specifications for a particular need or application you know the best way to host that within a docker container. For instance if someone tells you they want an nginx server to host files located at /web you will answer as follows
 
 ---start
 FROM nginx:alpine
@@ -16,5 +16,5 @@ ENV POSTGRES_PASSWORD=abc123
 EXPOSE 5432
 ---end
 
-Again it's just the contents of the dockerfile an nothing else.
-"""
\ No newline at end of file
+Again it's just the contents of the dockerfile and nothing else.
+"""
Repository: huggingface/transformers
Pull request: [serve] guard imports

# What does this PR do?

Some imports were not properly guarded, so `transformers env` was failing on a base install. This PR fixes it.

Fixes #39779 
Supercedes #39790 

Changed files:
filename: src/transformers/commands/serving.py
patch: @@ -32,7 +32,6 @@
 
 from huggingface_hub import model_info
 from huggingface_hub.constants import HF_HUB_OFFLINE
-from PIL import Image
 
 import transformers
 from transformers.models.auto.modeling_auto import (
@@ -45,6 +44,7 @@
     is_openai_available,
     is_pydantic_available,
     is_uvicorn_available,
+    is_vision_available,
 )
 
 from .. import (
@@ -54,7 +54,6 @@
     ProcessorMixin,
     TextIteratorStreamer,
 )
-from ..generation.continuous_batching import ContinuousBatchingManager, RequestStatus
 from ..utils import is_torch_available, logging
 from . import BaseTransformersCLICommand
 
@@ -69,9 +68,14 @@
         PreTrainedModel,
     )
 
+    from ..generation.continuous_batching import ContinuousBatchingManager, RequestStatus
+
 if is_librosa_available():
     import librosa
 
+if is_vision_available():
+    from PIL import Image
+
 serve_dependencies_available = (
     is_pydantic_available() and is_fastapi_available() and is_uvicorn_available() and is_openai_available()
 )
@@ -811,7 +815,7 @@ def stream_chat_completion(_inputs):
         return stream_chat_completion(inputs[0])
 
     @staticmethod
-    def get_model_modality(model: PreTrainedModel) -> Modality:
+    def get_model_modality(model: "PreTrainedModel") -> Modality:
         model_classname = model.__class__.__name__
         if model_classname in MODEL_FOR_IMAGE_TEXT_TO_TEXT_MAPPING_NAMES.values():
             modality = Modality.VLM
@@ -1545,7 +1549,9 @@ def _load_model_and_data_processor(self, model_id_and_revision: str):
         logger.info(f"Loaded model {model_id_and_revision}")
         return model, data_processor
 
-    def load_model_and_processor(self, model_id_and_revision: str) -> tuple[PreTrainedModel, PreTrainedTokenizerFast]:
+    def load_model_and_processor(
+        self, model_id_and_revision: str
+    ) -> tuple["PreTrainedModel", PreTrainedTokenizerFast]:
         """
         Loads the text model and processor from the given model ID and revision into the ServeCommand instance.
 
@@ -1570,7 +1576,7 @@ def load_model_and_processor(self, model_id_and_revision: str) -> tuple[PreTrain
 
         return model, processor
 
-    def load_audio_model_and_processor(self, model_id_and_revision: str) -> tuple[PreTrainedModel, ProcessorMixin]:
+    def load_audio_model_and_processor(self, model_id_and_revision: str) -> tuple["PreTrainedModel", ProcessorMixin]:
         """
         Loads the audio model and processor from the given model ID and revision into the ServeCommand instance.
Repository: nodejs/node
Pull request: build: fix defaults for shared llhttp

Since https://github.com/nodejs/node/pull/24870, we only support llhttp as HTTP parser, let's use this as default libname – and `libllhttp` as pkgname.
<!--
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: configure.py
patch: @@ -277,7 +277,7 @@
 shared_optgroup.add_argument('--shared-http-parser-libname',
     action='store',
     dest='shared_http_parser_libname',
-    default='http_parser',
+    default='llhttp',
     help='alternative lib name to link to [default: %(default)s]')
 
 shared_optgroup.add_argument('--shared-http-parser-libpath',
@@ -2265,7 +2265,7 @@ def make_bin_override():
 configure_node_cctest_sources(output)
 configure_napi(output)
 configure_library('zlib', output)
-configure_library('http_parser', output)
+configure_library('http_parser', output, pkgname='libllhttp')
 configure_library('libuv', output)
 configure_library('ada', output)
 configure_library('simdjson', output)
Repository: denoland/deno
Pull request: fix(unstable): parsing regex in selector with character class

Fixes parsing a regex lint selector with a character class like `[foo=/[a-z]/]`.

The parser just looked for the next `]` character and aborted there. It didn't account for the regex grammar having this character too.

Fixes https://github.com/denoland/deno/issues/30460

Changed files:
filename: cli/js/40_lint_selector.js
patch: @@ -159,6 +159,26 @@ export class Lexer {
     this.value = this.getSlice();
   }
 
+  readBinAttrValue() {
+    const s = this.i;
+    let depth = 0;
+    while (this.token !== Token.EOF) {
+      if (this.token === Token.BracketClose) {
+        if (depth-- <= 0) {
+          break;
+        }
+      } else if (this.token === Token.BracketOpen) {
+        depth++;
+      }
+
+      this.next();
+    }
+
+    this.start = s;
+    this.end = this.i - 1;
+    this.value = this.getSlice();
+  }
+
   getSlice() {
     return this.input.slice(this.start, this.end);
   }
@@ -258,6 +278,11 @@ export class Lexer {
           this.token = Token.Minus;
           this.step();
           return;
+        case Char.BackSlash: {
+          this.step();
+          this.step();
+          continue;
+        }
 
         case Char.Plus:
         case Char.Tilde:
@@ -518,7 +543,7 @@ export function parseSelector(input, toElem, toAttr) {
 
       if (lex.token === Token.Op) {
         const op = getAttrOp(lex.value);
-        lex.readAsWordUntil(Token.BracketClose);
+        lex.readBinAttrValue();
 
         const value = getFromRawValue(lex.value);
         current.push({ type: ATTR_BIN_NODE, prop, op, value });

filename: tests/unit/lint_selectors_test.ts
patch: @@ -464,6 +464,27 @@ Deno.test("Parser - Attr", () => {
   ]]);
 });
 
+// See https://github.com/denoland/deno/issues/30460
+Deno.test("Parser - Attr regex", () => {
+  assertEquals(testParse("[bar=/^[a-z]$/]"), [[
+    {
+      type: ATTR_BIN_NODE,
+      op: BinOp.Equal,
+      prop: [2],
+      value: /^[a-z]$/,
+    },
+  ]]);
+
+  assertEquals(testParse("[bar=/^[a-z\\]]foo$/]"), [[
+    {
+      type: ATTR_BIN_NODE,
+      op: BinOp.Equal,
+      prop: [2],
+      value: /^[a-z\]]foo$/,
+    },
+  ]]);
+});
+
 Deno.test("Parser - Attr nested", () => {
   assertEquals(testParse("[foo.bar]"), [[
     {
Repository: vercel/next.js
Pull request: Fix: the unexpected clearing of symbolic link directories

When I was using the standalone build, the second build would delete the contents of local packages. As a result, developers had to delete the cache of local empty directories and re-download the packages. I added a condition for recursive deletion to avoid this situation.

Fixes #82157 

Changed files:
filename: .changeset/lemon-islands-care.md
patch: @@ -0,0 +1,5 @@
+---
+'next': patch
+---
+
+Fix the unexpected clearing of symbolic link directories

filename: packages/next/src/lib/recursive-delete.ts
patch: @@ -79,7 +79,7 @@ export async function recursiveDelete(
       const isNotExcluded = !exclude || !exclude.test(pp)
 
       if (isNotExcluded) {
-        if (isDirectory) {
+        if (!isSymlink && isDirectory) {
           await recursiveDelete(absolutePath, exclude, pp)
         }
         return unlinkPath(absolutePath, !isSymlink && isDirectory)
Repository: ollama/ollama
Pull request: allow F16 to use metal

warning F16 uses significantly more memory than quantized model so the standard requires don't apply.

Changed files:
filename: llm/llm.go
patch: @@ -36,31 +36,39 @@ func New(model string, adapters []string, opts api.Options) (LLM, error) {
 	}
 
 	switch ggml.FileType().String() {
-	case "F32", "F16", "Q5_0", "Q5_1", "Q8_0":
+	case "F32", "Q5_0", "Q5_1", "Q8_0":
 		if opts.NumGPU != 0 {
 			// F32, F16, Q5_0, Q5_1, and Q8_0 do not support Metal API and will
 			// cause the runner to segmentation fault so disable GPU
-			log.Printf("WARNING: GPU disabled for F32, F16, Q5_0, Q5_1, and Q8_0")
+			log.Printf("WARNING: GPU disabled for F32, Q5_0, Q5_1, and Q8_0")
 			opts.NumGPU = 0
 		}
 	}
 
 	totalResidentMemory := memory.TotalMemory()
 	switch ggml.ModelType() {
 	case ModelType3B, ModelType7B:
-		if totalResidentMemory < 8*1024*1024 {
+		if ggml.FileType().String() == "F16" && totalResidentMemory < 16*1024*1024 {
+			return nil, fmt.Errorf("F16 model requires at least 16GB of memory")
+		} else if totalResidentMemory < 8*1024*1024 {
 			return nil, fmt.Errorf("model requires at least 8GB of memory")
 		}
 	case ModelType13B:
-		if totalResidentMemory < 16*1024*1024 {
+		if ggml.FileType().String() == "F16" && totalResidentMemory < 32*1024*1024 {
+			return nil, fmt.Errorf("F16 model requires at least 32GB of memory")
+		} else if totalResidentMemory < 16*1024*1024 {
 			return nil, fmt.Errorf("model requires at least 16GB of memory")
 		}
 	case ModelType30B, ModelType34B:
-		if totalResidentMemory < 32*1024*1024 {
+		if ggml.FileType().String() == "F16" && totalResidentMemory < 64*1024*1024 {
+			return nil, fmt.Errorf("F16 model requires at least 64GB of memory")
+		} else if totalResidentMemory < 32*1024*1024 {
 			return nil, fmt.Errorf("model requires at least 32GB of memory")
 		}
 	case ModelType65B:
-		if totalResidentMemory < 64*1024*1024 {
+		if ggml.FileType().String() == "F16" && totalResidentMemory < 128*1024*1024 {
+			return nil, fmt.Errorf("F16 model requires at least 128GB of memory")
+		} else if totalResidentMemory < 64*1024*1024 {
 			return nil, fmt.Errorf("model requires at least 64GB of memory")
 		}
 	}
Repository: nodejs/node
Pull request: src: env_vars caching and local variable scope optimization

I've changed env_vars to variable for caching and tried to improve local variable coverage

Changed files:
filename: src/node_dotenv.cc
patch: @@ -65,18 +65,19 @@ std::vector<Dotenv::env_file_data> Dotenv::GetDataFromArgs(
 }
 
 Maybe<void> Dotenv::SetEnvironment(node::Environment* env) {
-  Local<Value> name;
-  Local<Value> val;
   auto context = env->context();
+  auto env_vars = env->env_vars();
 
   for (const auto& entry : store_) {
-    auto existing = env->env_vars()->Get(entry.first.data());
+    auto existing = env_vars->Get(entry.first.data());
     if (!existing.has_value()) {
+      Local<Value> name;
+      Local<Value> val;
       if (!ToV8Value(context, entry.first).ToLocal(&name) ||
           !ToV8Value(context, entry.second).ToLocal(&val)) {
         return Nothing<void>();
       }
-      env->env_vars()->Set(env->isolate(), name.As<String>(), val.As<String>());
+      env_vars->Set(env->isolate(), name.As<String>(), val.As<String>());
     }
   }
Repository: denoland/deno
Pull request: fix(fmt): do not remove parens for jsdoc with `@satisfies`

Closes https://github.com/denoland/deno/issues/30443

Changed files:
filename: .dprint.json
patch: @@ -78,11 +78,11 @@
     "tests/specs/run/error_syntax_empty_trailing_line/error_syntax_empty_trailing_line.mjs"
   ],
   "plugins": [
-    "https://plugins.dprint.dev/typescript-0.94.0.wasm",
+    "https://plugins.dprint.dev/typescript-0.95.9.wasm",
     "https://plugins.dprint.dev/json-0.20.0.wasm",
-    "https://plugins.dprint.dev/markdown-0.18.0.wasm",
+    "https://plugins.dprint.dev/markdown-0.19.0.wasm",
     "https://plugins.dprint.dev/toml-0.7.0.wasm",
     "https://plugins.dprint.dev/exec-0.5.1.json@492414e39dea4dccc07b4af796d2f4efdb89e84bae2bd4e1e924c0cc050855bf",
-    "https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm"
+    "https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.1.wasm"
   ]
 }

filename: Cargo.lock
patch: @@ -3470,9 +3470,9 @@ dependencies = [
 
 [[package]]
 name = "dprint-plugin-markdown"
-version = "0.18.0"
+version = "0.19.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "845fdbe59bf4088f7def60adc1b3383884d432d78d86ea8b30860d4e65f2bc43"
+checksum = "bf64cbcb37dba109c63d30a42f1f4cca7a01ea40006ae1b2aa285906d226d24e"
 dependencies = [
  "anyhow",
  "dprint-core",
@@ -3485,9 +3485,9 @@ dependencies = [
 
 [[package]]
 name = "dprint-plugin-typescript"
-version = "0.95.9"
+version = "0.95.10"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ee438b36aa41448c12864fb9a41d2a7a2121ec2e9074f8049c4f62d102dbd65a"
+checksum = "83cbb60779bfcb1f133387838bfa06dc5362576270d67857de225e453b587ae2"
 dependencies = [
  "anyhow",
  "capacity_builder",

filename: Cargo.toml
patch: @@ -306,8 +306,8 @@ dissimilar = "=1.0.9"
 dprint-core = "=0.67.4"
 dprint-plugin-json = "=0.20.0"
 dprint-plugin-jupyter = "=0.2.0"
-dprint-plugin-markdown = "=0.18.0"
-dprint-plugin-typescript = "=0.95.9"
+dprint-plugin-markdown = "=0.19.0"
+dprint-plugin-typescript = "=0.95.10"
 env_logger = "=0.11.6"
 fancy-regex = "=0.14.0"
 libsui = "0.10.0"
Repository: electron/electron
Pull request: fix: rounded corners disappear momentarily on window close

Backport of #46382

See that PR for details.


Notes: Fix the issue where rounded corners disappear momentarily when closing on Windows 11


Changed files:
filename: shell/browser/native_window_views.cc
patch: @@ -381,8 +381,7 @@ NativeWindowViews::NativeWindowViews(const gin_helper::Dictionary& options,
 
     bool rounded_corner = true;
     options.Get(options::kRoundedCorners, &rounded_corner);
-    if (!rounded_corner)
-      SetRoundedCorners(false);
+    SetRoundedCorners(rounded_corner);
   }
 
   LONG ex_style = ::GetWindowLong(GetAcceleratedWidget(), GWL_EXSTYLE);
Repository: facebook/react
Pull request: Ensure dispatch from `useFormState` works in `StrictMode`

## Summary

Closes https://github.com/facebook/react/issues/28556

We didn't follow the Rules of Hooks in the rerender implementation for mounts.

## Test plan

- Added test based on "useFormState updates state asynchronously and queues multiple actions" but with StrictMode and less dispatches (because it repros on the first attempt)

Changed files:
filename: packages/react-dom/src/__tests__/ReactDOMForm-test.js
patch: @@ -1295,4 +1295,52 @@ describe('ReactDOMForm', () => {
     assertLog(['B']);
     expect(container.textContent).toBe('B');
   });
+
+  // @gate enableFormActions
+  // @gate enableAsyncActions
+  test('useFormState works in StrictMode', async () => {
+    let actionCounter = 0;
+    async function action(state, type) {
+      actionCounter++;
+
+      Scheduler.log(`Async action started [${actionCounter}]`);
+      await getText(`Wait [${actionCounter}]`);
+
+      switch (type) {
+        case 'increment':
+          return state + 1;
+        case 'decrement':
+          return state - 1;
+        default:
+          return state;
+      }
+    }
+
+    let dispatch;
+    function App() {
+      const [state, _dispatch, isPending] = useFormState(action, 0);
+      dispatch = _dispatch;
+      const pending = isPending ? 'Pending ' : '';
+      return <Text text={pending + state} />;
+    }
+
+    const root = ReactDOMClient.createRoot(container);
+    await act(() =>
+      root.render(
+        <React.StrictMode>
+          <App />
+        </React.StrictMode>,
+      ),
+    );
+    assertLog(['0']);
+    expect(container.textContent).toBe('0');
+
+    await act(() => dispatch('increment'));
+    assertLog(['Async action started [1]', 'Pending 0']);
+    expect(container.textContent).toBe('Pending 0');
+
+    await act(() => resolveText('Wait [1]'));
+    assertLog(['1']);
+    expect(container.textContent).toBe('1');
+  });
 });

filename: packages/react-reconciler/src/ReactFiberHooks.js
patch: @@ -2259,6 +2259,8 @@ function rerenderFormState<S, P>(
     );
   }
 
+  updateWorkInProgressHook(); // State
+
   // This is a mount. No updates to process.
   const state: Awaited<S> = stateHook.memoizedState;
Repository: huggingface/transformers
Pull request: Fix type annotation error in DepthPro model image processor

# What does this PR do?
Fix type annotation error in DepthPro model image processor

Fixes #40235 
@amyeroberts, @qubvel @stevhliu


Changed files:
filename: src/transformers/models/depth_pro/image_processing_depth_pro.py
patch: @@ -318,7 +318,7 @@ def post_process_depth_estimation(
         self,
         outputs: "DepthProDepthEstimatorOutput",
         target_sizes: Optional[Union[TensorType, list[tuple[int, int]], None]] = None,
-    ) -> dict[str, list[TensorType]]:
+    ) -> list[dict[str, TensorType]]:
         """
         Post-processes the raw depth predictions from the model to generate
         final depth predictions which is caliberated using the field of view if provided

filename: src/transformers/models/depth_pro/image_processing_depth_pro_fast.py
patch: @@ -106,7 +106,7 @@ def post_process_depth_estimation(
         self,
         outputs: "DepthProDepthEstimatorOutput",
         target_sizes: Optional[Union[TensorType, list[tuple[int, int]], None]] = None,
-    ) -> dict[str, list[TensorType]]:
+    ) -> list[dict[str, TensorType]]:
         """
         Post-processes the raw depth predictions from the model to generate
         final depth predictions which is caliberated using the field of view if provided