internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: pystiche/pystiche

Issue:
RuntimeError in the Transformer during texture sampling
`RuntimeError: Given groups=1, weight of size 8 6 3 3, expected input[1, 3, 10, 10] to have 6 channels, but got 3 channels instead`

The transformer has too many channels for input, this is probably because in `UlyanovEtAl2016NoiseModule` the `out_channels` will always be 6 unless explicitly entered `in_channels`. However, since no `in_channels` exist in texture sampling and the `in_channels` are not set explicitly, this error occurs. 

I also noticed that the noise is not on the right `device`. Currently another error occurs if the above error is bypassed and `device="cuda"` is set. 
```python
from pystiche.papers.ulyanov_et_al_2016.modules import UlyanovEtAl2016Transformer
import torch
impl_params = True
instance_norm = False
stylization = False
levels = 6
transformer = UlyanovEtAl2016Transformer(
        levels,
        impl_params=impl_params,
        instance_norm=instance_norm,
        stylization=stylization,
    )
device = "cuda"
input_image = torch.rand(1, 3, 256, 256).to(device)
transformer.to(device)
transformer(input_image)
```


Discussion:

Resolving patch:
diff --git a/pystiche/papers/ulyanov_et_al_2016/modules.py b/pystiche/papers/ulyanov_et_al_2016/modules.py
--- a/pystiche/papers/ulyanov_et_al_2016/modules.py
+++ b/pystiche/papers/ulyanov_et_al_2016/modules.py
@@ -106,10 +106,13 @@ def get_meta(input: Union[Tuple[int, int], torch.Tensor]) -> Dict[str, Any]:
 
 def ulyanov_et_al_2016_noise(
     stylization: bool = True,
-    in_channels: int = 3,
+    in_channels: Optional[int] = None,
     num_noise_channels: int = 3,
     noise_fn: Optional[NoiseFn] = None,
 ) -> UlyanovEtAl2016NoiseModule:
+    if in_channels is None:
+        in_channels = 3 if stylization else 0
+
     if stylization:
         noise_class = UlyanovEtAl2016StylizationNoise
     else:
