Skip to content

Commit

Permalink
add in formatting skip everything (#779)
Browse files Browse the repository at this point in the history
ghstack-source-id: 34fe56595eac4d1a2fecb07a230307c0b2b767d7
Pull Request resolved: #688
  • Loading branch information
drisspg committed Aug 30, 2024
1 parent d0e6246 commit ba2d3b1
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 4 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ruff_linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Code Analysis with Ruff

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Analyzing the code with ruff
run: |
ruff check .
- name: Check well formatted code
run: |
ruff format --check
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.6
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
4 changes: 4 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ tabulate # QOL for printing tables to stdout

# Custom CUDA Extensions
ninja

# Linting
ruff
pre-commit
8 changes: 8 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Currently, we ignore all files in the project by default.
# We plan to add files in chunks using the 'include' list below.
# To add a new path: Simply add it to the 'include' list.
# Example: To lint all files in every subfolder of 'test', add "test/**/*"
include = [
"torchao/float8/inference.py",
"torchao/float8/float8_utils.py",
]
6 changes: 2 additions & 4 deletions torchao/float8/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
from dataclasses import dataclass

from enum import auto, Enum
from typing import Callable, List, Optional, Tuple
from typing import Callable, Optional, Tuple

import torch
import torch.nn as nn
from torchao.float8.float8_linear_utils import swap_linear_layers
from torchao.float8.float8_utils import is_row_major, pad_tensor_for_matmul

from torchao.float8.float8_tensor import (
Float8Tensor,
Expand Down Expand Up @@ -244,9 +245,6 @@ def quantize_to_float8(
)


from torchao.float8.float8_utils import is_row_major, pad_tensor_for_matmul


def preprocess_data(
a_data: torch.Tensor, b_data: torch.Tensor, scaled_mm_config: ScaledMMConfig
) -> Tuple[torch.Tensor, torch.Tensor]:
Expand Down

0 comments on commit ba2d3b1

Please sign in to comment.