sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: transformers
Issue: `align_to_words=True` in `QuestionAnsweringPipeline` can lead to duplicate answers
Labels: Core: Pipeline,Good Second Issue,Generation

### System Info

- `transformers` version: 4.31.0
- Platform: macOS-13.4.1-arm64-arm-64bit
- Python version: 3.11.4
- Huggingface_hub version: 0.15.1
- Safetensors version: 0.3.1
- Accelerate version: 0.21.0
- Accelerate config:    not found
- PyTorch version (GPU?): 2.0.1 (False)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: No
- Using distributed or parallel set-up in script?: No

### Who can help?

@Nars

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [X] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [ ] My own task or dataset (give details below)

### Reproduction

```py
from transformers import pipeline

answers = pipeline("question-answering", model="deepset/tinyroberta-squad2")(
    question="Who is the chancellor of Germany?",
    context="Angela Merkel was the chancellor of Germany.",
    top_k=10
)
print(answers[0]) # Returns {'score': 0.9961308836936951, 'start': 0, 'end': 13, 'answer': 'Angela Merkel'}
print(answers[5]) # Returns {'score': 7.520078361267224e-05, 'start': 0, 'end': 13, 'answer': 'Angela Merkel'}
```

If `align_to_words` is set to `True` (which is the default), all start or end tokens that are contained in the same word are mapped to the same start and end character index (see [here](https://github.com/huggingface/transformers/blob/37c205eb5d5165b70d3100b599a2bcfc483944f5/src/transformers/pipelines/question_answering.py#L617-L620)). This is expected when using `align_to_words`. However, the top_k filtering happens before this step so duplicate answers can remain.

### Expected behavior

Ideally, the mapping from token to word should happen at around [this point](https://github.com/huggingface/transformers/blob/37c205eb5d5165b70d3100b599a2bcfc483944f5/src/transformers/pipelines/question_answering.py#L139). You would have a start and end probability for each word. If there are multiple tokens in a word, their probabilities should be summed. This would make the probabilities more correct because every token in the word would affect the probability of selecting the word.

If this is too slow, there should at least be a check for duplicates somewhere [here](https://github.com/huggingface/transformers/blob/37c205eb5d5165b70d3100b599a2bcfc483944f5/src/transformers/pipelines/question_answering.py#L604). This would mean that you are not guaranteed to get k answers when setting `top_k`, but only that you get at most k answers. A way to mitigate that somewhat (but not perfectly), would be to use a higher value than top_k when calling `select_starts_ends` [here](https://github.com/huggingface/transformers/blob/37c205eb5d5165b70d3100b599a2bcfc483944f5/src/transformers/pipelines/question_answering.py#L546-L548).
Repository: node
Issue: Global setup file for native node test runner
Labels: feature request,test_runner

### What is the problem this feature will solve?

I'm sorry if there's already such a feature and I haven't found a way how to solve this. Basically what I'm looking for is to run some function that would run beofre all the tests and setup the environment. So far the only way how to setup some environment is doing it with the [run function](https://nodejs.org/docs/latest-v20.x/api/test.html#runoptions) but that is only limited for each test suite from what I've tried. I would love to have the have some setup file in the way how does it work for example in jest or mocha or other testing framework.

### What is the feature you are proposing to solve the problem?

Have a `setup.js/setup.ts` file that will run before all the tests, you would somehow specify in command that starts the tests this setup file.

### What alternatives have you considered?

node version: `v20.6.1`
npm version: `9.8.1`

I've tried this setup file

`setup.ts`
```typescript
import { performance } from 'perf_hooks'
import { run } from 'node:test'

run({
    files: ['src/node-test-runner/suite.test.ts'],
    setup: () => {
        let memStats: Record<string | number, number> = {};
        const perf = performance;

        const start = perf.now();
        const cpuUsage = process.cpuUsage()

        process.nextTick(() => {
            const current = process.memoryUsage();
            for (const key in current) {
              memStats[key] = Math.max(memStats[key] ?? 0, current[key as keyof ReturnType<typeof process.memoryUsage>]);
            }
          });

          process.on("exit", () => {
            logger.info({
              memStats,
              timeMilliseconds: perf.now() - start,
              cpuUsage: process.cpuUsage(cpuUsage),
              pid: process.pid,
            });
          });
    },
})
```

`suite.test.ts`
```typescript
import { describe, it } from 'node:test'
import {equal} from 'node:assert'
import { testBody } from '../index'
import { logger } from '../logger'

const TEST_ITERATIONS = Number(process.env.TEST_ITERATIONS);

describe(__filename, () => {
    it(`${__filename}`, async () => {
            equal(true, true)
    })
})
```

and I'm running this command to execute tests: `node --require ts-node/register --test`

but neither the setup.ts file is executed nor the suite.test.ts file is executed
Repository: transformers
Issue: Make the skip_batches_dataloader used in the Trainer customizable
Labels: Feature request

### Feature request

In order to allow customizing the skip dataloader, I propose to add a customizable method called `get_skip_dataloader` for example, which by default will contain the current logic but can be changed by inheriting the Trainer.

### Motivation

I am using a the [mosaicML streaming](https://github.com/mosaicml/streaming) framework to train models.
In order to use their mid epoch resumption feature of this framework, you have to:
- use their StreamingDatalaoder, this is already handled by overwriting  `get_train_dataloader`
- save the dataloader state dict. This is can be handled with a callback.
- load the dataloader state dict when resuming training. This can't be done currently because the function responsible for this ( `skip_first_batches` ) of Accelerate is not customizable

I am able to overcome this problem by patching `skip_first_batches`, but on official to do it would be much more comfortable.

### Your contribution

I can provide a PR if you think this is a good idea
Repository: tauri
Issue: [bug] `initialization_script` does not execute in a remote domain, in Android
Labels: type: bug,status: needs triage,platform: Android

### Describe the bug

The `initialization_script`s do not run in an Android emulator when building a window with a remote domain, but it does run in linux.

I also observed that `__TAURI_IPC__` is not present on Android with a remote domain, but I don't know whether that's a separate issue or not. 

### Reproduction

With this repository: https://github.com/guillemcordoba/tauri-android-initialization-script-reproduction/blob/cc20eb2c0409384bb6ab12855523c02f668428cf/src-tauri/src/lib.rs#L12

Running in my desktop environment with `npm run tauri dev`, I can see the log from the initialization_script.

Running it in my Android emulator with `npm run tauri android dev`, I can't.

### Expected behavior

All platforms behave consistently. In this case I would expect the `initialization_script` to also be executed on Android.

### Platform and versions

```text
> tauri-app@0.0.0 tauri
> tauri info


[✔] Environment
    - OS: Ubuntu 22.04 X64
    ✔ webkit2gtk-4.1: 2.40.5
    ✔ rsvg2: 2.56.3
    ✔ rustc: 1.72.0 (5680fa18f 2023-08-23)
    ✔ Cargo: 1.72.0 (103a7ff2e 2023-08-15)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: 1.71-x86_64-unknown-linux-gnu (default)
    - node: 18.17.1
    - npm: 9.6.7

[-] Packages
    - tauri [RUST]: 2.0.0-alpha.14
    - tauri-build [RUST]: 2.0.0-alpha.8
    - wry [RUST]: 0.33.0
    - tao [RUST]: 0.22.2
    - @tauri-apps/api [NPM]: 2.0.0-alpha.8
    - @tauri-apps/cli [NPM]: 2.0.0-alpha.14

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - bundler: Vite
```


### Stack trace

_No response_

### Additional context

_No response_
Repository: rust
Issue: ArrayChunks::into_remainder does not return None when there is no remainder
Labels: T-libs-api,C-bug,T-libs

I tried this code:

```rust
#![feature(iter_array_chunks)]

fn main() {
    let line = "abc";
    let mut chunks = line.chars().array_chunks::<3>();
    let _result: Vec<_> = chunks.by_ref().collect();
    if let Some(rem) = chunks.into_remainder() {
        assert!(rem.count() != 0);
    }
}
```

I expected to see this happen: into_remainder returns None when there is no remainder

Instead, this happened: into_remainder returns Some of an iterator with zero elements
Repository: godot
Issue: Nodes shake like crazy when moving and more noticeable when moving diagonally
Labels: topic:rendering,needs testing,topic:2d

### Godot version

4.1

### System information

Windows 11 - Godot 4.1 [latest release] 

### Issue description

I don't know why, but the nodes position is pretty bugged as whenever I move I notice the node is actually shaking when moving especially when moving diagonally..   now I did a soft fix by doing

```gdscript
func _update_pos(pos):
	pos.x = round(position.x)
	pos.y = round(position.y)
	pos = Vector2(pos.x, pos.y)
	return pos
```

but while this appears to fix the issue, it creates another issue when you try and add collisions...    This wasn't an issue back in 3.1 or even 3.2 but just when you started porting over Godot 4 features to 3x.       This should be fixed within characterbody2d, this fix does make it "pixel perfect" but also creates a list of other problems..  

### Steps to reproduce

```gdscript
extends CharacterBody2D

var move_speed : int = 50
var move_dir : Vector2


func _physics_process(delta):
	_get_input_direction()
	velocity = move_dir * move_speed
	move_and_slide()

func _get_input_direction():
	var move_x = -int(Input.is_action_pressed("ui_left")) + int(Input.is_action_pressed("ui_right"))
	var move_y = -int(Input.is_action_pressed("ui_up")) + int(Input.is_action_pressed("ui_down"))

	move_dir = Vector2(move_x, move_y).normalized()
	return move_dir
```

### Minimal reproduction project

N/A
Repository: godot
Issue: E 0:00:01:0253   MainLoop.gd:57 @ _on_save_button_pressed(): Condition "!is_ancestor_of(p_node)" is true. Returning: false   <C++ Source>   scene/main/node.cpp:2302 @ is_editable_instance()   <Stack Trace>  MainLoop.gd:57 @ _on_save_button_pressed()
Labels: bug,topic:core

### Godot version

Godot_V4.1.1 Stable

### System information

Pop OS, Intel(R) Core(TM) i5-1035G1 , Intel UHD Graphics 620, Driver Version 31.0.101.211, Vulkan 1.3.246

### Issue description

On this code:
![image](https://github.com/godotengine/godot/assets/53439238/460dd2c8-1fae-417a-8a6a-0963c48be035)

I am receiving this error:
![image](https://github.com/godotengine/godot/assets/53439238/4b37af8d-0498-4cc6-825a-e556e7dd523f)

Scene tree:
![image](https://github.com/godotengine/godot/assets/53439238/4e1a9334-a3fc-457b-a4e2-c5792e7525ad)


### Steps to reproduce

Trying to pack a node and its children in a scene:
![image](https://github.com/godotengine/godot/assets/53439238/9872825b-8dff-4221-a15b-04a53fc37e46)

With this code:
![image](https://github.com/godotengine/godot/assets/53439238/38bce8cd-a50f-4ddd-a94d-dc09efde3a42)
 

### Minimal reproduction project

[ANT-ItemCreator.zip](https://github.com/godotengine/godot/files/12673331/ANT-ItemCreator.zip)
Repository: react-native
Issue: PanResponder.create() API either loses state or has stale state
Labels: API: PanResponder,Never gets stale

### Description

`PanResponder` [has a bunch of private state](https://github.com/facebook/react-native/blob/196b3f9ef905478eb57821fb5e256431200bd5ab/packages/react-native/Libraries/Interaction/PanResponder.js#L401-L560). This means it's not safe to re-create during a gesture: that state would be lost. This means that it's important to keep a ref to `PanResponder` which is what the [docs seem to suggest](https://reactnative.dev/docs/panresponder#usage-pattern).

However, holding a ref to it is bad because [all the props and state captured by handlers will be stale](https://stackoverflow.com/questions/61014169/react-natives-panresponder-has-stale-value-from-usestate). To fix this, you have to either update parts of that ref manually, or to recreate the `PanResponder` instance (which, as mentioned earlier, will reset its state — which seems bad).

I think this says that `PanResponder.create` API is not a good API for Hooks and need to be revisited. E.g. maybe it should be a Hook like `usePanResponder(config)` which takes care of updating the appropriate event handlers as needed — or maybe implemented with `useRef` inside. The important part is that the handlers should always be fresh (and capture fresh values), while the internal state of the gesture recognizer should never be destroyed.

### React Native Version

any version

### Output of `npx react-native info`

irrelevant

### Steps to reproduce

irrelevant

### Snack, screenshot, or link to a repository

irrelevant
Repository: rust
Issue: E0597 gives hit to used outdated 'a: 'b syntax
Labels: A-diagnostics,A-lifetimes,T-compiler

### Code

```Rust
fn first_three_of_each<'a, 'b>(s1: &'a str, s2: &'b str) -> (&'a str, &'b str) {
    (&s1[0..3], &s1[0..3])
}

fn main() {
    let amsterdam = format!("AMS Amsterdam");

    let (amsterdam_code, denver_code) = {
        let denver = format!("DEN Denver");
        first_three_of_each(&amsterdam, &denver)
    };

    println!("{} -> {}", amsterdam_code, denver_code);
}
```


### Current output

```Shell
error: lifetime may not live long enough
 --> src/main.rs:2:5
  |
1 | fn first_three_of_each<'a, 'b>(s1: &'a str, s2: &'b str) -> (&'a str, &'b str) {
  |                        --  -- lifetime `'b` defined here
  |                        |
  |                        lifetime `'a` defined here
2 |     (&s1[0..3], &s1[0..3])
  |     ^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
  |
  = help: consider adding the following bound: `'a: 'b`
```


### Desired output

```Shell
error: lifetime may not live long enough
 --> src/main.rs:2:5
  |
1 | fn first_three_of_each<'a, 'b>(s1: &'a str, s2: &'b str) -> (&'a str, &'b str) {
  |                        --  -- lifetime `'b` defined here
  |                        |
  |                        lifetime `'a` defined here
2 |     (&s1[0..3], &s1[0..3])
  |     ^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
```


### Rationale and extra context

Bounds of the style `'a: 'b` are not necessary anymore in Rust and in this case, the hint subtly moves the user away from the previous hint.

The correct solution is to borrow from `s2`. The hint "function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`" already suffices.

### Other cases

_No response_

### Anything else?

_No response_
Repository: storybook
Issue: [Bug]: Sample code for the storybook component displays incorrectly in the product environment
Labels: bug,needs triage

### Describe the bug

Hi storybook team,

We are testing the code with tansformSource in the development environment, but the code is not displayed properly in the prod environment.


Result - "code":

```
 transformSource: (source: any, storyContext: any) => {
    const baseCode = storyContext?.parameters.storySource.source;
    let sourceCode: string = source;
    sourceCode = sourceCode.replace('onClick={() => {}}', `onClick={() => setConfirmOpen(true)}`);
    return baseCode.replace(/return[>]*(.*)/is, `return (\n${sourceCode}\n    );`);
 },
```


### To Reproduce

_No response_

### System

```bash
"@storybook/addon-actions": "6.5.16",
"@storybook/addon-essentials": "6.5.16",
"@storybook/addon-interactions": "6.5.16",
"@storybook/addon-links": "6.5.16",
"@storybook/builder-webpack5": "6.5.16",
"@storybook/manager-webpack5": "6.5.16",
"@storybook/node-logger": "6.5.16",
"@storybook/preset-create-react-app": "4.1.2",
"@storybook/react": "6.5.16",
```


### Additional context

_No response_
Repository: flutter
Issue: [Webview] Flutter web Invalid target origin 'null' in a call to 'postMessage'.
Labels: p: webview,platform-web,package,has reproducible steps,P2,team-web,triaged-web,found in release: 3.13,found in release: 3.14

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

Trying to insert the stripe pricing table html using webview:

```dart
class Embedded extends StatelessWidget {
  const Embedded({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return WebViewWidget(
      controller: WebViewController()..loadHtmlString('''<script async src="https://js.stripe.com/v3/pricing-table.js"></script>
        <stripe-pricing-table pricing-table-id="prctbl_1NsNibDmGGo1DisCQQrsW4ta"
    publishable-key="pk_live_51NUn9HDmGGo1DisCdvpjUTEgLYqNbBqLOQr7NtR0mNMnU79apIQcz9ACjJJ8Hlj2paxIK164LZanFAmK0Vp5V7XZ00k7FC2YnT">
    </stripe-pricing-table>'''),
    );
  }
}
```

### Expected results

See the stripe pricing table.

### Actual results

Get an error: `DOMException: Failed to execute 'postMessage' on 'Window': Invalid target origin 'null' in a call to 'postMessage'.`

### Code sample

<details><summary>Code sample</summary>

```dart
class Embedded extends StatelessWidget {
  const Embedded({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return WebViewWidget(
      controller: WebViewController()..loadHtmlString('''<script async src="https://js.stripe.com/v3/pricing-table.js"></script>
        <stripe-pricing-table pricing-table-id="prctbl_1NsNibDmGGo1DisCQQrsW4ta"
    publishable-key="pk_live_51NUn9HDmGGo1DisCdvpjUTEgLYqNbBqLOQr7NtR0mNMnU79apIQcz9ACjJJ8Hlj2paxIK164LZanFAmK0Vp5V7XZ00k7FC2YnT">
    </stripe-pricing-table>'''),
    );
  }
}
```

</details>


### Screenshots or Video

_No response_

### Logs

_No response_

### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.3, on macOS 13.2 22D49 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.2)
[✓] IntelliJ IDEA Community Edition (version 2021.2.4)
[✓] VS Code (version 1.82.1)
[✓] Connected device (2 available)
[✓] Network resources

• No issues found!
```

</details>
Repository: go
Issue: proposal: x/crypto/acme/autocert: add mechanism for providing a private key for a new certificate
Labels: Proposal,Proposal-Crypto

Autocert currently generates a private key when there is no valid certificate in the cache and a certificate is requested.

I would like the ability to provide the private key for a certificate when it is requested for the first time.

Current prototype:  https://github.com/mjl-/autocert/commit/2f3f1cee58be111786546ecde8b55eaf981718da
I can look into making a CL for this change.

My use case: I am writing a mail server. The incoming SMTP server offers TLS with STARTTLS. Historically there has been no validation of TLS certificates in that situation. Two new opt-in mechanisms now exist: 1. MTA-STS, which requires common-CA-validation (which I already support); 2. DANE, which requires validation against a public key in DNS (in a TLSA record, protected with DNSSEC). When a new domain is set up in my mail server, I plan to generate a private key, tell the user the DANE TLSA record to add to their DNS (after which I cannot easily get a user to change it, especially with rollover), and request a certificate through ACME for the key. This approach should allow validation with both MTA-STS and DANE.

While making the change, I found that autocert appears to reuse private keys for renewals when a valid certificate is present in the cache. Generating a new private key seems like a safer default. TestRenewFromCacheAlreadyRenewed in renewal_test.go has checks about a new private key, but only in the context of another process already having placed a new certificate with new private key in the cache. It does not check if a new certificate with a new private key was requested. The test may be better off checking if the entire certificate from the updated cache is returned.
When an expired certificate is in the cache, it seems to be ignored and its private key not reused for the newly requested certificate. I don't know if the difference in behaviour around private key reuse for expired-and-renewed and preemptive-renewal is intentional, but I found it a bit surprising.
Repository: godot
Issue: A sudden crush happens when launching Godot.
Labels: bug,topic:editor,needs testing,crash

### Godot version

4.x

### System information

Windows 11 - NVIDIA GeForce RTX 4060 Laptop GPU

### Issue description

I downloaded the Godot engine at the beginning of August . It ran well that time . However, after a period of not using it, the crush happens. I tried to open with CMD, and nothing but the starting logs were displayed .
here is a video about how this happens:

https://github.com/godotengine/godot-builds/assets/145553087/f08c09f3-beb1-4958-a551-72070ae08210

I was using Godot 4.1.1 when the crush happens. Then i turned to dev5 at my group friends' suggestion, and still no work. 
It specifically happens when i click any of the buttons ,except 'New Project'. I can create a new folder in the 'New Project' screen and enter the file explorer to select a folder, but otherwise (including click the SELECT button in the file explorer) everything i did causes the crush. But at the time i turn back to use Godot 3 , it runs normally. The video shows the condition after i delete all the data files of Godot.

Additionally, between the two runs in August and September, i have once updated the NVIDIA drivers .

With my group members' help, i catch some messages by attaching the process using Visual Studio, and i get these details:

_Exception thrown at 0x0000000059C5E2E0 (msvcr90.dll) in godot.windows.editor.x86_64.exe: 0xC0000005: Access violation reading location 0x000002598F860000._
and
_You need to find memcpy.asm to view the source for the current call stack frame_

So how to fix it? Or is there any more information i can get for further understanding concerning this issue?

### Steps to reproduce

With Data
- Delete, rename and create a project

Without Data
- Click any button at the begging screen.

### Minimal reproduction project

N/A
Repository: godot
Issue: The AutoWrap: Word property in Label seems ineffective on Android
Labels: bug,platform:android,topic:gui

### Godot version

4.2.dev5

### System information

Windows11, GLES3

### Issue description

The AutoWrap:Word property in Label seemd ineffective on Android.
Note: Only 'Word' mode incorrect on Android, the 'Word(Smart)' and 'Arbitary'  are all fine. And there is no problem on Windows platform

### Steps to reproduce

1. Create a Label or RichLabel control node in a scene, choose AutoWrap mode to  'Word'. 
2. Change Label's size, and input some characters to make more than one line. 
3. Export to Android, open the scene, you will see that label just display as one line. 

### Minimal reproduction project

N/A