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

Issue:
Use of deprecated `np.float` results in crash when calling `pg.functions.colorDistance([])`
<!-- In the following, please describe your issue in detail! -->
<!-- If some sections do not apply, just remove them. -->

### Short description
Calling `pg.functions.colorDistance([])` raises an error when using numpy >= 1.20, because `np.float` is deprecated, see https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations.

### Code to reproduce

```python
import pyqtgraph as pg

pg.functions.colorDistance([])
```

### Expected behavior
return an empty array

### Real behavior

```
  File "...\pyqtgraph\functions.py", line 549, in colorDistance
    if len(colors) < 1: return np.array([], dtype=np.float)
  File "...\numpy\__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
```

### Tested environment(s)

 * PyQtGraph version: 0.13.4dev0
 * Qt Python binding: <!-- output of pyqtgraph.Qt.VERSION_INFO -->
 * Python version: PySide6 6.5.1 Qt 6.5.1
 * NumPy version: 1.24.3
 * Operating system: Windows
 * Installation method: conda environment (python 3.9.16) + `python -m pip install numpy scipy pyside6 -e . `

### Additional context



Discussion:

Resolving patch:
diff --git a/pyqtgraph/functions.py b/pyqtgraph/functions.py
--- a/pyqtgraph/functions.py
+++ b/pyqtgraph/functions.py
@@ -546,7 +546,7 @@ def colorDistance(colors, metric='CIE76'):
         The `N-1` sequential distances between `N` colors.
     """
     metric = metric.upper()
-    if len(colors) < 1: return np.array([], dtype=np.float)
+    if len(colors) < 1: return np.array([], dtype=float)
     if metric == 'CIE76':
         dist = []
         lab1 = None


Test patch:
diff --git a/tests/test_functions.py b/tests/test_functions.py
--- a/tests/test_functions.py
+++ b/tests/test_functions.py
@@ -400,3 +400,7 @@ def test_ndarray_from_qimage():
         qimg.fill(0)
         arr = pg.functions.ndarray_from_qimage(qimg)
         assert arr.shape == (h, w)
+
+def test_colorDistance():
+    pg.colorDistance([pg.Qt.QtGui.QColor(0,0,0), pg.Qt.QtGui.QColor(255,0,0)])
+    pg.colorDistance([])
Repository: pyqtgraph/pyqtgraph

Issue:
Bug (?) from #2041
This new pattern in ``PlotCurveItem.setPen``, ``PlotCurveItem.setBrush``, and others has caused a number of breaks for me:

https://github.com/pyqtgraph/pyqtgraph/blob/4e350d03ac2007c47cbfcca9d3b77a6a2a638e5c/pyqtgraph/graphicsItems/PlotCurveItem.py#L373-L380

I believe it would be safer as

```python
if args and args[0] is None:
    self.opts['pen'] = None
```

As for now, I've had to change all my calls to give the color as a plain argument rather than keyword, which is fine, but inconsistent with the [docs for mkPen](https://pyqtgraph.readthedocs.io/en/latest/style.html#line-fill-and-color).


Discussion:

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/PlotCurveItem.py b/pyqtgraph/graphicsItems/PlotCurveItem.py
--- a/pyqtgraph/graphicsItems/PlotCurveItem.py
+++ b/pyqtgraph/graphicsItems/PlotCurveItem.py
@@ -371,7 +371,7 @@ def invalidateBounds(self):
 
     def setPen(self, *args, **kargs):
         """Set the pen used to draw the curve."""
-        if args[0] is None:
+        if args and args[0] is None:
             self.opts['pen'] = None
         else:
             self.opts['pen'] = fn.mkPen(*args, **kargs)
@@ -385,7 +385,7 @@ def setShadowPen(self, *args, **kargs):
         pen to be visible. Arguments are passed to 
         :func:`mkPen <pyqtgraph.mkPen>`
         """
-        if args[0] is None:
+        if args and args[0] is None:
             self.opts['shadowPen'] = None
         else:
             self.opts['shadowPen'] = fn.mkPen(*args, **kargs)
