This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example usage: | |
# python images_to_hf_parquet.py --input ./base_image_directory/ --output ./parquet_output_directory/ --samples_per_file 10000 | |
import pyarrow as pa | |
import pyarrow.parquet as pq | |
from PIL import Image | |
import os, io, json, glob, argparse | |
def save_table(image_data, table_number, output_path, zfill_amount): | |
print(f'Entries in table {table_number}: {len(image_data)}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jax | |
from jax import numpy as jnp | |
from flax import linen as nn | |
from typing import Any, Callable | |
def linear_attention( | |
query: jax.Array, | |
key: jax.Array, | |
value: jax.Array, | |
dtype: Any, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example usage: | |
# python make_crop_labels.py --input_path data/images --output_path --data/cropped_images --csv_path data/crops.csv | |
# Controls: | |
# scroll to change crop size, mouse to aim the crop, left click to crop image and move to next, x to skip to the next image. | |
# The script is pretty messy since I quickly hacked it together with little regard for quality, but it works. | |
import pygame | |
import argparse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run with: python data_filter.py --input_path <input path> --output_path <output path> | |
# Controls: z to copy image into output directory, x to skip to next image. | |
import pygame | |
import argparse | |
import shutil | |
import os | |
import argparse | |
def load_image(path): |