sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: torch.nn.init functions with `generator` argument
Labels: module: nn,triaged,module: random,actionable

### 🚀 The feature, motivation and pitch

I might have a custom random generator (`torch.Generator`). All the low-level random functions support a `generator` argument for this. All the functions in `torch.nn.init` just call the low-level functions.

It would be useful if I can pass `generator` to those `torch.nn.init` functions and it would just pass it on to the low-level functions.

In my case, I'm mostly interested in `torch.nn.init.trunc_normal_`, as there is no such low-level `trunc_normal_` function.

### Alternatives

For my use case, it would also be fine if you add a `Tensor.trunc_normal_` low-level function, next to the `Tensor.normal_` function.

However, I think having `generator` as an argument for the `torch.nn.init` functions can anyway be helpful.

### Additional context

_No response_

cc @albanD @mruberry @jbschlosser @walterddr @mikaylagawarecki @pbelevich
Repository: pytorch
Issue: AssertionError: was expecting embedding dimension of 22, but got 1320
Labels: module: nn,triaged

### 🐛 Describe the bug

I am new to pytorch on Colab. I used Transformer encoder as feature extractor to build DQN. The input shape of DQN is (60,22), and the output is one of the three numbers of 0,1,2. model.learn completed successfully. But model.predict is wrong. How can I change it?

code:
class TransformerFeaturesExtractor(BaseFeaturesExtractor):
    def __init__(self, observation_space, features_dim=128):
        super(TransformerFeaturesExtractor, self).__init__(observation_space, features_dim)

        self.transformer_encoder = nn.TransformerEncoder(
            nn.TransformerEncoderLayer(d_model=features_dim, nhead=2), num_layers=6
        )
        self.flatten = nn.Flatten()

    def forward(self, observations):
        x = self.flatten(observations)
        x = self.transformer_encoder(x.unsqueeze(0))
        return x.squeeze(0)

policy_kwargs = dict(
    features_extractor_class=TransformerFeaturesExtractor,
    features_extractor_kwargs=dict(features_dim=22), #, action_space=env.action_space),
)

# Create an instance of the DQN agent
model = DQN("MlpPolicy", env,policy_kwargs=policy_kwargs, verbose=1)
#model = DQN('MlpPolicy', stock_trade_env, verbose=1)
#model = PPO('MlpPolicy', env, verbose=1)
# Train the agent
# pdb.set_trace()
model.learn(total_timesteps=10_000, progress_bar=True)

obs = env.reset()
for i in range(100):
    action, _states = model.predict(obs)
    #action = env.action_space.sample()
    obs, rewards, dones, info = env.step(action)
    if dones:
        break
    env.render()



### Versions

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-8-b1d23f2bc043> in <cell line: 366>()
    365 obs = env.reset()
    366 for i in range(100):
--> 367     action, _states = model.predict(obs)
    368     #action = env.action_space.sample()
    369     obs, rewards, dones, info = env.step(action)

16 frames
/usr/local/lib/python3.9/dist-packages/torch/nn/functional.py in multi_head_attention_forward(query, key, value, embed_dim_to_check, num_heads, in_proj_weight, in_proj_bias, bias_k, bias_v, add_zero_attn, dropout_p, out_proj_weight, out_proj_bias, training, key_padding_mask, need_weights, attn_mask, use_separate_proj_weight, q_proj_weight, k_proj_weight, v_proj_weight, static_k, static_v, average_attn_weights)
   5024             raise AssertionError(
   5025                 "only bool and floating types of key_padding_mask are supported")
-> 5026     assert embed_dim == embed_dim_to_check, \
   5027         f"was expecting embedding dimension of {embed_dim_to_check}, but got {embed_dim}"
   5028     if isinstance(embed_dim, torch.Tensor):

AssertionError: was expecting embedding dimension of 22, but got 1320

cc @albanD @mruberry @jbschlosser @walterddr @mikaylagawarecki @bhosmer @cpuhrsch @erichan1 @drisspg
Repository: PowerToys
Issue: Mouse middle button
Labels: Idea-New PowerToy,Needs-Triage,Product-Mouse Utilities

### Description of the new feature / enhancement

Is there any way to make middle button click  act as "back to previous"? I'd really appreciate this function, expecially as the office doesn't buy multiple buttons mice.

