This document provides a comprehensive reference for all configuration options available in LLM Foundry YAML files. Configuration files are used for training, fine-tuning, and evaluating large language models.
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
""" | |
inference_openai.py - text generation with OpenAI API | |
See https://platform.openai.com/docs/quickstart for more details. | |
Usage: | |
python inference_openai.py --prompt "The quick brown fox jumps over the lazy dog." --model "gpt-3.5-turbo" --temperature 0.5 --max_tokens 256 --n 1 --stop "." | |
Detailed usage: | |
python inference_openai.py --help |
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
""" | |
util script for loading, basic processing, converting reddit posts -> hf dataset | |
https://arctic-shift.photon-reddit.com/download-tool | |
""" | |
import pandas as pd | |
from datasets import Dataset, load_dataset | |
src = "./r_LocalLLaMA_posts.jsonl" # update with relevant path | |
df = pd.read_json(src, lines=True).convert_dtypes() |
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
# -*- coding: utf-8 -*- | |
"""gemma-3n-test | |
pip install -U -q git+https://github.com/huggingface/transformers.git | |
pip install -U -q git+https://github.com/huggingface/pytorch-image-models.git | |
""" | |
from transformers import pipeline | |
import torch |
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 python3 | |
""" | |
Slice a (possibly very tall) image into fixed-height chunks. | |
Creates a sibling directory called <image stem>_slices/ | |
and writes slice_000.png, slice_001.png, … inside it. | |
""" | |
import argparse | |
from pathlib import Path |
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
""" | |
Create & save an hf dataset with train/test/val splits from dir w/ text files | |
Ideal structure: | |
root / section_name_1 / file 1 | |
root / section_name_1 / file 2 | |
root / section_name_1 / file YYY | |
root / section_name_2 / file 1 | |
root / section_name_2 / file ZZZ |
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
from dataclasses import dataclass | |
from typing import List, Optional, Tuple | |
import torch | |
import torch.nn as nn | |
@dataclass | |
class _LayerSummary: | |
"""A dataclass to hold summary information for a single layer.""" |
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 | |
# -*- coding: utf-8 -*- | |
""" | |
Standalone Asynchronous Nanonets-OCR-s Inference Script using vLLM and PyMuPDF. | |
This script processes PDF files from an input directory using the | |
nanonets/Nanonets-OCR-s model served locally by vLLM via its OpenAI-compatible API. | |
It renders each page, sends API requests concurrently for OCR, extracts the | |
structured markdown/HTML text, and saves the combined text for each PDF into a | |
corresponding .txt file in the specified output directory. |
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 | |
# -*- coding: utf-8 -*- | |
""" | |
Standalone Asynchronous RolmOCR Inference Script using vLLM and PyMuPDF. | |
This script processes PDF files from an input directory using the | |
reducto/RolmOCR model served locally by vLLM via its OpenAI-compatible API. | |
It renders each page, sends API requests concurrently for OCR, extracts plain | |
text, and saves the combined text for each PDF into a corresponding .txt file | |
in the specified output directory. |
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
""" | |
WaveNet: An Ultra-Small Language Model (PyTorch Implementation) | |
Based on the paper: https://arxiv.org/abs/2411.02674 | |
Hugging Face Transformers compatible implementation. | |
""" | |
import math | |
from typing import Dict, Optional, Tuple, Union | |
import torch |
NewerOlder