@@ -319,7 +322,7 @@ def ulyanov_et_al_2016_level(
     impl_params: bool = True,
     instance_norm: bool = True,
     stylization: bool = True,
-    in_channels: int = 3,
+    in_channels: Optional[int] = None,
     num_noise_channels: int = 3,
     noise_fn: Optional[NoiseFn] = None,
     inplace: bool = True,
@@ -351,6 +354,8 @@ def conv_sequence(in_channels: int, out_channels: int, noise: bool = False):
         modules.append(("conv_seq", conv_seq))
         return SequentialWithOutChannels(OrderedDict(modules))
 
+    if in_channels is None:
+        in_channels = 3 if stylization else 0
     noise = not impl_params or not stylization
     shallow_brach = conv_sequence(in_channels, out_channels=8, noise=noise)
 


Test patch:
Repository: pystiche/pystiche

Issue:
MD5 hash error
Hi, I get this error when running the script given in the example for beginner.

`FileExistsError: bird1.jpg with a different MD5 hash already exists in /root/.cache/pystiche. If you want to overwrite it, set overwrite=True.`


Discussion:
Hi, 

in #211 I've changed the download links to the original images to better reflect their origin. Apparently this also changed their resolution which then in turn results in a different MD5 hash. 

---

To overcome this you have to options:

1. You can set `overwrite=True` as the error message suggests:

    ```python
     images = demo_images()
     images.download(overwrite=True)
    ```
     With this image will simply overwritten ignoring the MD5.

2. You can delete the file `bird1.jpg` from the directory `/root/.cache/pystiche`. If you choose this option also delete `bird2.jpg` since its download link also changed.
Thanks Pmeier ! I tried both suggestions both don't resolve the problem. 


Resolving patch:
diff --git a/pystiche/demo.py b/pystiche/demo.py
--- a/pystiche/demo.py
+++ b/pystiche/demo.py
@@ -29,7 +29,7 @@ def demo_images():
                 author="gholmz0",
                 date="09.03.2013",
                 license=PixabayLicense(),
-                md5="d42444d3cd0afa47f07066cd083d6cea",
+                md5="36e5fef725943a5d1d22b5048095da86",
             ),
             "paint": DownloadableImage(
                 "https://cdn.pixabay.com/photo/2017/07/03/20/17/abstract-2468874_960_720.jpg",
@@ -45,7 +45,7 @@ def demo_images():
                 author="12019",
                 date="09.04.2012",
                 license=PixabayLicense(),
-                md5="dda3e1d0f93f783de823b4f91129d44e",
+                md5="8c5b608bd579d931e2cfe7229840fe9b",
             ),
             "mosaic": DownloadableImage(
                 "https://upload.wikimedia.org/wikipedia/commons/2/23/Mosaic_ducks_Massimo.jpg",


Test patch:
Repository: pystiche/pystiche

Issue:
Download buttons for all examples are broken for RTD
![Screenshot from 2020-06-11 19-10-01](https://user-images.githubusercontent.com/6849766/84418262-34e6fd00-ac17-11ea-8fdc-7a5cb5f9034d.png)

This is a bug in `sphinx-gallery` and should be fixed with sphinx-gallery/sphinx-gallery#706.


Discussion:

Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -7,7 +7,6 @@
 # -- Imports ---------------------------------------------------------------------------
 
 import os
-import re
 import shutil
 import warnings
 from datetime import datetime
@@ -126,19 +125,6 @@ def get_bool_env_var(name, default=False):
     shutil.unpack_archive(file, extract_dir=".")
     os.remove(file)
 
-    # This is workaround for a bug in sphinx-gallery that replaces absolute with
-    # relative paths. See https://github.com/pmeier/pystiche/pull/325 for details.
-    index_file = path.join("galleries", "examples", "index.rst")
-    with open(index_file, "r") as fh:
-        content = fh.read()
-    content = re.sub(
-        r"(?P<file>examples_(python|jupyter)\.zip) <[\w/.]+>",
-        r"\g<file> <\g<file>>",
-        content,
-    )
-    with open(index_file, "w") as fh:
-        fh.write(content)
-
     extensions.remove("sphinx_gallery.gen_gallery")
     extensions.append("sphinx_gallery.load_style")
     plot_gallery = False


Test patch:
Repository: pystiche/pystiche

Issue:
Download buttons for all examples are broken for RTD
![Screenshot from 2020-06-11 19-10-01](https://user-images.githubusercontent.com/6849766/84418262-34e6fd00-ac17-11ea-8fdc-7a5cb5f9034d.png)

This is a bug in `sphinx-gallery` and should be fixed with sphinx-gallery/sphinx-gallery#706.


Discussion:

Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -7,6 +7,7 @@
 # -- Imports ---------------------------------------------------------------------------
 
 import os
+import re
 import shutil
 import warnings
 from datetime import datetime
@@ -116,9 +117,26 @@ def get_bool_env_var(name, default=False):
     print(f"Downloading pre-built galleries from {url}")
     download_file(url, file)
 
+    try:
+        shutil.rmtree("galleries")
+    except FileNotFoundError:
+        pass
     shutil.unpack_archive(file, extract_dir=".")
     os.remove(file)
 
+    # This is workaround for a bug in sphinx-gallery that replaces absolute with
+    # relative paths. See https://github.com/pmeier/pystiche/pull/325 for details.
+    index_file = path.join("galleries", "examples", "index.rst")
+    with open(index_file, "r") as fh:
+        content = fh.read()
+    content = re.sub(
+        r"(?P<file>examples_(python|jupyter)\.zip) <[\w/.]+>",
+        r"\g<file> <\g<file>>",
+        content,
+    )
+    with open(index_file, "w") as fh:
+        fh.write(content)
+
     extensions.remove("sphinx_gallery.gen_gallery")
     extensions.append("sphinx_gallery.load_style")
     plot_gallery = False


Test patch:
Repository: pystiche/pystiche

Issue:
the default value for allow_inplace changed from False to True
This change was added in #392 

# Before

https://github.com/pmeier/pystiche/blob/950b84837df26a0cab2f9f2714884655173206bf/pystiche/enc/models/vgg.py#L149

https://github.com/pmeier/pystiche/blob/950b84837df26a0cab2f9f2714884655173206bf/pystiche/enc/models/alexnet.py#L38

# After

https://github.com/pmeier/pystiche/blob/3fd3504b94d6bce5389784abea9e91d23c5fb153/pystiche/enc/models/utils.py#L51


Discussion:

Resolving patch:
diff --git a/pystiche/enc/models/utils.py b/pystiche/enc/models/utils.py
--- a/pystiche/enc/models/utils.py
+++ b/pystiche/enc/models/utils.py
@@ -48,7 +48,7 @@ def __init__(
         pretrained: bool = True,
         framework: str = "torch",
         internal_preprocessing: bool = True,
-        allow_inplace: bool = True,
+        allow_inplace: bool = False,
     ) -> None:
         self.pretrained = pretrained
         self.framework = framework


Test patch:
Repository: pystiche/pystiche

Issue:
Fix download of images in beginner example
The [failing galleries workflow](https://github.com/pystiche/pystiche/runs/3272088724) seems not to be a fluke. It seems our access is getting denied with the user agent set to `pystiche`

https://github.com/pystiche/pystiche/blob/65f4d787e44b1ffbf7e5b6e48298ed8c7460e5a9/examples/beginner/example_nst_without_pystiche.py#L329-L334

Two possible solutions:

1. Change the user agent to something different, but risk being blacklisted again in the future.
2. Change the download links to our own download server. 

IMO 2. is the better solution, since we have control over the behavior. Although the demo isn't "without `pystiche`" anymore, I think providing the download link does not have an impact on the point the example is trying to make.




Discussion:

Resolving patch:
diff --git a/examples/beginner/example_nst_without_pystiche.py b/examples/beginner/example_nst_without_pystiche.py
--- a/examples/beginner/example_nst_without_pystiche.py
+++ b/examples/beginner/example_nst_without_pystiche.py
@@ -24,8 +24,9 @@
 # to show the images.
 
 import itertools
+import os.path
 from collections import OrderedDict
-from urllib.request import Request, urlopen
+from urllib.request import urlopen
 
 import matplotlib.pyplot as plt
 from PIL import Image
@@ -326,12 +327,12 @@ def calculate_score(self, input, target):
 )
 
 
-def download_image(url, file):
-    with open(file, "wb") as fh:
-        # without User-Agent the access is denied
-        request = Request(url, headers={"User-Agent": "pystiche"})
-        with urlopen(request) as response:
-            fh.write(response.read())
+def download_image(url):
+    file = os.path.abspath(os.path.basename(url))
+    with open(file, "wb") as fh, urlopen(url) as response:
+        fh.write(response.read())
+
+    return file
 
 
 def read_image(file, size=500):
@@ -362,22 +363,16 @@ def show_image(image, title=None):
 
 ########################################################################################
 
-content_url = "https://cdn.pixabay.com/photo/2016/01/14/11/26/bird-1139734_960_720.jpg"
-content_file = "bird1.jpg"
-
-download_image(content_url, content_file)
+content_url = "https://download.pystiche.org/images/bird1.jpg"
+content_file = download_image(content_url)
 content_image = read_image(content_file)
 show_image(content_image, title="Content image")
 
 
 ########################################################################################
 
-style_url = (
-    "https://cdn.pixabay.com/photo/2017/07/03/20/17/abstract-2468874_960_720.jpg"
-)
-style_file = "paint.jpg"
-
-download_image(style_url, style_file)
+style_url = "https://download.pystiche.org/images/paint.jpg"
+style_file = download_image(style_url)
 style_image = read_image(style_file)
 show_image(style_image, title="Style image")
 


Test patch:
Repository: pystiche/pystiche

Issue:
Setup CI workflow to build and upload galleries
Although we have logic to download pre-built galleries in the documentation

https://github.com/pystiche/pystiche/blob/65f4d787e44b1ffbf7e5b6e48298ed8c7460e5a9/docs/source/conf.py#L160-L166

the builder isn't running for quite some time, because I have no longer have access to the infrastructure.

Preferably, we should have a CI workflow that does this. The problem is, that without a GPU our gallery takes forever to build. Since CI machines that have a GPU are not free (at least I couldn't find any), we probably need to spend some money to achieve this. 

So far I came up with two possible solutions:

1. Build our own custom build server with a GPU and run a self-hosted GitHub Actions workflow on it. This is problematic for a couple of reasons:
    1. GitHub actually warns not to do that in public repositories due to security concerns.
    2. Buying the machine and especially the GPU is quite expensive and as long no one sponsors this, I'm currently not willing to do this out of my own pocket.
    3. We need to maintain the server which will take some time from doing something else on `pystiche`.
2. Spin up a cloud instance with GPU to do the building for us. This solves all the issues of 1. with the disadvantage of being harder to setup. But this also vanishes if we use something like [`cirun.io`](https://cirun.io) (cc @aktech). It looks like other than specifying the type of cloud instance we want to use we can simply use the default GitHub Actions workflow syntax, which is amazing.

The only roadblock I'm currently seeing is that we probably don't need a run every day. If you look at the past commit history, there are quite a few days were no commit is merged so we would be wasting money by running the build every day. My current idea is to run a default CPU workflow that checks if the current commit was already built and only if that is not the case spins up the could instance. From a quick research into this, we probably can use https://github.com/peter-evans/repository-dispatch is a dispatcher.



Discussion:

Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -158,7 +158,7 @@ def download():
 
         base = "https://download.pystiche.org/galleries/"
         is_dev = version != release
-        file = "master.zip" if is_dev else f"v{version}.zip"
+        file = "main.zip" if is_dev else f"v{version}.zip"
 
         url = urljoin(base, file)
         print(f"Downloading pre-built galleries from {url}")


Test patch:
Repository: pystiche/pystiche

Issue:
Documentation theme
We are currently using the [ReadTheDocs `sphinx` theme](https://github.com/readthedocs/sphinx_rtd_theme):

https://github.com/pystiche/pystiche/blob/65f4d787e44b1ffbf7e5b6e48298ed8c7460e5a9/docs/source/conf.py#L85-L90

A lot of other projects in the PyData ecosystem have migrated to one common [base theme](https://pydata-sphinx-theme.readthedocs.io/en/latest/). IMHO it looks a lot more modern in comparison. 

In terms of accessibility, I think it would be a also good thing if we made the switch so users familiar with `numpy`'s, `pandas`' or any other of the many libraries using that theme, are instantly familiar how to navigate the documentation.




Discussion:

Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -84,7 +84,16 @@ def intersphinx():
 def html():
     extension = None
 
-    config = dict(html_theme="sphinx_rtd_theme")
+    config = dict(
+        html_theme="pydata_sphinx_theme",
+        html_theme_options=dict(show_prev_next=False, use_edit_page_button=True),
+        html_context=dict(
+            github_user="pystiche",
+            github_repo="pystiche",
+            github_version="main",
+            doc_path="docs/source",
+        ),
+    )
 
     return extension, config
 


Test patch:
Repository: pystiche/pystiche

Issue:
Use `tqdm` in beginner example without `pystiche`
Since  we use `tqdm` for our logging in `pystiche`, we should also use it in comparison example without `pystiche`:

https://github.com/pystiche/pystiche/blob/4fb1f7e425fd195b35284d7cbf7cd90b84be4333/examples/beginner/example_nst_without_pystiche.py#L446-L470




Discussion:
Hi again @pmeier, I would like to submit a PR to fix this.
Awesome, go ahead!

Resolving patch:
diff --git a/examples/beginner/example_nst_without_pystiche.py b/examples/beginner/example_nst_without_pystiche.py
--- a/examples/beginner/example_nst_without_pystiche.py
+++ b/examples/beginner/example_nst_without_pystiche.py
@@ -30,6 +30,7 @@
 
 import matplotlib.pyplot as plt
 from PIL import Image
+from tqdm.auto import tqdm
 
 import torch
 import torchvision
@@ -445,29 +446,29 @@ def show_image(image, title=None):
 
 num_steps = 500
 
-for step in range(1, num_steps + 1):
+with tqdm(desc="Image optimization", total=num_steps) as progress_bar:
+    for _ in range(num_steps):
 
-    def closure():
-        optimizer.zero_grad()
+        def closure():
+            optimizer.zero_grad()
 
-        input_encs = multi_layer_encoder(input_image, content_layers, style_layers)
-        input_content_encs, input_style_encs = input_encs
+            input_encs = multi_layer_encoder(input_image, content_layers, style_layers)
+            input_content_encs, input_style_encs = input_encs
 
-        content_score = content_loss(input_content_encs)
-        style_score = style_loss(input_style_encs)
+            content_score = content_loss(input_content_encs)
+            style_score = style_loss(input_style_encs)
 
-        perceptual_loss = content_score + style_score
-        perceptual_loss.backward()
+            perceptual_loss = content_score + style_score
+            perceptual_loss.backward()
 
-        if step % 50 == 0:
-            print(f"Step {step}")
-            print(f"Content loss: {content_score.item():.3e}")
-            print(f"Style loss:   {style_score.item():.3e}")
-            print("-----------------------")
+            progress_bar.set_postfix(
+                loss=f"{float(perceptual_loss):.3e}", refresh=False
+            )
+            progress_bar.update()
 
-        return perceptual_loss
+            return perceptual_loss
 
-    optimizer.step(closure)
+        optimizer.step(closure)
 
 output_image = input_image.detach()
 


Test patch:
Repository: pystiche/pystiche

Issue:
Improve usage example builds in PR
Currently, RTD is set up to ignore the content of the files and download the prebuilt galleries. While this is fine for the static documentation, it is a nuisance for the PR builds. There it would be better to just render the examples without executing them. 

Changing this behavior should be quite simple, but AFAIK there is no way to differentiate between a regular and a PR build by RTD. I've opened readthedocs/readthedocs.org#8461 to see if something like this is possible.


Discussion:

Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -41,6 +41,7 @@ def get_bool_env_var(name, default=False):
 GITHUB_ACTIONS = get_bool_env_var("GITHUB_ACTIONS")
 RTD = get_bool_env_var("READTHEDOCS")
 CI = GITHUB_ACTIONS or RTD or get_bool_env_var("CI")
+PR = os.getenv("READTHEDOCS_VERSION_TYPE") == "external"
 
 
 def project():
@@ -178,8 +179,8 @@ def doctest():
 def sphinx_gallery():
     extension = "sphinx_gallery.gen_gallery"
 
-    plot_gallery = get_bool_env_var("PYSTICHE_PLOT_GALLERY", default=not CI)
-    download_gallery = get_bool_env_var("PYSTICHE_DOWNLOAD_GALLERY", default=CI)
+    plot_gallery = get_bool_env_var("PYSTICHE_PLOT_GALLERY", default=not (CI or PR))
+    download_gallery = get_bool_env_var("PYSTICHE_DOWNLOAD_GALLERY")
 
     def download():
         nonlocal extension


Test patch:
Repository: open-telemetry/opentelemetry-python

Issue:
Host docs, build on release
Decide where to host generated docs, configure CI to generate (and possibly upload) new docs on each release.

See #6 for CI bootstrapping.


Discussion:
Actually I think this is something that would really hurt not to have for the Alpha, so I'm adding it. Probably https://readthedocs.org/ would work?
@c24t I see you have already created the readthedocs project https://readthedocs.org/projects/opentelemetry-python/, so I'm assigning this issue to you.

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -42,6 +42,9 @@
     "sphinx.ext.viewcode",
     # Link to other sphinx docs
     "sphinx.ext.intersphinx",
+    # Add a .nojekyll file to the generated HTML docs
+    # https://help.github.com/en/articles/files-that-start-with-an-underscore-are-missing
+    "sphinx.ext.githubpages",
 ]
 
 intersphinx_mapping = {"python": ("https://docs.python.org/3/", None)}


Test patch:
Repository: open-telemetry/opentelemetry-python

Issue:
Create packages, automate releases
Create new `opentelemetry-` packages for the API and SDK, and consider doing the same for all OC contrib packages.

Configure CI to build and release these packages when we tag a new release.

See #6 for CI bootstrapping.


Discussion:

Resolving patch:
diff --git a/opentelemetry-api/setup.py b/opentelemetry-api/setup.py
--- a/opentelemetry-api/setup.py
+++ b/opentelemetry-api/setup.py
@@ -43,6 +43,7 @@
     description="OpenTelemetry Python API",
     include_package_data=True,
     long_description=open("README.rst").read(),
+    long_description_content_type="text/x-rst",
     install_requires=["typing; python_version<'3.5'"],
     extras_require={},
     license="Apache-2.0",
diff --git a/opentelemetry-sdk/setup.py b/opentelemetry-sdk/setup.py
--- a/opentelemetry-sdk/setup.py
+++ b/opentelemetry-sdk/setup.py
@@ -43,6 +43,7 @@
     description="OpenTelemetry Python SDK",
     include_package_data=True,
     long_description=open("README.rst").read(),
+    long_description_content_type="text/x-rst",
     install_requires=["opentelemetry-api==0.1.dev0"],
     extras_require={},
     license="Apache-2.0",


Test patch:
Repository: open-telemetry/opentelemetry-python

Issue:
Missing ABC for Metric
[Missing ABC](https://github.com/open-telemetry/opentelemetry-python/blob/master/opentelemetry-api/src/opentelemetry/metrics/__init__.py#L90) for `Metric` seems strange to me.
 I guess in the PR #311 and Issue #66 settle to add ABC for all interfaces.

Maybe it should look like:
```python

class Metric(abc.ABC):
    """...
    """

    @abc.abstractmethod
    def get_handle(self, label_set: LabelSet) -> "object":
        """...
        """


```
Missing ABC for Metric
[Missing ABC](https://github.com/open-telemetry/opentelemetry-python/blob/master/opentelemetry-api/src/opentelemetry/metrics/__init__.py#L90) for `Metric` seems strange to me.
 I guess in the PR #311 and Issue #66 settle to add ABC for all interfaces.

Maybe it should look like:
```python

class Metric(abc.ABC):
    """...
    """

    @abc.abstractmethod
    def get_handle(self, label_set: LabelSet) -> "object":
        """...
        """


```


Discussion:
Thanks for catching this. Mind submitting a PR @GoPavel since you already have most of the code written up here?
Thanks for catching this. Mind submitting a PR @GoPavel since you already have most of the code written up here?

Resolving patch:
diff --git a/opentelemetry-api/src/opentelemetry/metrics/__init__.py b/opentelemetry-api/src/opentelemetry/metrics/__init__.py
--- a/opentelemetry-api/src/opentelemetry/metrics/__init__.py
+++ b/opentelemetry-api/src/opentelemetry/metrics/__init__.py
@@ -87,13 +87,14 @@ class DefaultLabelSet(LabelSet):
     """
 
 
-class Metric:
+class Metric(abc.ABC):
     """Base class for various types of metrics.
 
     Metric class that inherit from this class are specialized with the type of
     handle that the metric holds.
     """
 
+    @abc.abstractmethod
     def get_handle(self, label_set: LabelSet) -> "object":
         """Gets a handle, used for repeated-use of metrics instruments.
 


Test patch: