This file contains hidden or 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
| #!/usr/bin/env bash | |
| set -euo pipefail | |
| files=( | |
| "./path/to/yourfile.json" | |
| ".another/path/to/another/file.json" | |
| "./toplevelfile.json" | |
| ) | |
| for f in "${files[@]}"; do |
This file contains hidden or 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 random | |
| import matplotlib.pyplot as plt | |
| def choose_from(size: int) -> int: | |
| start, end = 0, size | |
| dst = size | |
| while dst > 1: | |
| if random.getrandbits(1): | |
| start += dst // 2 # choose rhs | |
| else: |
This file contains hidden or 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
| def euclidean_algorithm(a: int, b: int, verbose: bool = False) -> int: | |
| if a < b: | |
| a, b = b, a | |
| while True: | |
| a, b = b, a % b | |
| if not b: | |
| return a | |
| if verbose: | |
| print(f"{(a, b) = }") |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| for i in $(seq -f "%03g" 86 108); do | |
| file="/mnt/scratch-artemis/anilkeshwani/mls/shards/mls-transcripts_uroman_${i}.jsonl" | |
| echo "Launching ${file}" | |
| tmux new-window -d -t mls -n "align_and_hubert_mls_$i" -- bash -c " | |
| srun --partition a6000 --time=04:00:00 --qos=gpu-long --gres=gpu:1 \ | |
| /mnt/scratch-artemis/anilkeshwani/miniconda3/envs/sardalign/bin/python /mnt/scratch-artemis/anilkeshwani/speech-text-alignment/scripts/align_and_hubert_encode.py \ | |
| --jsonl \"${file}\" \ | |
| --ids-not-paths \ |
This file contains hidden or 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 random | |
| import string | |
| import timeit | |
| from collections import defaultdict | |
| # Generate a random list of words (simulating a corpus) | |
| random.seed(42) | |
| words = ["".join(random.choices(string.ascii_lowercase, k=5)) for _ in range(100000)] |
This file contains hidden or 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 platform | |
| import subprocess | |
| import sys | |
| import numpy as np | |
| import torch | |
| # PyTorch info | |
| print(f"PyTorch version: {torch.__version__}") |
This file contains hidden or 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
| #!/usr/bin/env python | |
| """ | |
| See: https://huggingface.co/docs/safetensors/en/index | |
| """ | |
| from pathlib import Path | |
| from pprint import pp | |
| from time import perf_counter |
This file contains hidden or 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
| name: Deploy Quartz site to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - v4 | |
| permissions: | |
| contents: read | |
| pages: write |
This file contains hidden or 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
| #!/usr/bin/env python | |
| hexstr = "53 61 6c 74 65 64 5f 5f" # ef bf bd ef bf bd ef bf | |
| hexstr = hexstr.replace(" ", "") | |
| print(len(str(hexstr))) | |
| print(bytes.fromhex(hexstr).decode("utf-8")) | |
| decimal = int(hexstr, 16) |
NewerOlder