sharjeelyunus/github-issues-dataset huggingface dataset:
Repository: pytorch
Issue: [Pipe] Tied layers
Labels: oncall: distributed,pipeline parallelism

## 🚀 Feature
<!-- A clear and concise description of the feature proposal -->

Continuing the [requests](https://github.com/pytorch/pytorch/pull/50693) to support various needs of the models in the new Pipe pytorch feature, this one brings up 

### Tied layers

For models that have tied weights (e.g. encoder/decoder in transformer-type of models. It's important to:
- avoid memory duplication
- handle the gradients correctly (have to be reduced twice in the typical encoder+decoder transformer scenario)

You can see this feature provided in DeepSpeed [Tied Layers](https://www.deepspeed.ai/tutorials/pipeline/#tied-layers)  and its discussion.

Thank you.

@pritamdamania87

cc @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @osalpekar @jiayisuse @agolynski @SciPioneer @H-Huang @mrzzd @cbalioglu @gcramer23
Repository: pytorch
Issue: [Pipe] Memory-Efficient Model Construction 
Labels: oncall: distributed,pipeline parallelism

## 🚀 Feature
<!-- A clear and concise description of the feature proposal -->

Continuing the [requests](https://github.com/pytorch/pytorch/pull/50693) to support various needs of the models in the new Pipe pytorch feature, this one brings up 

### Memory-Efficient Model Construction

As featured in DeepSpeed you can see the full discussion at [Memory-Efficient Model Construction](https://www.deepspeed.ai/tutorials/pipeline/#memory-efficient-model-construction).

As DeepSpeed docs exemplifies - in a simple pipeline approach a machine with 16 GPUs must have as much local CPU memory as 16 times the model size. DeepSpeed implements a feature that delays the construction of modules until the model layers have been partitioned across workers. Then, the modules are built on the GPU that owns the layer. So here you only need 1x model size in CPU memory, regardless of how many GPUs are deployed.

Thank you!

@pritamdamania87


cc @pietern @mrshenli @pritamdamania87 @zhaojuanmao @satgera @rohan-varma @gqchen @aazzolini @osalpekar @jiayisuse @agolynski @SciPioneer @H-Huang @mrzzd @cbalioglu @gcramer23
Repository: pytorch
Issue: RuntimeError: torch.dtype passed as int from JIT to ignored function
Labels: oncall: jit,weeks

## 🐛 Bug
It compiles but fails at runtime. This only happens when calling ignored functions from JIT'ed functions.
```py
import torch

@torch.jit.ignore
def fun(x: torch.Tensor, dtype: torch.dtype) -> torch.Tensor:
    return x.to(dtype=dtype)

def test():
    fun(torch.ones(1), torch.float64)

test_jit = torch.jit.script(test)
test_jit()
```
```
RuntimeError                              Traceback (most recent call last)
/pool01/home/twoertwe/git/python-tools/test.py in <module>
      9
     10 test_jit = torch.jit.script(test)
---> 11 test_jit()

RuntimeError: The following operation failed in the TorchScript interpreter.
Traceback of TorchScript (most recent call last):
  File "/pool01/home/twoertwe/git/python-tools/test.py", line 8, in test
def test():
    fun(torch.ones(1), torch.float64)
    ~~~ <--- HERE
RuntimeError: TypeError: to() received an invalid combination of arguments - got (dtype=int, ), but expected one of:
 * (torch.device device, torch.dtype dtype, bool non_blocking, bool copy, *, torch.memory_format memory_format)
 * (torch.dtype dtype, bool non_blocking, bool copy, *, torch.memory_format memory_format)
 * (Tensor tensor, bool non_blocking, bool copy, *, torch.memory_format memory_format)


At:
  /pool01/home/twoertwe/git/python-tools/test.py(5): fun
  /pool01/home/twoertwe/git/python-tools/test.py(11): <module>
  /pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/IPython/utils/py3compat.py(168): execfile
  /pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/IPython/core/interactiveshell.py(2749): safe_execfile
  /pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/IPython/core/shellapp.py(378): _exec_file
  /pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/IPython/core/shellapp.py(453): _run_cmd_line_code
  /pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/IPython/core/shellapp.py(328): init_code
  /pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/IPython/terminal/ipapp.py(323): initialize
  /pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/traitlets/config/application.py(87): inner
  /pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/traitlets/config/application.py(844): launch_instance
  /pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/IPython/__init__.py(126): start_ipython
  /pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/bin/ipython(8): <module>
```

cc @gmagogsfm
Repository: pytorch
Issue: Overwritten method has wrong self when JIT'ed
Labels: oncall: jit

## 🐛 Bug
Doing the following is probably not a good programming style. It might be better to throw an error during compilation or use the correct `self`.

```py
import torch

class A(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.other_object = B()
        self.fun = self.other_object.fun  # ugly but works in python

    @torch.jit.export
    def fun(self) -> int:
        return 1


class B(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.int = 2

    @torch.jit.export
    def fun(self) -> int:
        return self.int


model = torch.jit.script(A())
model.fun()
```

```
Traceback (most recent call last):
  File "test.py", line 25, in <module>
    model = torch.jit.script(A())
  File "/pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/torch/jit/_script.py", line 897, in script
    return torch.jit._recursive.create_script_module(
  File "/pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/torch/jit/_recursive.py", line 352, in create_script_module
    return create_script_module_impl(nn_module, concrete_type, stubs_fn)
  File "/pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/torch/jit/_recursive.py", line 410, in create_script_module_impl
    create_methods_and_properties_from_stubs(concrete_type, method_stubs, property_stubs)
  File "/pool01/home/twoertwe/.cache/pypoetry/virtualenvs/python-tools-XWCSm5JO-py3.8/lib/python3.8/site-packages/torch/jit/_recursive.py", line 304, in create_methods_and_properties_from_stubs
    concrete_type._create_methods_and_properties(property_defs, property_rcbs, method_defs, method_rcbs, method_defaults)
RuntimeError:
Module 'A' has no attribute 'int' :
  File "test.py", line 22
    @torch.jit.export
    def fun(self) -> int:
        return self.int
               ~~~~~~~~ <--- HERE
```

cc @gmagogsfm
Repository: flutter
Issue: The Link trait doesn't show up in Semantic Debugger UI tests
Labels: a: tests,framework,f: material design,a: accessibility,has reproducible steps,found in release: 3.3,found in release: 3.7,team-design,triaged-design

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Steps to Reproduce

<!-- You must include full steps to reproduce so that we can reproduce the problem. -->
1. Create a UI with one item that is wrapped in Semantics( button: true), and one that is wrapped in Semantics( link: true)
2. Write a UI test that takes a snapshot of the SemanticsDebugger of this UI.
**Expected results:** Both widgets have appropriate semantics tagged in the snapshot.

**Actual results:** The 'button' trait is shown correctly but the 'link' trait is not
Repository: flutter
Issue: Documentation to various lerp functions is unclear regarding null
Labels: framework,d: api docs,P2,team-framework,triaged-framework

Various `lerp` functions take nullable arguments and return a nullable value.  For example, [`Offset.lerp`](https://api.flutter.dev/flutter/dart-ui/Offset/lerp.html), whose documentation states:

> If either offset is null, this function interpolates from `Offset.zero`.

Based on that statement, I'd assume that if both offsets are null, it'd interpolate from `Offset.zero` to `Offset.zero` and return `Offset.zero`.  However, looking at the implementation, `Offset.lerp` returns null if (and **only if**) both offsets are null.  It'd be nice if the documentation explicitly stated that as part of the contract. (Personally I'd prefer that it didn't return a nullable value at all and all just did `a ??= Offset.zero; b ??= Offset.zero;` as implied by the documentation.)

Various other `lerp` methods have the same ambiguity: [`Size.lerp`](https://api.flutter.dev/flutter/dart-ui/Size/lerp.html), [`Color.lerp`](https://api.flutter.dev/flutter/dart-ui/Color/lerp.html), [`RRect.lerp`](https://api.flutter.dev/flutter/dart-ui/RRect/lerp.html), [`Radius.lerp`](https://api.flutter.dev/flutter/dart-ui/Radius/lerp.html), [`Rect.lerp`](https://api.flutter.dev/flutter/dart-ui/Rect/lerp.html), [`Shadow.lerp`](https://api.flutter.dev/flutter/dart-ui/Shadow/lerp.html), and [`TextStyle.lerp`](https://api.flutter.dev/flutter/painting/TextStyle/lerp.html) (which doesn't mention *anything* about null behavior).

([`FontWeight.lerp`](https://api.flutter.dev/flutter/dart-ui/FontWeight/lerp.html) *does* cover the case where both values are null; other functions maybe should copy that. [`lerpDouble`](https://api.flutter.dev/flutter/dart-ui/lerpDouble.html) also covers the case where both arguments are null, albeit indirectly.)

(This list is not necessarily comprehensive.)
Repository: rust
Issue: Create a canonical implementation of traits and use it in tuples & derive macros
Labels: A-macros,T-libs-api

I have a meta-suggestion - make the implementation of `PartialOrd` (and potentially other derivable traits) for tuples in libcore a golden standard, and make built-in macros follow it exactly.
All structures should be equivalent to tuples up to field names.
- Make the same changes as this PR does to `impl PartialOrd for (T1, T2, ...)` in libcore, benchmark them, pass them through T-libs, etc.
- Generate exactly the same code (up to field names) in `rustc_builtin_macros` and link both implementation to each other with docs telling that any changes must be synchronized.

_Originally posted by @petrochenkov in https://github.com/rust-lang/rust/issues/81384#issuecomment-773511855_

@rustbot label: +T-libs +A-macros
Repository: terminal
Issue: Cursor doesn't change back to what's specified in the settings.json
Labels: Help Wanted,Resolution-External,Area-VT,Issue-Bug,Product-Terminal,Priority-3,Tracking-External

<!-- 
🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨

I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING:
1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement.
2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement.
3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number).
4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement.
5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement.

All good? Then proceed!
-->

<!--
This bug tracker is monitored by Windows Terminal development team and other technical folks.

**Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**.
Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue.

If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link.

Please use this form and describe your issue, concisely but precisely, with as much detail as possible.

-->

# Environment

```none
Windows build number: 10.0.19042.746
Windows Terminal version (if applicable): 1.6.10272.0

Any other software?
NeoVim: 0.4.4
```

# Steps to reproduce

Set your cursor to 'bar' style. Open WT. Run `nvim`. The cursor inside neovim is a block cursor. Exit neovim now. 
# Expected behavior

The cursor should turn back to bar style.

# Actual behavior

The cursor remains in block style.

![hmm3](https://user-images.githubusercontent.com/46838874/107345251-63d8aa00-6ae9-11eb-9b9a-a71fc3d66acd.gif)
Repository: electron
Issue: [Bug]: Unable to copy text from a pdf
Labels: bug :beetle:,platform/all,component/pdf-viewer,11-x-y

### Preflight Checklist

* [x] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
* [x] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
* [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.

### Issue Details

* **Electron Version:**
  * 11.2.3
* **Operating System:**
  * Windows 10
* **Last Known Working Electron version:**
  * none

### Expected Behavior
Context menu, before-input event, shortcuts should work for pdf viewer

### Actual Behavior
At the moment the context-menu and before-input-event events are not emitted for the pdf-viewer. Additionally registered shortcuts do not work. This makes it impossible for a user to copy text from a pdf since neither ctrl-c nor the context-menu work.
It would be good if any of these methods work or if there is a default assignment that makes it able to copy text

### To Reproduce
Try any of the above methods together with a pdf
Repository: svelte
Issue: Provide `print(ast: Ast): string` as compiler or svelte/printer
Labels: stale-bot,temp-stale

**Is your feature request related to a problem? Please describe.**

Svelte compiler has `parse(template: string): Ast` but  no `print(code: Ast) => template` printer.

TypeScript compiler  (and some program languages) has this feature.

https://learning-notes.mistermicheels.com/javascript/typescript/compiler-api/#programmatically-creating-ast-nodes.

**Describe the solution you'd like**

Svelte compiler provides `print(ast: Ast, optionalFormatter?: {js?: (code:string)=>string , ...} ): string`. 

```ts
import { parse, print } from "svelte/compiler";
const template = `<div {id}>foo</div>`
const parsed = parse(template);
const restored = print(parsed); // => same template
```

**How important is this feature to you?**

I'm creating code collaboration editor for non-programmer and programmer on svelte template.

![](https://i.gyazo.com/7d07de67b5f4fa368ebb529bb13a3cb8.png)

Left side pane is auto generated forms by svelte template AST for non-programmer. By rewriting this, I try to reflect svelte template by ast changes. but svelte compiler does not have printer feature.

I think providing this feature helps svelte ecosystem.

**Additional Context**

https://github.com/sveltejs/prettier-plugin-svelte has code printer already. (fortunately for me, it works in browser!)

But that is `format(template: string): string`. I need formatter from ast.

So I hacked this for my workarround.

```ts
import prettier from "prettier/standalone";
import produce from "immer";
import { parse } from "svelte/compiler";
import type { Ast } from "svelte/types/compiler/interfaces";
// @ts-ignore
import * as sveltePlugin from "prettier-plugin-svelte";

function printTemplate(ast: Ast) {
  const overridePlugin = produce(sveltePlugin, (d: any) => {
    d.parsers.svelte.parse = () => {
      return { ...ast, __isRoot: true };
    };
  });
  return prettier.format(" dummy ", {
    parser: "svelte",
    plugins: [overridePlugin as any],
  });
}

const code = "<div {id}>text</div>";
const parsed = parse(code);
// override ast
// @ts-ignore
parsed.html.children[0].name = "span";
const out = printTemplate(parsed);
console.log(out); // <span {id}>text</span>
```

It depend on prettier but formatting js and css are optional feature for template block. Formatters for js and css already exist but svelte html template block formatter does not exists now.

I wrote simple printer (WIP) but I found prettier hack before I finished it.

https://gist.github.com/mizchi/8d51d239bccec98408cffde5ef5b855d
Repository: excalidraw
Issue: Crash due to huge text width
Labels: bug

The board crashes as soon as it tries to render a text element that has an extremely large width. This happened to me when I pasted a very long text line into the board.

I was able to create a small example that reproduces it. Trying to load this board causes the error:
```
{
  "type": "excalidraw",
  "version": 2,
  "source": "https://excalidraw.com",
  "elements": [
    {
      "type": "text",
      "version": 228,
      "versionNonce": 901426059,
      "isDeleted": false,
      "id": "someid",
      "fillStyle": "hachure",
      "strokeWidth": 1,
      "strokeStyle": "solid",
      "roughness": 1,
      "opacity": 100,
      "angle": 0,
      "x": 1098.204663744457,
      "y": 411.536944389053,
      "strokeColor": "#000000",
      "backgroundColor": "transparent",
      "width": 46000,
      "height": 78,
      "seed": 18314603,
      "groupIds": [],
      "strokeSharpness": "sharp",
      "boundElementIds": [],
      "fontSize": 20,
      "fontFamily": 1,
      "text": "very long text",
      "baseline": 70,
      "textAlign": "left",
      "verticalAlign": "top"
    }
  ],
  "appState": {
    "gridSize": null,
    "viewBackgroundColor": "#ffffff"
  }
}
```

There's no actual long line of text in this example. However, pasting a long line of text sets the width and causes the same crash.

As a side note: I originally triggered the crash when I tried to copy and paste an element on a board. Instead of the element, the raw json was pasted as one very long string.
Repository: pytorch
Issue: PyTorch for scientific computing
Labels: feature,triaged,needs research,needs design

## 🚀 Feature

I would like to propose several features for PyTorch to cater the needs of the scientific computing community which can also solve the needs of some machine learning researchers.
Those are:

* **Functionals**, i.e. functions that receive functions as inputs. For example: `rootfinder`, `solve_ivp`.
* **Implicit linear operators** and their operations. For example: `symeig`, `solve`. These are available in PyTorch, but only for dense linear operator, implicit linear operator is like a class that only requires matrix-vector calculation to be defined.

## Motivation

As someone who is working at the intersection of scientific computing and machine learning, I see an increasing interest from both sides to combine those fields, specifically in writing the scientific computing software in automatic differentiation libraries.
JAX has a lot of examples for this kind of thing, e.g. [JAX M.D.](https://github.com/google/jax-md), [JAX 1D-DFT](https://github.com/google-research/google-research/tree/master/jax_dft), and [JAX CFD (only paper for now)](https://arxiv.org/pdf/2102.01010.pdf).

However, having built a proper scientific computing using PyTorch (I built [Differentiable Quantum Chemistry](https://github.com/mfkasim1/dqc/) and the paper [here](https://arxiv.org/abs/2102.04229)), I know that PyTorch would be a great go-to library for scientists who are willing to write their code in an automatic differentiable manner.
Mostly because its dynamic graph building and allowing us to write the code in an object-oriented manner (as opposed to JAX which adopts functional programming).
Also, it is easier to learn.

## Pitch

I have implemented some of the operations mentioned above in [xitorch](https://xitorch.readthedocs.io/) and I propose it to **be integrated to PyTorch** to get the support from the community and easier exposure for computational scientists.
There might be some design from xitorch that needs rethinking, but it should be discussed if the integration is agreed.

## Alternatives

[xitorch](https://xitorch.readthedocs.io/)

## Additional context

There has been modules that can do `solve_ivp` and `rootfinder` with PyTorch (e.g. [torchdiffeq](https://github.com/rtqichen/torchdiffeq) and [deq](https://github.com/locuslab/deq)).
However, they only provide first order derivative correctly, thus we cannot have the 2nd derivative and forward-mode derivative (assuming using the 2-backward trick).
Repository: pytorch
Issue: Feature Request:Fast Cosine Transform
Labels: triaged,module: fft,function request

## 🚀 Feature

I would be very helpful if we had an implementation of the Fast Cosine Transform that is as optimized as the FFT.

## Motivation

The FCT transform is vastly used by the DSP community. It would enable new applications using torch. Additionally, I need it to do research.

## Pitch

Just like the `torch.fft.fft`, It is desirable to have the following 

- `torch.fft.fct`
- `torch.fft.ifct`
- `torch.fft.fctn`
- `torch.fft.ifctn`

## Alternatives

I've used some alternatives around that, FCT via FFT and DCT via linear layer, see [this repo](https://github.com/zh217/torch-dct). But these are not as efficient as having the plain FCT implemented with a similar optimization as the FFT

cc @mruberry @peterbell10 @walterddr