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

Issue:
Clean up type annotations in documentation site
**Is your feature request related to a problem? Please describe.**
Since merging #1564 , the function headers on the doc site have gotten a bit unwieldy.

For example, VQT is basically unreadable:

![image](https://user-images.githubusercontent.com/1190540/207905293-ff8380c6-596d-4c7c-96ca-619a4e1bc4f5.png)


**Describe the solution you'd like**
We should find a way to clean this up, ideally from the sphinx end of things.

[sphinx-autodoc-typehints](https://pypi.org/project/sphinx-autodoc-typehints/) might do the trick, but I'm not yet sure.



Discussion:
Oy 😅 
https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_typehints

Setting `autodoc_typehints` to `none` might work
> Setting `autodoc_typehints` to `none` might work

Nice - the autodoc-typehints package seems to be pretty incompatible with numpydoc :\

It'd be great if there's a way to somehow retain the type annotations in a simplified form, but barring that, I think the docstrings do a good enough job of describing what's going on for the doc site purposes.
> Setting `autodoc_typehints` to `none` might work

Confirmed.  I'll PR later today. Thanks!

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -35,7 +35,7 @@
 for _ in removals:
     del sys.modules[_]
 
-# -- General configuration -----------------------------------------------------
+# -- General configuration ----------------------------------------------------
 
 # If your documentation needs a minimal Sphinx version, state it here.
 if sphinx.__version__ < "2.0":
@@ -378,6 +378,7 @@ def reset_mpl(gallery_conf, fname):
 # texinfo_show_urls = 'footnote'
 
 autodoc_member_order = "bysource"
+autodoc_typehints = "none"
 
 smv_branch_whitelist = r"^main$"  # build main branch, and anything relating to documentation
 smv_tag_whitelist = r"^((0\.8\.1)|(0\.[9]\.\d+))$"  # use this for final builds


Test patch:
diff --git a/tests/data b/tests/data
--- a/tests/data
+++ b/tests/data
@@ -1 +1 @@
-Subproject commit b49a879c3045ee5a54bacf62c7907915738e445d
+Subproject commit 72bd79e448829187f6336818b3f6bdc2c2ae8f5a
Repository: librosa/librosa

Issue:
Remove shim for matplotlib < 3.3
**Is your feature request related to a problem? Please describe.**
We have some shim code in place to handle an API change in matplotlib for log-scaled axes.  Since our minimum matplotlib version is now 3.3.0, we no longer need this shim.

https://github.com/librosa/librosa/blob/8c4c1958888bb1c9a81af317106864af50dcf654/librosa/display.py#L1319-L1339


Discussion:

Resolving patch:
diff --git a/librosa/display.py b/librosa/display.py
--- a/librosa/display.py
+++ b/librosa/display.py
@@ -41,7 +41,6 @@
 import warnings
 
 import numpy as np
-from packaging.version import parse as version_parse
 import lazy_loader as lazy
 
 from . import core
@@ -1331,28 +1330,14 @@ def __scale_axes(axes, ax_type, which):
     """Set the axis scaling"""
 
     kwargs = dict()
-    if which == "x":
-        if version_parse(matplotlib.__version__) < version_parse("3.3.0"):
-            thresh = "linthreshx"
-            base = "basex"
-            scale = "linscalex"
-        else:
-            thresh = "linthresh"
-            base = "base"
-            scale = "linscale"
+    thresh = "linthresh"
+    base = "base"
+    scale = "linscale"
 
+    if which == "x":
         scaler = axes.set_xscale
         limit = axes.set_xlim
     else:
-        if version_parse(matplotlib.__version__) < version_parse("3.3.0"):
-            thresh = "linthreshy"
-            base = "basey"
-            scale = "linscaley"
-        else:
-            thresh = "linthresh"
-            base = "base"
-            scale = "linscale"
-
         scaler = axes.set_yscale
         limit = axes.set_ylim
 


Test patch:
Repository: librosa/librosa

Issue:
Doc build headaches continued
#### Reference Issue
#1649 still


#### What does this implement/fix? Explain your changes.
Still working on the documentation environment

#### Any other comments?

Bumping to sklearn 1.2 requires bumping to python 3.8.  This is causing problems with strict conda solve, so maybe a flexible solve will sort us out.


Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -383,7 +383,7 @@ def reset_mpl(gallery_conf, fname):
     r"^main$"  # build main branch, and anything relating to documentation
 )
 smv_tag_whitelist = (
-    r"^((0\.8\.1)|(0\.[9]\.2))|(0\.10\.\d+)$"  # use this for final builds
+    r"^((0\.8\.1)|(0\.9\.2)|(0\.10\.\d+))$"  # use this for final builds
 )
 smv_released_pattern = r".*tags.*"
 smv_remote_whitelist = r"^origin$"


Test patch:
Repository: librosa/librosa

Issue:
Support sphinx 6.x in documentation builds
**Describe the bug**

Sphinx 6.0 removed jquery, which is used in our sphinx-multiversion documentation theme to pop open the version navigation box.  If the documentation site is compiled using the latest sphinx version, the result no longer works properly.

This ought to be fixable with minor modifications to the sphinx theme and configuration.


Discussion:
This should be fixed now with sphinx_rtd_theme 1.2.0

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -71,6 +71,7 @@
     "matplotlib.sphinxext.plot_directive",  # docstring examples
     "sphinxcontrib.inkscapeconverter",  # used for badge / logo conversion in tex
     "sphinx_multiversion",  # historical builds
+    "sphinx_rtd_theme",  # for proper jquery behavior
 ]
 
 autosummary_generate = True


Test patch:
Repository: librosa/librosa

Issue:
Release new version to fix scipy tests
https://github.com/librosa/librosa/commit/12dee8eabed7df14c5622b52c05393ddfeb11f4b fixed compatibility with scipy in tests but it's not included in any release.
We rely as downstream packagers on tests to ensure all python dependencies play well together.


Discussion:
Thanks for the reminder on this @Mic92 - I've been meaning to reassess the remaining items on the 0.10.1 milestone and see if it makes sense to punt them to a 0.10.2 and cut 0.10.1 from the current main.  (I suspect it does make sense at this point.)

@lostanlen any thoughts?

... gave it a think, and I believe the impact on downstream tests is worth making a 0.10.1 release.

I'm currently waiting on some upstream conda-forge packages to rebuild, but I can get going on the release prep some time this week.

Resolving patch:
diff --git a/librosa/version.py b/librosa/version.py
--- a/librosa/version.py
+++ b/librosa/version.py
@@ -6,7 +6,7 @@
 import importlib
 
 short_version = "0.10"
-version = "0.10.1dev"
+version = "0.10.1"
 
 
 def __get_mod_version(modname):


Test patch:
Repository: librosa/librosa

Issue:
Docstring on the `writeable` argument of `util.frame` function is wrong
**Describe the bug**

In the docstring for `librosa.util.frame` function, it describes the `writeable` argument as:

```python
"""
...
    writeable : bool
        If ``True``, then the framed view of ``x`` is read-only.
        If ``False``, then the framed view is read-write.  Note that writing to the framed view
        will also write to the input array ``x`` in this case.
...
"""
```

This is the opposite of what it does.  The framed view is only read-write when the `writable` argument is `True`.  It's read-only when the `writeable` argument is `False`.

**To Reproduce**

Example:
```python
import numpy as np
import librosa

# array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
x = np.arange(10)

# Assignment is successful
frames = librosa.util.frame(x, frame_length=3, hop_length=2, writeable=True)
frames[0, 0] = -1

# Raises ValueError: assignment destination is read-only
frames = librosa.util.frame(x, frame_length=3, hop_length=2, writeable=False)
frames[0, 0] = -1
```

**Expected behavior**

The doc string matches what the argument actually does.

**Software versions**

macOS-14.0-arm64-arm-64bit
Python 3.11.5 (main, Aug 24 2023, 12:23:19) [Clang 15.0.0 (clang-1500.0.40.1)]
NumPy 1.26.2
SciPy 1.11.3
librosa 0.10.1
INSTALLED VERSIONS
\------------------
python: 3.11.5 (main, Aug 24 2023, 12:23:19) [Clang 15.0.0 (clang-1500.0.40.1)]

librosa: 0.10.1

audioread: 3.0.1
numpy: 1.26.2
scipy: 1.11.3
sklearn: 1.3.2
joblib: 1.3.2
decorator: 5.1.1
numba: 0.58.1
soundfile: 0.12.1
pooch: v1.8.0
soxr: 0.3.7
typing_extensions: installed, no version number available
lazy_loader: installed, no version number available
msgpack: 1.0.7

numpydoc: None
sphinx: None
sphinx_rtd_theme: None
matplotlib: 3.8.1
sphinx_multiversion: None
sphinx_gallery: None
mir_eval: None
ipython: None
sphinxcontrib.rsvgconverter: None
pytest: None
pytest_mpl: None
pytest_cov: None
samplerate: None
resampy: None
presets: None
packaging: 23.2



Discussion:

Resolving patch:
diff --git a/librosa/util/utils.py b/librosa/util/utils.py
--- a/librosa/util/utils.py
+++ b/librosa/util/utils.py
@@ -119,8 +119,8 @@ def frame(
     axis : int
         The axis along which to frame.
     writeable : bool
-        If ``True``, then the framed view of ``x`` is read-only.
-        If ``False``, then the framed view is read-write.  Note that writing to the framed view
+        If ``False``, then the framed view of ``x`` is read-only.
+        If ``True``, then the framed view is read-write.  Note that writing to the framed view
         will also write to the input array ``x`` in this case.
     subok : bool
         If True, sub-classes will be passed-through, otherwise the returned array will be


Test patch:
Repository: librosa/librosa

Issue:
Enhance Docs: Copy button for code snippets
Hi everybody,

one thing that "bugged" me for some time is copying code examples from the docs.
I always remove the ">>>>" manually.
However, I have seen in other docs that they have a copy button.
I am not an expert on Sphinx and the templates but there is a little plugin called "Sphinx-copybutton" which does exactly this.
If this is accepted, I would volunteer in trying out this extension (and maybe others have better recommendations) on the librosa docs. 

What do others think? Are there better alternatives?

Best,
Stefan


Discussion:
This sounds good to me. 

@danagilliann - do you want to take a crack at this, since you're already in the weeds of the doc build?

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -67,6 +67,7 @@
     "sphinx.ext.intersphinx",  # cross-linkage
     "sphinx.ext.mathjax",
     "sphinx_gallery.gen_gallery",  # advanced examples
+    "sphinx_copybutton",  # code example copy button
     "numpydoc",  # docstring examples
     "sphinxcontrib.inkscapeconverter",  # used for badge / logo conversion in tex
     "sphinx_multiversion",  # historical builds
@@ -101,6 +102,12 @@
 
 numpydoc_show_class_members = False
 
+
+# ----------------------------------
+# Copybutton configs
+# ----------------------------------
+copybutton_exclude = '.linenos, .gp'
+
 # ------------------------------------------------------------------------------
 # Plot
 # ------------------------------------------------------------------------------


Test patch:
Repository: microsoft/torchgeo

Issue:
Improvements to VHR-10 documentation
Need better docs describing the format of the dataset.


Discussion:

Resolving patch:
diff --git a/torchgeo/datasets/nwpu.py b/torchgeo/datasets/nwpu.py
--- a/torchgeo/datasets/nwpu.py
+++ b/torchgeo/datasets/nwpu.py
@@ -11,7 +11,31 @@
 
 
 class VHR10(VisionDataset):
-    """`NWPU VHR-10 <https://doi.org/10.1016/j.isprsjprs.2014.10.002>`_ Dataset.
+    """Northwestern Polytechnical University (NWPU) very-high-resolution ten-class
+    (VHR-10) remote sensing image dataset.
+
+    Consists of 800 VHR optical remote sensing images, where 715 color images were
+    acquired from Google Earth with the spatial resolution ranging from 0.5 to 2 m,
+    and 85 pansharpened color infrared (CIR) images were acquired from Vaihingen data
+    with a spatial resolution of 0.08 m.
+
+    The data set is divided into two sets:
+
+    1. Positive image set (650 images) which contains at least one target in an image
+    2. Negative image set (150 images) does not contain any targets
+
+    The positive image set consists of objects from ten classes:
+
+    1. Airplanes (757)
+    2. Ships (302)
+    3. Storage tanks (655)
+    4. Baseball diamonds (390)
+    5. Tennis courts (524)
+    6. Basketball courts (159)
+    7. Ground track fields (163)
+    8. Harbors (224)
+    9. Bridges (124)
+    10. Vehicles (477)
 
     Includes object detection bounding boxes from original paper and instance
     segmentation masks from follow-up publications. If you use this dataset in your


Test patch:
Repository: microsoft/torchgeo

Issue:
Determine minimum supported dependency versions
Before releasing, we should determine the minimum supported version of each dependency. We should also consider a test with this version just to make sure it doesn't change.


Discussion:
For testing, I think we can add a matrix field like:
```yaml
matrix:
    dep-version: [oldest, latest]
```
Then, during action setup, `if: ${{ matrix.dep-version == 'oldest' }}`, we can run `sed` on `requirements.txt` to replace `>=` with `==`.

We could also use an `include:` so that we don't have to run every test twice. Still haven't decided if we need to test this just for `pytest` or for all actions. Also not sure how to detect the minimum version without trying everything and seeing what breaks.
https://github.com/pypa/pip/issues/8085 would greatly help with this if it ever gets implemented.
We depend on the latest release candidate of pytorch-lightning (1.4.0) to fix an issue with mypy (the problem where mypy doesn't think a LightningModule's hparams property is indexable)
I would like to differentiate between dependency versions required for torchgeo to function and versions required for things like mypy to pass. We have hundreds of comments across torchgeo that ignore mypy warnings due to missing typing. These will likely change frequently. So the actual version required by torchgeo should be the minimum where the pytest tests pass. For things like mypy/Sphinx, we will always use the latest release. 

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -46,6 +46,10 @@
 # This pattern also affects html_static_path and html_extra_path.
 exclude_patterns = ["_build"]
 
+# Sphinx 3.0+ required for:
+# autodoc_typehints = "description"
+needs_sphinx = "3.0"
+
 nitpicky = True
 nitpick_ignore = [
     # https://github.com/sphinx-doc/sphinx/issues/8127


Test patch:
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -39,7 +39,10 @@ jobs:
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
-        python-version: [3.7, 3.8, 3.9]
+        python-version: [3.6, 3.7, 3.8, 3.9]
+        exclude:
+        - os: windows-latest
+          python-version: 3.6
     steps:
     - name: Clone repo
       uses: actions/checkout@v2
@@ -62,7 +65,7 @@ jobs:
       if: ${{ runner.os == 'Windows' }}
     - name: Install conda dependencies (Windows)
       run: |
-        conda install fiona h5py 'rasterio>=1.0'
+        conda install 'fiona>=1.5' h5py 'rasterio>=1.0.16'
         conda list
         conda info
       if: ${{ runner.os == 'Windows' }}
Repository: microsoft/torchgeo

Issue:
torchgeo.models.RFC should have a seed argument
The parameters of this model are randomly initialized, but it is not trainable. To have repeatable results with this we need a seed parameter so we can guarantee that parameter init happens the same.


Discussion:

Resolving patch:
diff --git a/torchgeo/models/rcf.py b/torchgeo/models/rcf.py
--- a/torchgeo/models/rcf.py
+++ b/torchgeo/models/rcf.py
@@ -3,7 +3,7 @@
 
 """Implementation of a random convolutional feature projection model."""
 
-from typing import cast
+from typing import Optional, cast
 
 import torch
 import torch.nn.functional as F
@@ -31,6 +31,7 @@ def __init__(
         features: int = 16,
         kernel_size: int = 3,
         bias: float = -1.0,
+        seed: Optional[int] = None,
     ) -> None:
         """Initializes the RCF model.
 
@@ -42,11 +43,19 @@ def __init__(
             features: number of features to compute, must be divisible by 2
             kernel_size: size of the kernel used to compute the RCFs
             bias: bias of the convolutional layer
+            seed: random seed used to initialize the convolutional layer
         """
         super().__init__()
 
         assert features % 2 == 0
 
+        if seed is None:
+            generator = None
+        else:
+            generator = torch.Generator().manual_seed(  # type: ignore[attr-defined]
+                seed
+            )
+
         # We register the weight and bias tensors as "buffers". This does two things:
         # makes them behave correctly when we call .to(...) on the module, and makes
         # them explicitely _not_ Parameters of the model (which might get updated) if
@@ -59,6 +68,7 @@ def __init__(
                 kernel_size,
                 kernel_size,
                 requires_grad=False,
+                generator=generator,
             ),
         )
         self.register_buffer(


Test patch:
diff --git a/tests/models/test_rcf.py b/tests/models/test_rcf.py
--- a/tests/models/test_rcf.py
+++ b/tests/models/test_rcf.py
@@ -35,3 +35,8 @@ def test_untrainable(self) -> None:
     def test_biases(self) -> None:
         model = RCF(features=24, bias=10)
         assert torch.all(model.biases == 10)  # type: ignore[attr-defined]
+
+    def test_seed(self) -> None:
+        weights1 = RCF(seed=1).weights
+        weights2 = RCF(seed=1).weights
+        assert torch.allclose(weights1, weights2)  # type: ignore[attr-defined]
Repository: microsoft/torchgeo

Issue:
Open in Colab URL broken in 0.1.1
The latest 0.1.1 release broke the "Open in Colab" URL in our tutorials. Still trying to fix this.


Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -118,7 +118,11 @@
 nbsphinx_prolog = """
 {% set colab = "https://colab.research.google.com" %}
 {% set repo = "microsoft/torchgeo" %}
-{% set branch = "main" %}
+{% if "dev" in env.config.release %}
+    {% set branch = "main" %}
+{% else %}
+    {% set branch = "releases/v" ~ env.config.version %}
+{% endif %}
 
 .. image:: {{ colab }}/assets/colab-badge.svg
    :class: colabbadge


Test patch:
Repository: microsoft/torchgeo

Issue:
detect_anomaly not supported for pytorch-lightning<1.5
Support for passing `detect_anomaly` (in `conf/defaults.yaml`) was added in pytorch-lightning 1.5 (Refer PyTorchLightning/pytorch-lightning#9848). For lower versions training will fail with 

```
Traceback (most recent call last):
  File "/home/ashwin/Desktop/Projects/torchgeo/train.py", line 226, in <module>
    main(conf)
  File "/home/ashwin/Desktop/Projects/torchgeo/train.py", line 196, in main
    trainer = pl.Trainer(**trainer_args)
  File "/home/ashwin/anaconda3/envs/torchgeo/lib/python3.9/site-packages/pytorch_lightning/trainer/connectors/env_vars_connector.py", line 40, in insert_env_defaults
    return fn(self, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'detect_anomaly'
```
So we either need to pin minimum version to 1.5 or remove this flag from `conf/defaults.yaml`.


Discussion:
@calebrob6 would you be opposed to simply removing `conf/defaults.yaml`? I think it's useful for documenting which values can be set, but it currently pins us to the latest version of pytorch-lightning if we don't want to ignore deprecation warnings.
Yeah we should definitely get rid of it
@ashnair1 want to submit a PR to do this? If not I'll get to it when working on #227.
I can do it. To clarify, the `conf/defaults.yaml` and any reference to it in `train.py` needs to be removed correct?
Yep!

Resolving patch:
diff --git a/train.py b/train.py
--- a/train.py
+++ b/train.py
@@ -91,12 +91,12 @@ def set_up_omegaconf() -> DictConfig:
 
     if "config_file" in command_line_conf:
         config_fn = command_line_conf.config_file
-        if os.path.isfile(config_fn):
-            user_conf = OmegaConf.load(config_fn)
-            conf = OmegaConf.merge(conf, user_conf)
-        else:
+        if not os.path.isfile(config_fn):
             raise FileNotFoundError(f"config_file={config_fn} is not a valid file")
 
+        user_conf = OmegaConf.load(config_fn)
+        conf = OmegaConf.merge(conf, user_conf)
+
     conf = OmegaConf.merge(  # Merge in any arguments passed via the command line
         conf, command_line_conf
     )
@@ -189,7 +189,7 @@ def main(conf: DictConfig) -> None:
     trainer_args["default_root_dir"] = experiment_dir
     trainer = pl.Trainer(**trainer_args)
 
-    if trainer_args["auto_lr_find"]:
+    if trainer_args.get("auto_lr_find"):
         trainer.tune(model=task, datamodule=datamodule)
 
     ######################################


Test patch: