From 2d5ac3a8480befd476d0d6df8bc056a333d3c37e Mon Sep 17 00:00:00 2001 From: vikramxD Date: Mon, 16 Dec 2024 13:32:16 +0000 Subject: [PATCH] Refactor project structure and enhance functionality - Updated .gitignore to simplify ignored paths. - Updated LTX submodule to the latest commit for improved features. - Added 'imageio' to requirements.txt for enhanced image processing capabilities. - Introduced a new client.py file for making predictions via the API. - Enhanced logging in ltx_api.log to capture server start attempts and errors. - Improved LTXVideoSettings in ltx_settings.py by adding model_revision for stable model downloads. These changes aim to streamline the project setup, improve API functionality, and enhance logging for better troubleshooting. --- .gitignore | 2 +- api/client.py | 18 ++++++++++++++++++ api/logs/ltx_api.log | 7 +++++++ .../__pycache__/aws_settings.cpython-311.pyc | Bin 726 -> 726 bytes .../__pycache__/ltx_settings.cpython-311.pyc | Bin 13696 -> 14044 bytes configs/ltx_settings.py | 14 +++++++++++--- ltx | 2 +- requirements.txt | 1 + .../__pycache__/ltx_inference.cpython-311.pyc | Bin 19251 -> 19251 bytes .../mp4_to_s3_json.cpython-311.pyc | Bin 1352 -> 1352 bytes .../__pycache__/s3_manager.cpython-311.pyc | Bin 4109 -> 4109 bytes 11 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 api/client.py diff --git a/.gitignore b/.gitignore index ae54f51..9a5b0b4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -api/checkpoints \ No newline at end of file +checkpoints \ No newline at end of file diff --git a/api/client.py b/api/client.py new file mode 100644 index 0000000..12b71e5 --- /dev/null +++ b/api/client.py @@ -0,0 +1,18 @@ + +# Copyright The Lightning AI team. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import requests + +response = requests.post("http://127.0.0.1:8000/predict", json={"input": 4.0}) +print(f"Status: {response.status_code}\nResponse:\n {response.text}") diff --git a/api/logs/ltx_api.log b/api/logs/ltx_api.log index 08fe168..a153028 100644 --- a/api/logs/ltx_api.log +++ b/api/logs/ltx_api.log @@ -23,3 +23,10 @@ 2024-11-28 19:09:10.161 | INFO | __main__:main:348 - Starting LTX video generation server on port 8000 2024-11-28 19:11:22.845 | INFO | __main__:main:356 - Starting LTX video generation server on port 8000 2024-11-28 19:13:03.394 | INFO | __main__:main:356 - Starting LTX video generation server on port 8000 +2024-12-16 12:54:28.451 | INFO | __main__:main:356 - Starting LTX video generation server on port 8000 +2024-12-16 12:58:14.459 | ERROR | __main__:main:360 - Server failed to start: One or more workers failed to start. Shutting down LitServe +2024-12-16 12:59:43.351 | INFO | __main__:main:356 - Starting LTX video generation server on port 8000 +2024-12-16 12:59:46.614 | ERROR | __main__:main:360 - Server failed to start: One or more workers failed to start. Shutting down LitServe +2024-12-16 13:00:02.774 | INFO | __main__:main:356 - Starting LTX video generation server on port 8000 +2024-12-16 13:03:49.870 | ERROR | __main__:main:360 - Server failed to start: One or more workers failed to start. Shutting down LitServe +2024-12-16 13:15:44.243 | INFO | __main__:main:356 - Starting LTX video generation server on port 8000 diff --git a/configs/__pycache__/aws_settings.cpython-311.pyc b/configs/__pycache__/aws_settings.cpython-311.pyc index 83c4635748e9f4e89e483f1a174b9a80d61471f5..0cc3224d0377dc26fada541fbbe37c61fefc3d3c 100644 GIT binary patch delta 20 acmcb{dX1HPIWI340}#wtOxVbMnh5|nSOqo! delta 20 acmcb{dX1HPIWI340}$*JcG}2&nh5|nM+GSW diff --git a/configs/__pycache__/ltx_settings.cpython-311.pyc b/configs/__pycache__/ltx_settings.cpython-311.pyc index edb7680c4c6fb72bdf9f5ace0629b21c9a4a0a21..7cf30e76c51911ecf5506670e62c9fd738312694 100644 GIT binary patch delta 1728 zcmb7^O>7%Q6o6;!-L;+CZd!ul#6R8qxbcR>vE!uqAu4Se`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f8 100644 --- a/configs/ltx_settings.py +++ b/configs/ltx_settings.py @@ -64,6 +64,7 @@ class LTXVideoSettings(BaseSettings): device (str): Device for inference ('cuda' or 'cpu') prompt (Optional[str]): Generation prompt text negative_prompt (str): Negative prompt for undesired features + model_revision (str): Specific model revision to use for stability Example: >>> settings = LTXVideoSettings( @@ -81,7 +82,7 @@ class LTXVideoSettings(BaseSettings): description="HuggingFace model ID" ) ckpt_dir: Path = Field( - default_factory=lambda: Path(os.getenv('LTX_CKPT_DIR', 'checkpoints')), + default_factory=lambda: Path(os.getenv('LTX_CKPT_DIR', '../checkpoints')), description="Directory containing model checkpoints" ) use_auth_token: Optional[str] = Field( @@ -137,6 +138,12 @@ class LTXVideoSettings(BaseSettings): MAX_WIDTH: int = 1280 MAX_NUM_FRAMES: int = 257 + # Add model revision to ensure stable downloads + model_revision: str = Field( + default="f1994f6731091f828ecc135923c978155928c031", + description="Specific model revision to use for stability" + ) + def download_model(self) -> Path: """ Download model from HuggingFace Hub if not already present. @@ -168,10 +175,11 @@ def download_model(self) -> Path: # Create checkpoint directory if it doesn't exist self.ckpt_dir.mkdir(parents=True, exist_ok=True) - # Download model from HuggingFace - logger.info(f"Downloading model {self.model_id} to {self.ckpt_dir}") + # Download model from HuggingFace with specific revision + logger.info(f"Downloading model {self.model_id} (revision: {self.model_revision}) to {self.ckpt_dir}") snapshot_download( repo_id=self.model_id, + revision=self.model_revision, # Use specific working revision local_dir=self.ckpt_dir, local_dir_use_symlinks=False, repo_type='model', diff --git a/ltx b/ltx index e61ec9c..f923c5a 160000 --- a/ltx +++ b/ltx @@ -1 +1 @@ -Subproject commit e61ec9ce9db99aadccc7675f580bd51052c78e0a +Subproject commit f923c5ac147e9f88c1aae336406eb3519b944b4b diff --git a/requirements.txt b/requirements.txt index 2f07b14..b254e97 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,3 +10,4 @@ boto3 prometheus-client loguru bitsandbytes +imageio \ No newline at end of file diff --git a/scripts/__pycache__/ltx_inference.cpython-311.pyc b/scripts/__pycache__/ltx_inference.cpython-311.pyc index 2d3dbcebab0c1e6e7b226791d10887901af8eccd..3edadb02935882160ee1ae4116e1d524ee09d453 100644 GIT binary patch delta 22 ccmdlyjdAldM(*Xjyj%=GFkdlYBe#Y(07{Pqx&QzG delta 22 ccmdlyjdAldM(*Xjyj%=G(7DHBBe#Y(08JkTCjbBd diff --git a/scripts/__pycache__/mp4_to_s3_json.cpython-311.pyc b/scripts/__pycache__/mp4_to_s3_json.cpython-311.pyc index 08e545fbd262464ebe661f33ee1b795a043d2c44..8d33bd4f8cff2804f29078ce9b7c2dfe7b3e8060 100644 GIT binary patch delta 20 acmX@Xb%Kj~IWI340}#wtOxVb6%L)KB-vpTe delta 20 acmX@Xb%Kj~IWI340}v=|@Yu+0%L)KBNCc4p diff --git a/scripts/__pycache__/s3_manager.cpython-311.pyc b/scripts/__pycache__/s3_manager.cpython-311.pyc index 849370acd39592c56f83511c04327e55a65408f1..ced3b819e8e41ba7c7927c05e3e2f82624684447 100644 GIT binary patch delta 20 acmeBG=vCle&dbZi00i?D6E<=)2><{u$^;(( delta 20 acmeBG=vCle&dbZi00asfJT`JO2><{uGXxg^