Skip to content

Instantly share code, notes, and snippets.

View ischlag's full-sized avatar

Imanol Schlag ischlag

View GitHub Profile
@ischlag
ischlag / swiltra_split_repro.py
Created July 29, 2026 18:41
Repro: SwissDecisionSummaryTranslations test split is 1975-1982 due to constant-key unstable sort (JoelNiklaus/SwissLegalTranslations#1)
"""Reproduce the SwissDecisionSummaryTranslations val/test split bug.
The released headnote test split (2,000 BGEs) is almost entirely BGE volumes
101-108 (1975-1982) instead of the recency-based split described in the
SwiLTra-Bench paper. Cause: at the code state that generated the data
(JoelNiklaus/SwissLegalTranslations @ 761fc5c8, 2024-11-21), get_split_cols
sorted twice:
df = df.sort_values(by='year', ascending=False) # intended recency
...
import tensorflow as tf
import numpy as np
import random
import time
from tensorflow.python.framework import ops
from tensorflow.python.framework import dtypes
dataset_path = "/cs/home/is59/database/"
train_labels_file = "labels.csv"
import tensorflow as tf
import numpy as np
import random
import time
from tensorflow.python.framework import ops
from tensorflow.python.framework import dtypes
dataset_path = "/cs/home/is59/database/"
train_labels_file = "labels.csv"
@ischlag
ischlag / mnist-to-jpg.py
Last active January 23, 2024 06:45
Simple python script which takes the mnist data from tensorflow and builds a data set based on jpg files and text files containing the image paths and labels. Parts of it are from the mnist tensorflow example.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gzip
import os
import sys
import time
from six.moves import urllib