Skip to content

Open-Sora: Democratizing Efficient Video Production for All

Python

lint: unify setting in `pyproject.toml` (#583)

Jirka Boroveca7b6aacc99b6
diff --git a/.isort.cfg b/.isort.cfg
deleted file mode 100644
index ccbf575..0000000
--- a/.isort.cfg
+++ /dev/null
@@ -1,7 +0,0 @@
-[settings]
-line_length = 120
-multi_line_output=3
-include_trailing_comma = true
-ignore_comments = true
-profile = black
-honor_noqa = true
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 7eb6c12..bce9cb8 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -5,7 +5,7 @@ repos:
hooks:
- id: autoflake
name: autoflake (python)
- args: ['--in-place', '--remove-unused-variables', '--remove-all-unused-imports', '--ignore-init-module-imports']
+ args: ['--in-place']
- repo: https://github.com/pycqa/isort
rev: 5.12.0
@@ -18,7 +18,6 @@ repos:
hooks:
- id: black
name: black formatter
- args: ['--line-length=120', '--target-version=py37', '--target-version=py38', '--target-version=py39','--target-version=py310']
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
diff --git a/eval/vbench/calc_vbench.py b/eval/vbench/calc_vbench.py
index e5570a1..bce29a5 100644
--- a/eval/vbench/calc_vbench.py
+++ b/eval/vbench/calc_vbench.py
@@ -3,7 +3,6 @@ import os
import time
import torch
-
from vbench import VBench
full_info_path = "eval/vbench/VBench_full_info.json"
diff --git a/eval/vbench_i2v/calc_vbench_i2v.py b/eval/vbench_i2v/calc_vbench_i2v.py
index b8d5901..e838c2d 100644
--- a/eval/vbench_i2v/calc_vbench_i2v.py
+++ b/eval/vbench_i2v/calc_vbench_i2v.py
@@ -3,7 +3,6 @@ import os
import time
import torch
-
from vbench import VBench
from vbench2_beta_i2v import VBenchI2V
diff --git a/opensora/datasets/read_video.py b/opensora/datasets/read_video.py
index 6b5da34..2408c4c 100644
--- a/opensora/datasets/read_video.py
+++ b/opensora/datasets/read_video.py
@@ -126,7 +126,6 @@ def _read_from_stream(
stream_name: Dict[str, Optional[Union[int, Tuple[int, ...], List[int]]]],
filename: Optional[str] = None,
) -> List["av.frame.Frame"]:
-
if pts_unit == "sec":
# TODO: we should change all of this from ground up to simply take
# sec and convert to MS in C++
diff --git a/opensora/schedulers/rf/rectified_flow.py b/opensora/schedulers/rf/rectified_flow.py
index 8acaff5..f35bebb 100644
--- a/opensora/schedulers/rf/rectified_flow.py
+++ b/opensora/schedulers/rf/rectified_flow.py
@@ -19,7 +19,7 @@ def timestep_transform(
for key in ["height", "width", "num_frames"]:
if model_kwargs[key].dtype == torch.float16:
model_kwargs[key] = model_kwargs[key].float()
-
+
t = t / num_timesteps
resolution = model_kwargs["height"] * model_kwargs["width"]
ratio_space = (resolution / base_resolution).sqrt()
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..8cb3c76
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,16 @@
+[tool.autoflake]
+remove-unused-variables = true
+remove-all-unused-imports = true
+ignore-init-module-imports = true
+
+[tool.isort]
+line_length = 120
+multi_line_output = 3
+include_trailing_comma = true
+ignore_comments = true
+profile = "black"
+honor_noqa = true
+
+[tool.black]
+line-length = 120
+target-version = ["py37", "py38", "py39", "py310"]