@@ -397,7 +397,7 @@ def setBrush(self, *args, **kargs):
         Sets the brush used when filling the area under the curve. All 
         arguments are passed to :func:`mkBrush <pyqtgraph.mkBrush>`.
         """
-        if args[0] is None:
+        if args and args[0] is None:
             self.opts['brush'] = None
         else:
             self.opts['brush'] = fn.mkBrush(*args, **kargs)
diff --git a/pyqtgraph/graphicsItems/PlotDataItem.py b/pyqtgraph/graphicsItems/PlotDataItem.py
--- a/pyqtgraph/graphicsItems/PlotDataItem.py
+++ b/pyqtgraph/graphicsItems/PlotDataItem.py
@@ -504,7 +504,7 @@ def setShadowPen(self, *args, **kargs):
         The argument can be a :class:`QtGui.QPen` or any combination of arguments accepted by 
         :func:`pyqtgraph.mkPen() <pyqtgraph.mkPen>`.
         """
-        if args[0] is None:
+        if args and args[0] is None:
             pen = None
         else:
             pen = fn.mkPen(*args, **kargs)
@@ -519,7 +519,7 @@ def setFillBrush(self, *args, **kargs):
         Sets the :class:`QtGui.QBrush` used to fill the area under the curve.
         See :func:`mkBrush() <pyqtgraph.mkBrush>`) for arguments.
         """
-        if args[0] is None:
+        if args and args[0] is None:
             brush = None
         else:
             brush = fn.mkBrush(*args, **kargs)


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
Python 3.12 `DeprecationWarning`: `datetime.datetime.utcfromtimestamp()`
On Python 3.12, I get
> E   DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
Python 3.12 `DeprecationWarning`: `datetime.datetime.utcfromtimestamp()`
On Python 3.12, I get
> E   DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).


Discussion:

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/DateAxisItem.py b/pyqtgraph/graphicsItems/DateAxisItem.py
--- a/pyqtgraph/graphicsItems/DateAxisItem.py
+++ b/pyqtgraph/graphicsItems/DateAxisItem.py
@@ -1,7 +1,7 @@
 import sys
 import time
 from collections import OrderedDict
-from datetime import datetime, timedelta
+from datetime import datetime, timedelta, timezone
 
 import numpy as np
 
@@ -19,11 +19,12 @@
 YEAR_SPACING = 365 * DAY_SPACING
 
 if sys.platform == 'win32':
-    _epoch = datetime.utcfromtimestamp(0)
+    _epoch = datetime.fromtimestamp(0, timezone.utc)
     def utcfromtimestamp(timestamp):
         return _epoch + timedelta(seconds=timestamp)
 else:
-    utcfromtimestamp = datetime.utcfromtimestamp
+    def utcfromtimestamp(timestamp):
+        return datetime.fromtimestamp(timestamp, timezone.utc)
 
 MIN_REGULAR_TIMESTAMP = (datetime(1, 1, 1) - datetime(1970,1,1)).total_seconds()
 MAX_REGULAR_TIMESTAMP = (datetime(9999, 1, 1) - datetime(1970,1,1)).total_seconds()


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
Changed exportDialog
This pull request fixes #2367. The code has been changed as it was suggested in the issue.

![image](https://user-images.githubusercontent.com/79045568/198548982-d69eeda1-6868-4c29-9ce5-337f6b33352c.png)





Discussion:
This LGTM, thanks for the PR @aksy2512 !

Merging

Resolving patch:
diff --git a/pyqtgraph/GraphicsScene/exportDialog.py b/pyqtgraph/GraphicsScene/exportDialog.py
--- a/pyqtgraph/GraphicsScene/exportDialog.py
+++ b/pyqtgraph/GraphicsScene/exportDialog.py
@@ -51,10 +51,11 @@ def show(self, item=None):
         self.selectBox.setVisible(True)
         if not self.shown:
             self.shown = True
-            vcenter = self.scene.getViewWidget().geometry().center()
-            x = max(0, int(vcenter.x() - self.width() / 2))
-            y = max(0, int(vcenter.y() - self.height() / 2))
-            self.move(x, y)
+            screen = QtWidgets.QApplication.desktop().screenNumber(QtWidgets.QApplication.desktop().cursor().pos())
+            centre = QtWidgets.QDesktopWidget().availableGeometry(screen).center()
+            frame = self.frameGeometry()
+            frame.moveCenter(centre)
+            self.move(frame.topLeft())
         
     def updateItemList(self, select=None):
         self.ui.itemTree.clear()


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
Can't add menu item to non-removable ROI
### Short description
I'd like to be able to add a context menu item to an ROI object. In my specific case, so that I can add a change colour action. I expected to be able to add a new item to the existing menu, so that I get the nice benefits of the hierarchical menus. But the ROI menu is tied to it being `removable`.


### Code to reproduce
So I would like this to give me a menu with "Test", but not "Remove ROI"
```python
import numpy as np
import pyqtgraph as pg
from pyqtgraph.Qt import QtWidgets

app = pg.mkQApp("ImageView Example")
win = pg.GraphicsView()
view = pg.ViewBox()
win.setCentralItem(view)
img = pg.ImageItem(np.zeros((100,100)))
view.addItem(img)
win.show()

roi = pg.ROI((10,10), (50,50), removable=False)
view.addItem(roi)

menu = roi.getMenu()
menu.addAction("Test")

if __name__ == '__main__':
    pg.exec()
```

If I set `removable=True` I get
![removable](https://github.com/pyqtgraph/pyqtgraph/assets/1113988/6e335c0e-b21d-490d-b558-abfd7308ff75)
otherwise I get no context menu for the ROI

### Expected behavior
Context menu with new item

### Real behavior
No context menu

### Tested environment(s)

 * PyQtGraph version: Current master '0.13.4.dev0'
 * Qt Python binding: PyQt5 5.15.10 Qt 5.15.2
 * Python version: 3.12.1
 * NumPy version: 1.26.4
 * Operating system: Fedora 39 
 * Installation method: running from git, also with conda

### Additional context



Discussion:

Resolving patch:
diff --git a/pyqtgraph/graphicsItems/ROI.py b/pyqtgraph/graphicsItems/ROI.py
--- a/pyqtgraph/graphicsItems/ROI.py
+++ b/pyqtgraph/graphicsItems/ROI.py
@@ -762,8 +762,8 @@ def _makePen(self):
             return self.pen
 
     def contextMenuEnabled(self):
-        return self.removable
-    
+        return self.removable or self.menu and len(self.menu.children()) > 1
+
     def raiseContextMenu(self, ev):
         if not self.contextMenuEnabled():
             return
@@ -776,13 +776,11 @@ def getMenu(self):
         if self.menu is None:
             self.menu = QtWidgets.QMenu()
             self.menu.setTitle(translate("ROI", "ROI"))
-            remAct = QtGui.QAction(translate("ROI", "Remove ROI"), self.menu)
-            remAct.triggered.connect(self.removeClicked)
-            self.menu.addAction(remAct)
-            self.menu.remAct = remAct
-        # ROI menu may be requested when showing the handle context menu, so
-        # return the menu but disable it if the ROI isn't removable
-        self.menu.setEnabled(self.contextMenuEnabled())
+            if self.removable:
+                remAct = QtGui.QAction(translate("ROI", "Remove ROI"), self.menu)
+                remAct.triggered.connect(self.removeClicked)
+                self.menu.addAction(remAct)
+                self.menu.remAct = remAct
         return self.menu
 
     def removeClicked(self):


Test patch:
Repository: pyqtgraph/pyqtgraph

Issue:
SyntaxWarnings
While running an `apt upgrade` I noticed:

```
/usr/lib/python3/dist-packages/pyqtgraph/examples/SpinBox.py:38: SyntaxWarning: invalid escape sequence '\$'
  regex='\$?(?P<number>(-?\d+(\.\d+)?)|(-?\.\d+))$')),
```

The `\$` should be written `\\$` or `r'\$'` since a few Python releases (same for all backslash escape that have no meanings). I don't have the time to search for other occurrences of this fact, but running the tests with `PYTHONDEVMODE=1` should help spotting them :)


Discussion:
Hi i want to look into it 


Resolving patch:
diff --git a/pyqtgraph/examples/SpinBox.py b/pyqtgraph/examples/SpinBox.py
--- a/pyqtgraph/examples/SpinBox.py
+++ b/pyqtgraph/examples/SpinBox.py
@@ -35,7 +35,7 @@
      pg.SpinBox(value=1e9, siPrefix=True)),
     ("Float with custom formatting", 
      pg.SpinBox(value=23.07, format='${value:0.02f}',
-                regex='\$?(?P<number>(-?\d+(\.\d+)?)|(-?\.\d+))$')),
+                regex = r'\$?(?P<number>(-?\d+(\.\d+)?)|(-?\.\d+))$')),
     ("Int with suffix",
      pg.SpinBox(value=999, step=1, int=True, suffix="V")),
     ("Int with custom formatting", 


Test patch:
Repository: Lightning-Universe/lightning-flash

Issue:
FilePathDataset is giving wrong labels.
https://github.com/PyTorchLightning/lightning-flash/blob/da6b6376dffe7e647782595f467450fbd9310f9d/flash/vision/classification/data.py#L68

The current implementation of FilepathDataset is giving wrong labels. It is creating a unique label for each file. 


Discussion:

Resolving patch:
diff --git a/flash/vision/classification/data.py b/flash/vision/classification/data.py
--- a/flash/vision/classification/data.py
+++ b/flash/vision/classification/data.py
@@ -56,7 +56,7 @@ def __init__(
         self.transform = transform
         self.loader = loader
         if self.has_labels:
-            self.label_to_class_mapping = {v: k for k, v in enumerate(list(sorted(list(set(self.fnames)))))}
+            self.label_to_class_mapping = dict(map(reversed, enumerate(sorted(set(self.labels)))))
 
     @property
     def has_labels(self) -> bool:
@@ -70,7 +70,8 @@ def __getitem__(self, index: int) -> Tuple[Any, Optional[int]]:
         img = self.loader(filename)
         label = None
         if self.has_labels:
-            label = self.label_to_class_mapping[filename]
+            label = self.labels[index]
+            label = self.label_to_class_mapping[label]
         return img, label
 
 


Test patch:
Repository: Lightning-Universe/lightning-flash

Issue:
FilePathDataset does not apply transform to image.
## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

### To Reproduce

Steps to reproduce the behavior:

1. Go to '...'
2. Run '....'
3. Scroll down to '....'
4. See error

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->


#### Code sample
<!-- Ideally attach a minimal code sample to reproduce the decried issue.
Minimal means having the shortest code but still preserving the bug. -->

### Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

### Environment

 - PyTorch Version (e.g., 1.0):
 - OS (e.g., Linux):
 - How you installed PyTorch (`conda`, `pip`, source):
 - Build command you used (if compiling from source):
 - Python version:
 - CUDA/cuDNN version:
 - GPU models and configuration:
 - Any other relevant information:

### Additional context

<!-- Add any other context about the problem here. -->



Discussion:

Resolving patch:
diff --git a/flash/vision/classification/data.py b/flash/vision/classification/data.py
--- a/flash/vision/classification/data.py
+++ b/flash/vision/classification/data.py
@@ -68,6 +68,8 @@ def __len__(self) -> int:
     def __getitem__(self, index: int) -> Tuple[Any, Optional[int]]:
         filename = self.fnames[index]
         img = self.loader(filename)
+        if self.transform is not None:
+            img = self.transform(img)
         label = None
         if self.has_labels:
             label = self.labels[index]


Test patch:
Repository: Lightning-Universe/lightning-flash

Issue:
Download Data Fails if Content Length Not Defined in Header
## 🐛 Bug

When I try to download a zip file using download_data from flash.core.data it fails because the response header does not contain a value for 'Content Length' this should be check for and handled in the code. 

### To Reproduce

Steps to reproduce the behavior:

KeyError                                  Traceback (most recent call last)
<ipython-input-7-aa10e89f3a8e> in <module>()
      1 # 1. Download the data
----> 2 download_data("https://github.com/karoldvl/ESC-50/archive/master.zip", 'data/')

2 frames
/content/gdrive/MyDrive/lightning-flash/flash/core/data/utils.py in download_data(url, path)
     75 
     76     """
