diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml new file mode 100644 index 0000000..fb4c104 --- /dev/null +++ b/.github/workflows/python-lint.yml @@ -0,0 +1,39 @@ +name: Python Lint Check + +on: + push: + branches: [ main, master, develop ] + pull_request: + branches: [ main, master, develop ] + +jobs: + lint: + runs-on: ubuntu-latest + container: + image: python:3.9-alpine + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install dependencies + run: | + # Update package manager and install required packages + apk update + apk add --no-cache findutils + python -m pip install --upgrade pip + pip install pycodestyle + + - name: Show pycodestyle configuration + run: | + echo "Running pycodestyle with setup.cfg configuration:" + echo "- Max line length: 120" + echo "- Excluded directories: Stable3DGen/, __pycache__/" + echo "- Files being checked:" + find . -name "*.py" -not -path "./Stable3DGen/*" -not -path "./__pycache__/*" + + - name: Run pycodestyle + run: | + # Run pycodestyle using setup.cfg configuration + pycodestyle . + \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..0ec6609 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,5 @@ +[pycodestyle] +max-line-length = 120 +exclude = Stable3DGen/,__pycache__/ +statistics = True +count = True diff --git a/stable_3d.py b/stable_3d.py index f80e06e..bb78259 100644 --- a/stable_3d.py +++ b/stable_3d.py @@ -11,7 +11,7 @@ from transformers import AutoModelForImageSegmentation import folder_paths sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'Stable3DGen')) -from hi3dgen.pipelines import Hi3DGenPipeline +from hi3dgen.pipelines import Hi3DGenPipeline # noqa E402 log = logging.getLogger(__name__) MAX_SEED = numpy.iinfo(numpy.int32).max @@ -95,7 +95,11 @@ class Stable3DLoadModels: log.info(f"Already cached at: {local_path}") return local_path log.info(f"Downloading and caching model: {model_id} to trellis model folder") - local_path = snapshot_download(repo_id=model_id, local_dir=os.path.join(self.models_path, model_id), force_download=False) + local_path = snapshot_download( + repo_id=model_id, + local_dir=os.path.join(self.models_path, model_id), + force_download=False + ) return local_path @set_spconv_algo @@ -112,7 +116,13 @@ class Stable3DLoadModels: loaded_models.append(self.download_model(model_id)) # Loads yoso pedictor model to ~/models/trellis and StableNormal_turbo predictor library to ~/.cache/torch/hub/ yozo_model_folder = os.path.join(self.models_path, "Stable-X") - normal_predictor = torch.hub.load("hugoycj/StableNormal", "StableNormal_turbo", trust_repo=True, yoso_version='yoso-normal-v1-8-1', local_cache_dir=yozo_model_folder) + normal_predictor = torch.hub.load( + "hugoycj/StableNormal", + "StableNormal_turbo", + trust_repo=True, + yoso_version='yoso-normal-v1-8-1', + local_cache_dir=yozo_model_folder + ) # download dinov2 feature detection model and library to ~/.cache/torch/hub/ torch.hub.load('facebookresearch/dinov2', 'dinov2_vitl14_reg', pretrained=True) @@ -319,6 +329,10 @@ class Stable3DGenerate3D: return (filename,) @classmethod - def IS_CHANGED(s, images, seed, ss_guidance_strength, ss_sampling_steps, slat_guidance_strength, slat_sampling_steps): + def IS_CHANGED( + s, images, seed, + ss_guidance_strength, ss_sampling_steps, + slat_guidance_strength, slat_sampling_steps + ): # FIXME We should properly handle re-generation depending on the input parameters. return float("NaN")