Skip to content

Instantly share code, notes, and snippets.

View davipatti's full-sized avatar

David Pattinson davipatti

View GitHub Profile
~/g/grounding-dino-tiny-ONNX[1]►imxconv-pt -i grounding-dino-tiny-ONNX/onnx/model.onnx -o imx500-conversion ghog-env 1.002s 08:22
2025-03-14 08:22:54,326 INFO : Running version 1.10.0 [~/.virtualenvs/ghog-env/lib/python3.10/site-packages/uni/common/logger.py:148]
2025-03-14 08:22:54,326 INFO : Converting grounding-dino-tiny-ONNX/onnx/model.onnx [~/.virtualenvs/ghog-env/lib/python3.10/site-packages/uni/common/logger.py:148]
2025-03-14 08:22:57,705 ERROR : CODE: [EXEC] 'NoneType' object cannot be interpreted as an integer [~/.virtualenvs/ghog-env/lib/python3.10/site-packages/uni/common/logger.py:160]
Traceback (most recent call last):
File "~/.virtualenvs/ghog-env/lib/python3.10/site-packages/uni/common/main.py", line 143, in execute
g, metadata = self.convert_model(args.input_path, vis_dir)
File "~/.virtualenvs/ghog-env/lib/python3.10/site-packages/uni/common/main.py", line 61, in convert_model
parser = self.get_parser(model_path, vis_dir)
RuleException:
CalledProcessError in file /home/babujee/milkviruses_92224/workflow/irma.smk, line 239:
Command 'set -euo pipefail; cat > results/primary/seq/milkvirus4_S4_combined/aa.fasta' died with <Signals.SIGINT: 2>.
File "/home/babujee/milkviruses_92224/workflow/irma.smk", line 239, in __rule_concat_segment_aa
File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
RuleException:
CalledProcessError in file /home/babujee/milkviruses_92224/workflow/irma.smk, line 250:
Command 'set -euo pipefail; cat > results/primary/seq/milkvirus4_S4_combined/nt.fasta' died with <Signals.SIGINT: 2>.
File "/home/babujee/milkviruses_92224/workflow/irma.smk", line 250, in __rule_concat_segment_nt
File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
@davipatti
davipatti / gist:f42772a6a1c38fd72fa49ba17616b2b7
Created November 25, 2024 14:40
Python datrie installation failure
Building wheels for collected packages: connection-pool, datrie
Building wheel for connection-pool (setup.py) ... done
Created wheel for connection-pool: filename=connection_pool-0.0.3-py3-none-any.whl size=4062 sha256=3e72f96c62dc89f5af94648812515626414f510305e2ee911aadc70999a2f8fc
Stored in directory: /home/babujee/.cache/pip/wheels/c6/4e/3d/7d5324ada36b1473e54d32916a8f70b90b62c9f2fedc9fd8c9
Building wheel for datrie (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for datrie (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [44 lines of output]
@davipatti
davipatti / pymc-ordered-distributions.ipynb
Created August 27, 2024 20:20
Investigating the behaviour of pymc.distributions.transforms.ordered
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davipatti
davipatti / find_maximal_subsets.py
Created August 14, 2024 16:43
Find maximal subsets
#!/usr/bin/env python3
from collections import defaultdict
from itertools import chain
def find_maximal_subsets(sets: list[set]) -> set[frozenset]:
"""
Find the maximal subsets of items that always appear together in a group of sets.
@davipatti
davipatti / mean-set-containment.py
Created August 14, 2024 13:27
[mean set containment] What is the probability a set of size N contains its mean?
#!/usr/bin/env python3
import random
import matplotlib.pyplot as plt
numbers = tuple(range(100))
def trial(N: int) -> bool:
S = random.choices(numbers, k=N)
@davipatti
davipatti / assign_coords.py
Last active August 2, 2024 18:41
[Rename coordinates using assign_coords] How to rename coordinates in an xarray dataset #pymc #arviz #xarray
def rename_coordinates(dataset: "xarray.Dataset", dim: str, mapping: dict[str, str]) -> "xarray.Dataset":
return dataset.assign_coords(**{dim: [mapping[k] for k in dataset.coords[dim].values]})
@davipatti
davipatti / prior-dists-dont-need-to-resemble-the-posterior.ipynb
Created November 7, 2023 19:21
[Bayesian prior distributions don't need to look like what you think the posterior distribution will look like]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@davipatti
davipatti / matplotlib-transforms.py
Last active September 20, 2023 20:54
[Useful matplotlib transforms] #matplotlib
import matplotlib.pyplot as plt
ax = plt.gca()
axis_to_data = ax.transAxes + ax.transData.inverted()
data_to_axis = axis_to_data.inverted()
@davipatti
davipatti / aesara-test.py
Last active June 2, 2023 20:33
[aesara scan IndexError] Using aesara.scan to make values 0 if any three preceding values in a column are non-zero. Output is as expected, but errors are logged, and IndexError gets raised. #aesara
import aesara as ae
import numpy as np
print("aesara version", ae.__version__)
np.random.seed(42)
m, n = 10, 12
arr = np.random.choice([0, 1], p=[0.75, 0.25], size=m * n).reshape(m, n)
print("\ninput:")