Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package chores #49

Merged
merged 19 commits into from
Jan 13, 2025
Merged

Package chores #49

merged 19 commits into from
Jan 13, 2025

Conversation

Xmaster6y
Copy link
Owner

@Xmaster6y Xmaster6y commented Jan 12, 2025

What does this PR do?

Various package chores

Linked Issues

Summary by Sourcery

Update the tutorials to use the latest version of the lczerolens library. Migrate from poetry to uv for dependency management.

Documentation:

  • Update the "Run Models on GPU" tutorial to use the latest version of the lczerolens library. Add setup instructions for Google Colab.
  • Update the "Convert Official Weights" tutorial to use the latest version of the lczerolens library. Add setup instructions for Google Colab.
  • Update the "Probe Concepts" tutorial to use the latest version of the lczerolens library. Add setup instructions for Google Colab.
  • Update the "Visualise Heatmaps" tutorial to use the latest version of the lczerolens library. Add setup instructions for Google Colab.
  • Update the "Automated Interpretability" tutorial to use the latest version of the lczerolens library. Add setup instructions for Google Colab.
  • Update the "Piece Value Estimation using LRP" tutorial to use the latest version of the lczerolens library. Add setup instructions for Google Colab.

Copy link
Contributor

sourcery-ai bot commented Jan 12, 2025

Reviewer's Guide by Sourcery

This PR introduces several package chores, including updates to dependencies, build processes, and documentation. It also includes improvements to the tutorial notebooks.

Flow diagram of updated build and CI process

flowchart TD
    A[Developer Changes] --> B{Pre-commit Hooks}
    B -->|Run| C[Ruff Linting]
    B -->|Run| D[File Checks]

    C --> E{CI Pipeline}
    D --> E

    E -->|Success| F[Build with UV]
    E -->|Failure| G[Fix Issues]

    F --> H[Publish Package]
    G --> A

    style A fill:#f9f,stroke:#333,stroke-width:2px
    style E fill:#bbf,stroke:#333,stroke-width:2px
    style H fill:#bfb,stroke:#333,stroke-width:2px
Loading

File-Level Changes

Change Details Files
Updated the tutorial on training SAEs to include a section on running models on GPU.
  • Added a new section on running models on GPU.
  • Added code to check for GPU availability.
  • Modified the setup section to install the lczerolens package.
  • Added code to download a pre-trained model.
  • Added code to load the model and dataset.
  • Added code to set up the activation buffer.
  • Added code to train a SAE.
  • Added code to evaluate a SAE.
  • Added a markdown cell for the "Evaluate a SAE" section.
  • Added a markdown cell for the "Train a SAE" section.
  • Added a markdown cell for the "Setup Activation Buffer" section.
  • Added code to define a collate function and compute function.
  • Added a markdown cell for the "Load the Model and the Dataset" section.
  • Added a markdown cell with a link to open the notebook in Colab.
  • Added a markdown cell for the "Setup" section.
  • Added a markdown cell with a title and a link to open the notebook in Colab.
  • Added code to set the MODE variable.
  • Added code to install the lczerolens package based on the MODE variable.
  • Added code to download a pre-trained model.
  • Added code to import torch and check for GPU availability.
  • Added a markdown cell for loading the model and dataset.
  • Added code to load the model and dataset.
  • Added code to print the model.
  • Added a markdown cell for setting up the activation buffer.
  • Added code to define functions for collating data and computing activations.
  • Added code to define constants for the activation buffer and compute function.
  • Added code to create train and validation activation buffers.
  • Added code to test the train activation buffer.
  • Added a markdown cell for training a SAE.
  • Added a markdown cell for evaluating a SAE.
docs/source/notebooks/tutorials/train-saes.ipynb
Updated the tutorial on converting official weights to include a streamlined process.
  • Removed unnecessary markdown cells.
  • Simplified the code for converting models.
  • Updated the instructions for installing lc0 binaries.
docs/source/notebooks/features/convert-official-weights.ipynb
Removed unused code and dependencies related to LRP lens analysis.
  • Removed unused imports.
  • Removed the _compute_lrp_relevance function.
  • Removed the analyse and analyse_batched methods.
  • Removed the make_default_composite and _context methods.
src/lczerolens/lenses/lrp/lens.py
Switched from poetry to uv for dependency management.
  • Updated pyproject.toml to use uv instead of poetry.
  • Updated contributing guide to reflect the change to uv.
  • Updated CI workflow to use uv.
  • Updated publish workflow to use uv.
  • Updated readthedocs configuration to use uv.
  • Updated pre-commit configuration.
  • Updated Makefile to use uv.
  • Updated scripts for resolving test assets to use uv.
  • Updated README to use uv.
  • Updated scripts for resolving demo assets to use uv.
  • Removed poetry.lock.
  • Added uv.lock.
pyproject.toml
CONTRIBUTING.md
.github/workflows/ci.yml
.github/workflows/publish.yml
.readthedocs.yaml
.pre-commit-config.yaml
Makefile
assets/resolve-test-assets.sh
README.md
assets/resolve-demo-assets.sh
.github/workflows/publish.yml
.python-version
poetry.lock
Updated the probe concepts notebook to streamline model loading and data selection.
  • Simplified model loading code.
  • Simplified data selection code.
docs/source/notebooks/features/probe-concepts.ipynb
Updated the visualize heatmaps notebook to streamline model loading.
  • Simplified model loading code.
docs/source/notebooks/features/visualise-heatmaps.ipynb
Updated the automated interpretability notebook to streamline model loading.
  • Simplified model loading code.
docs/source/notebooks/tutorials/automated-interpretability.ipynb
Updated the piece value estimation notebook to set the execution mode.
  • Set the MODE variable.
docs/source/notebooks/tutorials/piece-value-estimation-using-lrp.ipynb
Updated the walkthrough notebook to set the execution mode.
  • Set the MODE variable.
docs/source/notebooks/walkthrough.ipynb
Updated dataset creation scripts to use uv.
  • Updated run commands to use uv.
scripts/datasets/make_lichess_dataset.py
scripts/datasets/make_tcec_dataset.py
Updated LRP plane analysis script to use uv.
  • Updated run command to use uv.
scripts/lrp/plane_analysis.py
Updated notebook testing script to use uv.
  • Updated nbconvert command to use uv.
tests/integration/test_notebooks.py

Assessment against linked issues

Issue Objective Addressed Explanation
#42 Integrate uv as the package management tool
#42 Replace poetry configuration with uv configuration
#42 Update project scripts and documentation to use uv
#46 Update dependencies to Python 3.11
#46 Update project configuration to use uv instead of poetry

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Xmaster6y - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

CONTRIBUTING.md Outdated Show resolved Hide resolved
@Xmaster6y Xmaster6y enabled auto-merge (squash) January 13, 2025 09:02
@Xmaster6y Xmaster6y merged commit b669d42 into main Jan 13, 2025
1 of 2 checks passed
@Xmaster6y Xmaster6y deleted the chores branch January 13, 2025 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Update to Python 3.11 Move to uv
1 participant