Skip to content

Instantly share code, notes, and snippets.

@f0ster
f0ster / accelerate_presharder.py
Created April 28, 2024 14:08
CLI for sharding and publishing models to huggingface
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from accelerate import Accelerator
import os
import argparse
def main():
# Parse command line arguments
args = parse_args()
@heathermiller
heathermiller / scala-cheatsheet.md
Last active October 14, 2024 19:45
Scala Cheatsheet

This cheat sheet originated from the forum, credits to Laurent Poulain. We copied it and changed or added a few things.

Evaluation Rules

  • Call by value: evaluates the function arguments before calling the function
  • Call by name: evaluates the function first, and then evaluates the arguments if need be
    def example = 2      // evaluated when called
    val example = 2      // evaluated immediately