Giter Site home page Giter Site logo

sae-circuits's Introduction

Python

SAE Circuits

Setup and Installation ๐Ÿ“ฆ

This project uses Poetry for dependency management. However, we have only three dependencies: pytorch, transformer_lens (see here) and black (for code formatting). Follow these instructions to set up your environment.

Prerequisites

  • Python 3.12
  • Poetry

Installing Poetry

If you don't already have Poetry installed, you can install it by running:

curl -sSL https://install.python-poetry.org | python3 -

This command will install Poetry and add it to your PATH. For more detailed instructions, visit the Poetry installation guide.

Setting Up the Project

Once Poetry is installed, clone the repository and install the dependencies:

git clone https://github.com/charlieoneill11/sae-circuits.git
cd sae-circuits
poetry install

This will install all necessary dependencies as specified in the pyproject.toml file.

Running the Project

To run the main script, use Poetry to handle the environment:

poetry run python main.py --config config.yaml

Code Formatting with Black โšซ

To maintain consistent coding style and improve code readability across the project, we use Black, a highly opinionated code formatter. Follow these steps to use Black to format the Python code in this repository.

Installing Black

If Black is not already listed as a dependency in the pyproject.toml, you can add it using Poetry:

poetry add --dev black

This command adds Black to the project's development dependencies, ensuring it does not get installed in production environments.

Running Black

To format your project's Python files, you can run Black through Poetry to ensure it operates within the project's virtual environment:

poetry run black .

This command will format all Python files in your project directory (and subdirectories) according to Black's rules.

Configuring Black

If you have specific formatting preferences that differ from Black's defaults, you can configure Black in a pyproject.toml file under the [tool.black] section. Here is an example of setting line length:

[tool.black]
line-length = 88

You can adjust line-length or add other configurations according to the Black documentation.

Checking Formatting

Before committing your changes, you can check which files would be reformatted without actually applying the changes:

poetry run black --check .

This command provides a way to ensure your code meets the formatting standards before pushing it to your repository.

sae-circuits's People

Contributors

charlieoneill11 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.