Aditya Sridhar

Upstream

Open source

Fixes in the libraries I use: 5 merged so far in kornia, timm and Haystack. Each one starts from a reproduction and ships with a test that fails without the fix.

Merged

5 pull requests

kornia/kornia11k starsOct 2026

Merged

Keep focal_loss gradients finite for fractional gamma #5563

Bug
With 0 < γ < 1, (1 − p)^γ has an infinite derivative at p = 1. As soon as a softmax probability saturated, the chain rule multiplied that infinity by zero and every logit of the pixel got a NaN gradient, including when the saturated class was the wrong one.
Fix
The double-where pattern: saturated entries take their value from a detached copy and their gradient from a safe base, so forward values are unchanged and the gradient becomes its true limit, 0. Clamp was avoided because its derivative at the bound differs across torch versions.
Test
Saturated rows on the correct and the wrong class, γ in {0, 0.25, 0.5, 0.75, 1, 2}, every reduction: loss and gradient must match the γ = 0 case. Plus a torch.compile vs eager check.

kornia/kornia11k starsOct 2026

Merged

Weight the dice_loss micro intersection once #5564

Bug
In micro averaging, the class weight was applied to both the scores and the one-hot target, so it entered the intersection squared. A perfect prediction with weight [2, 2, 2] scored −0.999998 instead of 0.
Fix
Pair the weighted scores with the unweighted target in the intersection; keep both weighted in the cardinality. Unweighted and macro losses are unchanged. Merged as a breaking change, since results move for weighted users.
Test
A uniform weight must equal no weight for both averages; weights [1, 2, 3] are checked against the weighted Dice computed directly. An existing test that had encoded the squared weight was corrected.

deepset-ai/haystack26k starsOct 2026

Merged

Write EvaluationRunResult CSV reports as UTF-8 #13143

Bug
The CSV writer used the locale encoding. On Windows that is cp1252, so evaluation data in Japanese, Chinese or Greek stopped the report halfway with a charmap error, and accented text was written as mojibake.
Fix
Pass encoding="utf-8" in the one writer that all three report types go through.
Test
Patches open to default to cp1252, so the bug reproduces on Linux CI, then writes a Spanish and Japanese report and reads it back as UTF-8.

huggingface/pytorch-image-models37k starsOct 2026

Merged

Read class map .txt and write hub README as UTF-8 #2839

Bug
On Windows a UTF-8 class map was decoded as cp1252, so non-ASCII class names (café) no longer matched their folders and those images were silently dropped from the dataset. The generated model card had the same problem on upload.
Fix
encoding="utf-8" on both reads and writes. A two-line change; the reproduction was the work.
Test
Builds a two-folder dataset with a non-ASCII class under a cp1252 default. Without the fix it finds one class instead of two.

kornia/kornia11k starsOct 2026

Merged

Filter integer images in float32 #5669

Bug
Integer images cast kernels and sigma to their own dtype: a uint8 Gaussian blur returned all zeros, box sums wrapped mod 256, and bilateral differences wrapped (10 − 250 = 16).
Fix
Following the maintainers' convention, integer and bool inputs are promoted to float32 before any kernel is cast, across nine filtering functions.
Test
Seven tests that documented the defect became convention tests against the same call on image.float(); they now run on MPS too.

In review

status checked 10 Oct 2026

qdrant/fastembed3k starsOct 2026

In review

Read model text files as UTF-8 regardless of platform locale #786

Bug
BM25 with Russian, Greek or Arabic stopwords failed to load on Windows; German and French loaded with every accented stopword garbled, so they were never filtered.
Fix
encoding="utf-8" on all 15 text-mode open() calls in the package.
Test
Stopwords in five languages, vocab round trips and special tokens with ▁; the project's Windows CI guards it.

qdrant/fastembed3k starsOct 2026

In review

Unit tests for the image transform helpers #785

Bug
Padding, cropping, resizing and tiling helpers used by Jina CLIP and Idefics3 were only exercised through model tests that download weights.
Fix
Pins their behaviour against the reference implementation in transformers.
Test
Coverage of functional.py 57% → 82%, operators.py 43% → 62%.

dottxt-ai/outlines16k starsOct 2026

In review

Read grammar and JSON schema files as UTF-8 #2067

Bug
A UTF-8 JSON schema with "café" was read as "café" on Windows, so generation was constrained to the mojibake string, without any error.
Fix
encoding="utf-8" in the three file readers.
Test
Writes UTF-8 files under a cp1252 default so the failure reproduces on Linux CI.

stanfordnlp/dspy38k starsOct 2026

In review

Build the subprocess PYTHONPATH with os.pathsep #10589

Bug
A test joined paths with ":", which Windows reads as part of C:\, so the child process could not find the test module.
Fix
os.pathsep.
Test
All 33 tests in the file pass on Windows 11.