DSPy is a Python framework for programming language models (LMs) rather than prompting them. It provides a declarative API for defining LM programs using typed signatures, predictors (e.g., Predict, ChainOfThought, ReAct, RLM), and adapters (Chat, JSON, XML) that format and parse LM interactions. The framework includes a rich optimization suite (teleprompters) that can bootstrap demonstrations, optimize instructions (MIPROv2, COPRO), fine-tune models, and perform code-level optimization (GEPA) for Flex modules. It supports multiple LM backends (LiteLLM, native lm15) with caching, streaming, error handling, and cost tracking. The architecture is modular: clients manage LM connections, engines abstract execution backends, adapters handle message formatting/parsing, predictors implement reasoning patterns, signatures define I/O contracts, and utilities provide caching, callbacks, parallelism, and other cross-cutting concerns. The codebase demonstrates high cohesion and separation of concerns, with extensive test coverage and documentation. However, it is a large project with some experimental features, deprecation warnings, and a vendored lm15 library that adds maintenance overhead. Overall, it is a production-ready research framework widely used in the NLP community for building and optimizing LM programs.
This repository provides the official code, datasets, and checkpoints for the Timer family of large time series foundation models (Timer, Timer-XL, Sundial) from Tsinghua University. It implements a decoder-only Transformer architecture pre-trained on the Unified Time Series Dataset (UTSD) using the single-series sequence (S3) format. The code supports fine-tuning and evaluation on three downstream tasks: forecasting, segment-level imputation, and predictive anomaly detection. Data loading modules handle multiple time series formats (CSV, NPZ, TXT) with flexible windowing and scaling. The repository includes shell scripts for reproducible experiments across multiple datasets and data scarcity ratios. It also provides HuggingFace integration for zero-shot forecasting without training. While primarily a research codebase rather than a production application, it is well-structured with clean module separation and reusable components.
This repository implements the INP-Former model for anomaly detection in industrial inspection tasks. The system extracts Intrinsic Normal Prototypes (INPs) directly from test images using a DINOv2 vision transformer encoder, followed by an INP extractor and decoder to reconstruct normal regions. Reconstruction errors serve as anomaly scores. The repository provides training scripts for various settings (single-class, multi-class, few-shot, zero-shot, super-multi-class), a Gradio-based zero-shot application for interactive inference, ONNX conversion and inference tools, and a competition submission kit. It achieves state-of-the-art performance on standard benchmarks like MVTec-AD, VisA, and Real-IAD. The architecture is modular, separating the core model, dataset handling, utilities, and training logic, though training scripts show some duplication across different settings.
This repository is a compact PyTorch reimplementation of Siamese Networks for One-Shot Learning, trained and evaluated on the Omniglot dataset. It provides four core Python files: `model.py` defines a shared convolutional encoder with absolute difference scoring, `mydataset.py` handles in-memory image loading with rotation augmentations and positive/negative pair sampling, `train.py` orchestrates training and evaluation using gflags for configuration, and `make_dataset.py` flattens the Omniglot directory structure. The codebase uses PyTorch 1.0.1 and relies on deprecated APIs such as `torch.autograd.Variable`. Training achieves 89.5% accuracy on 20-way one-shot evaluation, slightly below the original paper's 92% due to optimizer choices (Adam vs SGD with momentum) and default parameter initialization. The repository also includes a static documentation site with bilingual (English/Chinese) support and a GitHub Pages deployment workflow. The research code is functional but tightly coupled to Omniglot and lacks modularity for reuse; the site is well-crafted but separate from the core ML logic.