Skip to content

Instantly share code, notes, and snippets.

View segeljakt's full-sized avatar

Klas Segeljakt segeljakt

View GitHub Profile
@segeljakt
segeljakt / cat-repo.sh
Created November 15, 2025 16:56
A script for printing code. This relies on the `fd` command in Rust:
#!/bin/bash
while [ "$#" -gt 0 ]; do
case "$1" in
--include-tests)
INCLUDE_TESTS=1
;;
--include-docs)
INCLUDE_DOCS=1
;;
  1. Get an API key from https://aistudio.google.com/apikey
  2. Place ask-gemini.sh at .claude/ask-gemini.sh
  3. Place ask-gemini.md at .claude/commands/ask-gemini.sh
  4. In claude, type something like /ask-gemini Are there any bugs in this code base?
@segeljakt
segeljakt / output
Last active January 2, 2025 13:19
AMD_LOG_LEVEL=5
srun: Setting --cpu-bind=threads as a default of --threads-per-core use
srun: Following options are mutually exclusive with --hint: --ntasks-per-core, --threads-per-core, -B and --cpu-bind, but more than one set by environment variables. Ignoring SLURM_HINT.
srun: defined options
srun: -------------------- --------------------
srun: (null) : nid006341
srun: cpus-per-task : 1
srun: gpus-per-task : 1
srun: jobid : 8963660
srun: job-name : AISPECS
srun: mem : 64G
This file has been truncated, but you can view the full file.
srun: Setting --cpu-bind=threads as a default of --threads-per-core use
srun: Following options are mutually exclusive with --hint: --ntasks-per-core, --threads-per-core, -B and --cpu-bind, but more than one set by environment variables. Ignoring SLURM_HINT.
srun: defined options
srun: -------------------- --------------------
srun: (null) : nid005145
srun: cpus-per-task : 1
srun: gpus-per-task : 1
srun: jobid : 8963150
srun: job-name : AISPECS
srun: mem : 64G
@segeljakt
segeljakt / AMD_SERIALIZE_KERNEL=3
Last active December 30, 2024 16:48
Additional info
srun: Setting --cpu-bind=threads as a default of --threads-per-core use
srun: Following options are mutually exclusive with --hint: --ntasks-per-core, --threads-per-core, -B and --cpu-bind, but more than one set by environment variables. Ignoring SLURM_HINT.
srun: defined options
srun: -------------------- --------------------
srun: (null) : nid005143
srun: cpus-per-task : 1
srun: gpus-per-task : 1
srun: jobid : 8934799
srun: job-name : AISPECS
srun: mem : 64G
use anyhow::{Error, Result};
use candle::{DType, Device, Tensor};
use candle_nn::VarBuilder;
use candle_transformers::generation::{LogitsProcessor, Sampling};
use candle_transformers::models::llama::Cache;
use candle_transformers::models::llama::Llama;
use candle_transformers::models::llama::LlamaConfig;
use candle_transformers::models::llama::LlamaEosToks;
use hf_hub::{api::sync::Api, Repo, RepoType};
use tokenizers::Tokenizer;
(datatype Expr
; Arithmetic
(Num i64)
(Add Expr Expr :cost 1)
(Sub Expr Expr)
(Mul Expr Expr :cost 10)
(Div Expr Expr)
(Pow Expr Expr)
(Mod Expr Expr)
(Log10 Expr)
(datatype Expr
; Arithmetic
(Num i64)
(Add Expr Expr)
(Var String)
(Let String Expr Expr))
(function path (Expr Expr) i64 :merge (min old new))
(function edge (Expr Expr) i64 :merge (min old new))
@segeljakt
segeljakt / Cargo.toml
Last active November 11, 2023 22:47
deserialize-bids-file
[package]
name = "csv-bids-deserializer"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
tokio = { version = "1.34.0", features = ["full"] }
serde = { version = "1.0.192", features = ["derive"] }
import torch
import onnxruntime as ort
from PIL import Image
import numpy as np
import torchvision.transforms as transforms
from torchvision.transforms.functional import InterpolationMode
import json
import urllib.request
from PIL import ImageOps