Skip to main content

A tool to validate transformer model configurations

Project description

check-model-config

A validation tool for transformer model configurations that helps identify inconsistencies between model configs, weights, and tokenizers.

License: MIT Python 3.9+

Overview

check-model-config is a CLI tool that performs comprehensive validation checks on transformer models to ensure their configurations are consistent with their weights and tokenizers. It helps identify potential issues that could affect model performance or behavior.

The tool is particularly useful for:

  • Model developers who want to ensure their published models have consistent configurations
  • Users who want to validate models before using them in production
  • Researchers working with modified or custom models who need to verify configuration integrity

Installation

pip install check-model-config

Usage

Basic Usage

Run the validation tests on a model:

check-model-config --model openai/gpt2

You can use either a Hugging Face model ID or a local directory path:

check-model-config --model ./path/to/local/model

Skip Weight-Dependent Tests

For faster validation or when working with very large models, you can skip tests that require loading model weights:

check-model-config --model meta-llama/Llama-2-70b --load-weights=False

Validation Tests

The tool runs the following validation checks:

  • Vocabulary Size Consistency: Verifies that vocab_size in config matches embedding weights, lm_head weights, and tokenizer
  • Hidden Size Consistency: Ensures hidden dimensions match across weights and config
  • Layer Count Validation: Checks that layer counts in config match actual weights
  • Attention Mechanism: Validates KQV projections and attention output dimensions
  • MLP Layers: Checks feed-forward network dimensions and activation functions
  • Tied Embeddings: Verifies embedding tying configuration matches implementation
  • Position Embeddings: Validates position embedding configuration and implementation
  • Mixture of Experts: Checks MoE configurations for models that use experts
  • Window Layers: Validates sliding window attention configurations

Requirements

  • Python 3.9+
  • PyTorch 2.5.1+
  • Transformers 4.47.1+
  • Accelerate 1.2.0+

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

check_model_config-0.1.0.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

check_model_config-0.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file check_model_config-0.1.0.tar.gz.

File metadata

  • Download URL: check_model_config-0.1.0.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for check_model_config-0.1.0.tar.gz
Algorithm Hash digest
SHA256 70ef55744c50e12bb72a7090755080e5428a984dae3f28f6f89cfb02b5b70906
MD5 b7ee03e2971c0c62c8008e14e7f39acf
BLAKE2b-256 cc356af2edcdb71d2c3ac486f6957e4c8f400fd3ed75898d37772b581db0c204

See more details on using hashes here.

File details

Details for the file check_model_config-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for check_model_config-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f9d7e35652ec701371438031d8720eb2d94dd6edd0a74a6f950bf00eb7ba76d
MD5 f81ad60c40edf89720c72988c9dcc6cf
BLAKE2b-256 e13ca2fe64ac3e38ee0595d536c595cd915d349cf5486ee6f5c9ef7ce0b9bc4f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page