### Scenario when this would be used?

Everywhere! Web pages, explorer, etc. 

### Supporting information

I used to have this option with Logitech mouse via Logitech options, but the mouse died and now I have a Genius that doesn't support any adjustments to middle button.
Repository: react-native
Issue: FlatList doesnot load data after the initialNumToRender count exceeds.
Labels: Component: FlatList,Newer Patch Available

### Description

If the initial state of list is empty and it fills in componentDidMount the flatlsit will only render first 10 items from the list of 60.
It doenot renders the item after the initialNumToRender count.


### React Native Version

0.71.5

### Output of `npx react-native info`

System:
    OS: macOS 12.6
    CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz
    Memory: 37.58 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.13.0 - /usr/local/bin/node
    Yarn: Not Found
    npm: 8.19.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.6953283
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.17 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.1 => 0.71.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

### Steps to reproduce

````
class MyRoomsScreen extends Component {
constructor(){
super()
this.state = {
data: []
}
componentDidMount(){
loadData()
}

loadData(){
let roomArray = []
for(let i =0; i<30;i++){
roomArray.push({id: i+1; name: `Room ${i+1}` })
}
this.setState({data: roomArray})
}

renderRoomList =({item, index}) => {
return(<Text>{item.name} </Text>)
}

render(){
return(
<View>
<FlatList data={this.state.data} renderItem={this.renderRoomList}   />
</View>
)}

````

### Snack, code example, screenshot, or link to a repository

...
Repository: godot
Issue: self.rotation_degrees doesn't work with 180/-180 -> 180 rotation is 179.999985
Labels: topic:core

### Godot version

3.5.2

### System information

MX Linux, i5-6500

### Issue description

Hey,

I'm building stairs for a dungeon crawler and want to check the rotation_degrees value of the stairs themselves.
If they are of a certain value the player is teleported to another place, that makes it possible that I can use the stairs for all possible rotations (0, 90, 180, 270)
This works fine except for 180/-180.

To investigate the issue I printed the rotation_degrees and in the case of 180/-180 it displays 179.999985.

I can workaround the issue but I thought this is not the expected behavior.


### Steps to reproduce

Look at the Stairs.gd, the stairs that doesn't work is the one with the cube, the other stairs are there to show how it works properly.

### Minimal reproduction project

[stairs_bug.zip](https://github.com/godotengine/godot/files/11137162/stairs_bug.zip)
Repository: vscode
Issue: Would it be possible to implement an audio Cue to inform that a command being executed in the terminal has finished?
Labels: feature-request,accessibility,under-discussion,accessibility-signal


Type: <b>Feature Request</b>

When I execute a command in a terminal opened in VSCode and the command ends with a return code other than 0, an audio Cue is played to inform this fact. Honestly I find this feature very useful.

In my view it would also be useful if there was a feature that could indicate that a command being executed in the terminal has ended. I could run for example the application build that takes a long time and while the build is running I could have a coffee or a beer, or even edit some files in VSCode. As soon as the build finished I would be alerted by VSCode.
I think it would be an interesting feature for people who use a screen reader like me.

VS Code version: Code - Insiders 1.78.0-insider (2da5a0024fe2ca407f741f19340f1a10f4d692af, 2023-04-03T05:26:01.718Z)
OS version: Linux x64 6.2.8-200.fc37.x86_64
Modes:
Sandboxed: Yes


<!-- generated by issue reporter -->
Repository: vscode
Issue: GitHub - expose Dependabot alerts in the workbench
Labels: feature-request,github

I have looked at the Dependabot [REST](https://docs.github.com/en/rest/dependabot/alerts?apiVersion=2022-11-28#get-a-dependabot-alert--parameters)/GraphQL APIs and from the looks of it, the dependabot contains information about a vulnerable package, the manifest file in which the package is listed but **it does not** contain information about the location where the package is listed. This means that we cannot reliably create diagnostic information to display in the workbench. Our hypothesis has been confirmed when testing [the GitHub Advanced Security extension](https://marketplace.visualstudio.com/items?itemName=lostintangent.github-security-alerts) that provides similar functionality. The extension displays diagnostic information based on a text search in the file rather than explicit locations.

I think that this effort should be on-hold until GitHub provides better API. //cc @joaomoreno
Repository: storybook
Issue: [Bug]: Newly created svelte projects depending on svelte@3.58.0 have type errors
Labels: bug,typescript,svelte,upstream,sev:S2

### Describe the bug

Newly created svelte projects have type errors:

```
Type 'typeof Button__SvelteComponent_' is not assignable to type 'ComponentType<{ primary?: boolean | undefined; backgroundColor?: string | undefined; size?: "small" | "medium" | "large" | undefined; label?: string | undefined; }, any>'.
  Types of parameters 'options' and 'options' are incompatible.
    Type 'ComponentConstructorOptions<{ primary?: boolean | undefined; backgroundColor?: string | undefined; size?: "small" | "medium" | "large" | undefined; label?: string | undefined; }>' is not assignable to type 'Svelte2TsxComponentConstructorParameters<{ primary?: boolean | undefined; backgroundColor?: string | undefined; size?: "small" | "medium" | "large" | undefined; label?: string | undefined; }>'.
      Types of property 'target' are incompatible.
        Type 'Element | ShadowRoot | Document' is not assignable to type 'Element | ShadowRoot'.
          Type 'Document' is not assignable to type 'Element | ShadowRoot'.
            Type 'Document' is missing the following properties from type 'ShadowRoot': delegatesFocus, host, mode, slotAssignment, innerHTML
```

The problem occurs because svelte changed the component type in v3.58.0:
https://github.com/sveltejs/svelte/commit/d49b568019fbd6578ceba72de68d0790db909bee

But the autogenerated types from svelte files are not (yet) matching that.

### To Reproduce

_No response_

### System

_No response_

### Additional context

_No response_
Repository: vscode
Issue: `terminal.goToRecentDirectory` is not shell-aware
Labels: feature-request,terminal-shell-integration

<!-- ⚠️⚠️ Do Not Delete This! feature_request_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- Please search existing issues to avoid creating duplicates. -->

The shell integration feature can be used by arbitrary REPL-like programs. This includes `cwd` detection. Unfortunately, the current implementation of `workbench.action.terminal.goToRecentDirectory` can't handle that gracefully, since it seems to always send something like `cd $dir\n` to the terminal.

This is the status quo in Julia (switching to shell mode makes the command work, but is cumbersome):
![Peek 2023-04-03 13-16](https://user-images.githubusercontent.com/6735977/229494175-8de563b5-9e87-44f7-8e43-ed0483eb44f7.gif)

It would be awesome if REPL-likes could register a template string at startup, which VS Code would then send instead of `cd $dir`. E.g.
```
OSC 633 ; P ; cdTemplate='cd("$dir")' ST
```
Repository: stable-diffusion-webui
Issue: [Bug]:  linux memory leak when switching models
Labels: bug-report

### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

I have set up a server for my team to use.

Config is as below: 
{
    "sd_checkpoint_cache": 0,
    "sd_vae_checkpoint_cache": 0,
}
however every time I switch a model, RAM increases. It never gets down unless the webui is killed/restarted.

This is observed on linux only, not on my windows installation. In the end, I have to kill the Linux server every night.

I have upgraded to Torch 2.0.0, but the same thing was observed upgrading. Also I multi-instanced my gpu server to 4 webui instances. Same thing is also observed on my T4 (single instance).

we start with this, preloaded with a safetensor model A. please look at the second line, this number is going to change.
![image](https://user-images.githubusercontent.com/40582400/229495554-adde90e0-663d-4345-bf42-26bb47786c64.png)

in the ui, we switched the model to model B.
![image](https://user-images.githubusercontent.com/40582400/229496177-0d6d1007-7ab2-416e-be04-38122ce6a7bb.png)

now we switch it back to model A.
![image](https://user-images.githubusercontent.com/40582400/229496378-ada01660-062e-447e-87cc-201ff39b3ce2.png)

now we switch to model B again.
![image](https://user-images.githubusercontent.com/40582400/229496499-5f0254e1-beca-4e6e-9d38-c81389188952.png)

this keeps on happening even on the same models, so no need to prove further with other/more models. the issue is that this continues untill OOM, which then freezes the entire server. We already have 200 GB of RAM, including 100GB of swap. but sigh. It could be great if this can be solved.

this issue has been mentioned 
#2180, someone in #7451, this remained unanswered. also in #6532, it seems it has been fixed, but it really hasn't. 


### Steps to reproduce the problem

1. install in linux
2. install all required components
3. add in two or more models
4. switch between models
5. observe VRAM fly high


### What should have happened?

with no cache in model, switchign models should not increase RAM. 

### Commit where the problem happens

python: 3.8.10  •  torch: 2.0.0+cu118  •  xformers: N/A  •  gradio: 3.22.0  •  commit: faeef6fc  •  checkpoint: 4a408d2491

### What platforms do you use to access the UI ?

Linux

### What browsers do you use to access the UI ?

Google Chrome

### Command Line Arguments

```Shell
--api --listen
```


### List of extensions

controlnet
imagebrowser
systeminfo

### Console logs

```Shell
no log error until OOM
```


### Additional information

_No response_
Repository: pytorch
Issue: Add a deterministic version of reflection_pad2d_backward_cuda
Labels: module: nn,triaged,enhancement,module: determinism,actionable

Running ResViT model in deterministic mode i face

UserWarning: reflection_pad2d_backward_cuda does not have a deterministic implementation, but you set 'torch.use_deterministic_algorithms(True, warn_only=True)'. You can file an issue at https://github.com/pytorch/pytorch/issues to help us prioritize adding deterministic support for this operation. (Triggered internally at ../aten/src/ATen/Context.cpp:82.)

pytorch version 1.13.1

Thank you!


### Alternatives

_No response_

### Additional context

_No response_

cc @albanD @mruberry @jbschlosser @walterddr @mikaylagawarecki @kurtamohler
Repository: godot
Issue: Clip with transparency would appear opaque with a transparent background project
Labels: bug,topic:rendering,needs testing,topic:2d

### Godot version

4.0.2.rc1

### System information

Ubuntu, Nvidia 3060RTX, every renderer

### Issue description

I ran into this problem while trying to create a video title animation that needed to be transparent (to be used in another software).

The project is set to have a transparent background, a sprite is used to mask a title (same problem occurs with a control Panel), but on the running scene i'll have the clipping sprite appearing black and opaque.
I tried playing with its modulate or self_modulate, but both will propagate it to the label child.
Transparency will fail whatever the renderer I use.

Instead of having a text clipped by it's sprite parent like in the editor : 

![image](https://user-images.githubusercontent.com/114401897/229507031-b5f095f4-acdd-44ce-ad28-3c00ce5da732.png)

The sprite will remain opaque (and black) : 

![image](https://user-images.githubusercontent.com/114401897/229507369-c349eca4-7ad1-4b75-8633-0128f9956a0f.png)

So i guess  there are 2 slightly different problems here :

- whatever the clipping mode chosen, both nodes will receive the same "modulate" or "self_modulate" alpha.
- in both cases, the sprite's transparency will remain opaque with a transparent background

I guess the expected behaviour would be to have "modulate" propagate to the children, and "self_modulate" properly affect the sprite only, leaving the children opaque in every case.

I attached this minimal project showed above for you to check.

### Steps to reproduce

- set your project to be transparent (with "Display/window/pixel transparency" allowed and "Rendering/viewport/Transparent Background" checked)
- set a canvas item as a child of another in a 2D scene
- place the child in a place where the effect will be visible
- set the parent with "clip_only"
- run the scene

### Minimal reproduction project

[clip_transparency_issue.zip](https://github.com/godotengine/godot/files/11138123/clip_transparency_issue.zip)
Repository: next.js
Issue: Unnecessary AJAX Requests in Next.js v13 caused by rewrite in Middleware 
Labels: bug,Runtime

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating System:
      Platform: Ubuntu
      Arch: x86_64
      Version: Ubuntu 20.04.6 LTS 
    Binaries:
      Node: v18.15.0
      npm: N/A
      Yarn: 1.22.19
      pnpm: N/A
    Relevant packages:
      next: 13.2.4
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
```


### Which area(s) of Next.js are affected? (leave empty if unsure)

Middleware / Edge (API routes, runtime)

### Link to the code that reproduces this issue

https://github.com/ReaShenjtolli/rewrite-from-middleware-demo

### To Reproduce

-yarn dev 
![image](https://user-images.githubusercontent.com/103365714/229501753-017dccc2-8f0f-413a-8427-5a7c9a089892.png)


### Describe the Bug

In my middleware, I am utilizing NextResponse.rewrite(), and in the pages directory, I am using getStaticProps to fetch content from the CMS. However, I have noticed that in the browser, for pages that are rewritten in the middleware, I am receiving the content through an AJAX request to the generated JSON file. This is not necessary since the content is server-side generated (SSG), and I want to avoid this unnecessary AJAX request.
This issue only occurs in Next.js v13; it doesn't happen when I use getServerSideProps. 

### Expected Behavior

Content for pages that are server-side generated (SSG) should be served directly from the server without needing to fetch a new JSON from cache.

### Which browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

_No response_
Repository: deno
Issue: doc command + examples
Labels: docs,suggestion

I'm fond of the documentation approach taken in [the denobyexample repo](https://github.com/denoland/denobyexample): generate documentation from well-commented examples, potentially with a bit of module-level jsdocs. Library developers stand to benefit greatly from a streamlined version of this approach:

As demonstrated by denobyexample, examples can be compiled into markdown / elegant documentation websites. This makes sense for a few reasons:

1. Examples can double as tests (especially if one uses assertions within the examples)
2. Upon making changes to library code, examples may become invalid, which is immediately reflected upon their checking + execution. This is easier to observe and maintain when housed within the library itself.
3. Examples are one of the best on-ramp for new users of a given library.

Given the numerous benefits of examples as part of the development workflow, I believe it makes sense to add example-related behavior to the `deno doc` subcommand. Here is *roughly* what I imagine:

**Input**:

`examples/first.ts`

```ts
/**
 * @title My Example
 *
 * Some description of the example.
 */

// Bring imports into scope.
import { myFn } from "my-lib";

// Some description of `myFn`.
const x = myFn()
```

**Command**:

```sh
deno doc --example examples/first.ts
```

**Output**:

````md
# My Example

Some description of the example

Bring imports into scope.

```ts
import { myFn } from "my-lib";
```

Some description of `myFn`.

```ts
const x = myFn()
```
````
Repository: pytorch
Issue: torch.jit.script + legacy executor mode has diff in some pattern
Labels: oncall: jit

### 🐛 Describe the bug

# there is output diff between origin and script

``` python
import torch
import os
os.environ['TORCH_JIT_DISABLE_NEW_EXECUTOR'] = '1'
torch._C._jit_set_nvfuser_enabled(False)
class TempModule(torch.nn.Module):
  def __init__(self):
    super().__init__()
    self.head_size = 64
  def forward(self, x):
    score_scale1 = torch.rsqrt(torch.tensor(self.head_size) * 3)
    return score_scale1

module = TempModule()
x = module(torch.randn(4, 5))
print(x) # print 0.0722
ts_module = torch.jit.script(module)
y = ts_module(torch.randn(4, 5))
print(y) # print 0, unexpectly
```

### Versions

torch==2.0.0

cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel
Repository: go
Issue: text/template: provide full stacktrace when the function call panics
Labels: NeedsInvestigation

At the moment, the code is:

```go
// safeCall runs fun.Call(args), and returns the resulting value and error, if
// any. If the call panics, the panic value is returned as an error.
func safeCall(fun reflect.Value, args []reflect.Value) (val reflect.Value, err error) {
	defer func() {
		if r := recover(); r != nil {
			if e, ok := r.(error); ok {
				err = e
			} else {
				err = fmt.Errorf("%v", r)
			}
		}
	}()
	ret := fun.Call(args)
	if len(ret) == 2 && !ret[1].IsNil() {
		return ret[0], ret[1].Interface().(error)
	}
	return ret[0], nil
}
```


If the function in template panics: `{{.TheUnstableFunc}}` , users and developers only know that it panics, but there is no stracktrace.

In a complex system, the template functions could also be complex, without stacktrace, it's difficult to locate the root problem.

It's really helpful to provide a full stacktrace when the template function panics.

We have encounters a related bug today, the `TheUnstableFunc` has concurrency bug, template package only reports `runtime error: slice bounds out of range [2:1]`, it costs a lot of time for debugging the bug.


Thank you.