---> 77     download_file(url, path)
     78 
     79 

/content/gdrive/MyDrive/lightning-flash/flash/core/data/utils.py in download_file(url, path, verbose)
     36     local_filename = os.path.join(path, url.split('/')[-1])
     37     r = requests.get(url, stream=True)
---> 38     file_size = int(r.headers['Content-Length'])
     39     chunk = 1
     40     chunk_size = 1024

/usr/local/lib/python3.6/dist-packages/requests/structures.py in __getitem__(self, key)
     52 
     53     def __getitem__(self, key):
---> 54         return self._store[key.lower()][1]
     55 
     56     def __delitem__(self, key):

KeyError: 'content-length'
<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->


#### Code sample
<!-- Ideally attach a minimal code sample to reproduce the decried issue.
Minimal means having the shortest code but still preserving the bug. -->

```python
import flash
from flash.core.data import download_data
download_data("https://github.com/karoldvl/ESC-50/archive/master.zip", 'data/')
```

### Expected behavior

File downloads and extracts ESC-50 data into datasets folder

### Environment

Default Collab Configuration 

### Additional context

<!-- Add any other context about the problem here. -->



Discussion:

Resolving patch:
diff --git a/flash/core/data/utils.py b/flash/core/data/utils.py
--- a/flash/core/data/utils.py
+++ b/flash/core/data/utils.py
@@ -35,7 +35,7 @@ def download_file(url: str, path: str, verbose: bool = False) -> None:
         os.makedirs(path)
     local_filename = os.path.join(path, url.split('/')[-1])
     r = requests.get(url, stream=True)
