lczerolens

🔬 Interpretability for Leela Chess Zero networks.

https://github.com/xmaster6y/lczerolens

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.1%) to scientific vocabulary

Keywords

chess lc0 xai
Last synced: 6 months ago · JSON representation ·

Repository

🔬 Interpretability for Leela Chess Zero networks.

Basic Info
Statistics
  • Stars: 15
  • Watchers: 5
  • Forks: 3
  • Open Issues: 10
  • Releases: 10
Topics
chess lc0 xai
Created about 2 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Citation

README.md

logo

lczerolens 🔍

Documentation lczerolens license uv Ruff python versions

codecov ci-tests ci-tests-slow publish docs

Leela Chess Zero (lc0) Lens (lczerolens): a set of utilities to make interpretability easy and framework-agnostic (PyTorch): use it with tdhook, captum, zennit, or nnsight.

Getting Started

Installs

bash pip install lczerolens

Take the viz extra to render heatmaps and the backends extra to use the lc0 backends.

Run Models

Get the best move predicted by a model:

```python from lczerolens import LczeroBoard, LczeroModel

model = LczeroModel.from_hf("lczerolens/maia-1100") board = LczeroBoard()

output = model(board) bestmoveidx = output["policy"].argmax() print(board.decodemove(bestmove_idx)) ```

Framework-Agnostic Interpretability

Use lczerolens with your preferred PyTorch interpretability framework (tdhook, captum, zennit, nnsight). More examples in the framework-agnostic interpretability notebook.

```python from lczerolens import LczeroBoard, LczeroModel model = LczeroModel.from_hf("lczerolens/maia-1100") board = LczeroBoard()

TODO: complete this example

```

Features

Tutorials

Demo

Spaces

Some Hugging Face Spaces are available to try out the library. The demo (:red_circle: in construction) will showcase some of the features of the library and the backends demo makes the conversion of lc0 models to onnx easy.

Local Demo

Additionally, you can run the gradio demos locally. First you'll need to clone the spaces (after cloning the repo):

bash git clone https://huggingface.co/spaces/lczerolens/demo spaces/demo

And optionally the backends demo:

bash git clone https://huggingface.co/spaces/lczerolens/backends-demo spaces/backends-demo

And then launch the demo (running on port 8000):

bash just demo

To test the backends use:

bash just demo-backends

Full Documentation

See the full documentation.

Contribute

See the guidelines in CONTRIBUTING.md.

Owner

  • Name: Yoann Poupart
  • Login: Xmaster6y
  • Kind: user
  • Location: Lyon
  • Company: ENS de Lyon

:computer: Self-taught and tech-savvy student.

Citation (CITATION.cff)

cff-version: 1.2.0
title: LCZeroLens
version: 0.1.0
date-released: 2024-02-09
type: software
authors:
  - name: Yoann Poupart
repository-code: 'https://github.com/Xmaster6y/lczerolens'
repository-artifact: 'https://github.com/Xmaster6y/lczerolens/releases/'
keywords:
  - chess
  - explainable AI (XAI)
license: MIT

GitHub Events

Total
  • Create event: 46
  • Release event: 6
  • Issues event: 39
  • Watch event: 9
  • Delete event: 43
  • Issue comment event: 60
  • Push event: 161
  • Pull request review event: 59
  • Pull request review comment event: 90
  • Pull request event: 79
  • Fork event: 1
Last Year
  • Create event: 46
  • Release event: 6
  • Issues event: 39
  • Watch event: 9
  • Delete event: 43
  • Issue comment event: 60
  • Push event: 161
  • Pull request review event: 59
  • Pull request review comment event: 90
  • Pull request event: 79
  • Fork event: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 33
  • Total pull requests: 65
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 5 days
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 0.18
  • Average comments per pull request: 0.94
  • Merged pull requests: 53
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 22
  • Pull requests: 40
  • Average time to close issues: 4 days
  • Average time to close pull requests: about 5 hours
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 0.27
  • Average comments per pull request: 1.25
  • Merged pull requests: 33
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Xmaster6y (33)
Pull Request Authors
  • Xmaster6y (62)
  • NOVAdrien (3)
Top Labels
Issue Labels
feature (5) other (4) roadmap (2) bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 406 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 8
  • Total maintainers: 1
pypi.org: lczerolens

Interpretability for LeelaChessZero networks.

  • Versions: 8
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 406 Last month
Rankings
Dependent packages count: 9.9%
Average: 37.7%
Dependent repos count: 65.5%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
.github/workflows/publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • pypa/gh-action-pypi-publish release/v1 composite
docker/Dockerfile docker
  • python 3.9.18 build
docker/docker-compose.yml docker
poetry.lock pypi
  • 125 dependencies
pyproject.toml pypi