-    file_size = int(r.headers['Content-Length'])
+    file_size = int(r.headers['Content-Length']) if 'Content-Length' in r.headers else 0
     chunk = 1
     chunk_size = 1024
     num_bars = int(file_size / chunk_size)


Test patch:
Repository: Lightning-Universe/lightning-flash

Issue:
Cannot import name 'PY3' with Pytorch 1.8
## 🐛 Bug

I get the following error after a fresh install (which install pytorch 1.8) and  try to run the image classification example.

`ImportError: cannot import name 'PY3' from 'torch._six'` 

It turns out that installing 1.7.1 the script seems to work as expected - so some dependency in pytorch 1.8 make this to happen.

### To Reproduce

Steps to reproduce the behavior:

After creating a fresh venv
```bash
git clone https://github.com/PyTorchLightning/lightning-flash.git
cd lightning-flash
pip install -e .
python flash_examples/finetuning/image_classification.py
```

This is the full error message: https://pastebin.com/4xEtr5tv


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
@@ -138,7 +138,7 @@ def _package_list_from_file(pfile):
     'Pillow': 'PIL',
     'PyYAML': 'yaml',
     'rouge-score': 'rouge_score',
-    'pytorch-lightning-bolts': 'pl_bolts',
+    'lightning-bolts': 'pl_bolts',
     'pytorch-tabnet': 'pytorch_tabnet',
 }
 MOCK_PACKAGES = []
diff --git a/flash/vision/detection/model.py b/flash/vision/detection/model.py
--- a/flash/vision/detection/model.py
+++ b/flash/vision/detection/model.py
@@ -46,7 +46,7 @@ def _evaluate_iou(target, pred):
 class ObjectDetector(Task):
     """Object detection task
 
-    Ref: Lightning Bolts https://github.com/PyTorchLightning/pytorch-lightning-bolts
+    Ref: Lightning Bolts https://github.com/PyTorchLightning/lightning-bolts
 
     Args:
         num_classes: the number of classes for detection, including background
diff --git a/flash_examples/predict/image_embedder.py b/flash_examples/predict/image_embedder.py
--- a/flash_examples/predict/image_embedder.py
+++ b/flash_examples/predict/image_embedder.py
@@ -20,7 +20,7 @@
 download_data("https://pl-flash-data.s3.amazonaws.com/hymenoptera_data.zip", "data/")
 
 # 2. Create an ImageEmbedder with swav trained on imagenet.
-# Check out SWAV: https://pytorch-lightning-bolts.readthedocs.io/en/latest/self_supervised_models.html#swav
+# Check out SWAV: https://lightning-bolts.readthedocs.io/en/latest/self_supervised_models.html#swav
 embedder = ImageEmbedder(backbone="swav-imagenet", embedding_dim=128)
 
 # 3. Generate an embedding from an image path.


Test patch:
Repository: Lightning-Universe/lightning-flash

Issue:
NLTK being loaded on image classifcation
## 🐛 Bug

<!-- A clear and concise description of what the bug is. -->

### To Reproduce


```python
from flash.data import labels_from_csv
from flash.vision import ImageClassificationData
from flash.vision import ImageClassifier
from flash import Trainer
```
<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

[nltk_data] Error loading punkt: <urlopen error [Errno -3] Temporary
[nltk_data]     failure in name resolution>




Discussion:
@aribornstein can you paste the error? and explain intended behaviour?
The error is already pasted 

```
[nltk_data] Error loading punkt: <urlopen error [Errno -3] Temporary
[nltk_data] failure in name resolution>
```

If I'm not using a NLP Task it makes no sense to load NLTK.
I would like to fix this.
Hi @aribornstein, since `__init__.py` of flash imports all the modules, the `text` module is also imported and ```nltk.download("punkt", quiet=True)``` is executed. This download should happen only when someone uses the library for the first time.

https://github.com/PyTorchLightning/lightning-flash/blob/202717d888fccb934dcc4507d22542d7cf71de96/flash/text/seq2seq/summarization/utils.py#L21
Is there a way to only load if using the task?
@edenlightning one thing I've been noticing is that some tasks like ImageClassification have pretrained weights set to True by default. Not sure if this can be related but the underlying libraries providing the backbones like torchvision have it to False I guess to avoid auto-downloading issues.
@aniketmaurya Would you like to do a PR for this?
Yes @kaushikb11 I'd love to add a PR for this.

Resolving patch:
diff --git a/flash/text/seq2seq/summarization/metric.py b/flash/text/seq2seq/summarization/metric.py
--- a/flash/text/seq2seq/summarization/metric.py
+++ b/flash/text/seq2seq/summarization/metric.py
@@ -19,7 +19,7 @@
 from torch import tensor
 from torchmetrics import Metric
 
-from flash.text.seq2seq.summarization.utils import add_newline_to_end_of_each_sentence
+from flash.text.seq2seq import summarization
 
 
 class RougeMetric(Metric):
@@ -67,8 +67,8 @@ def update(self, pred_lns: List[str], tgt_lns: List[str]):
         for pred, tgt in zip(pred_lns, tgt_lns):
             # rougeLsum expects "\n" separated sentences within a summary
             if self.rouge_newline_sep:
-                pred = add_newline_to_end_of_each_sentence(pred)
-                tgt = add_newline_to_end_of_each_sentence(tgt)
+                pred = summarization.utils.add_newline_to_end_of_each_sentence(pred)
+                tgt = summarization.utils.add_newline_to_end_of_each_sentence(tgt)
             results = self.scorer.score(pred, tgt)
             for key, score in results.items():
                 score = tensor([score.precision, score.recall, score.fmeasure])


Test patch: