Commit b1e543f1 authored by gaclove's avatar gaclove
Browse files

Refactor video frame interpolation documentation and error handling in model loading

parent 75eac23c
...@@ -87,7 +87,6 @@ python lightx2v/infer.py \ ...@@ -87,7 +87,6 @@ python lightx2v/infer.py \
1. `video_frame_interpolation.target_fps` - 如果启用视频帧插值,使用此帧率作为输出帧率 1. `video_frame_interpolation.target_fps` - 如果启用视频帧插值,使用此帧率作为输出帧率
2. `fps`(默认 16)- 如果未启用视频帧插值,使用此帧率;同时总是用作源帧率 2. `fps`(默认 16)- 如果未启用视频帧插值,使用此帧率;同时总是用作源帧率
**注意**: 系统不再使用 `video_fps` 配置项,统一使用 `video_frame_interpolation.target_fps` 来控制输出视频的帧率。
## 工作原理 ## 工作原理
......
...@@ -56,7 +56,7 @@ class DefaultRunner(BaseRunner): ...@@ -56,7 +56,7 @@ class DefaultRunner(BaseRunner):
logger.info("Loading RIFE model...") logger.info("Loading RIFE model...")
return RIFEWrapper(self.config["video_frame_interpolation"]["model_path"]) return RIFEWrapper(self.config["video_frame_interpolation"]["model_path"])
else: else:
raise ValueError(f"Unsupported VFI model: {self.config['vfi']}") raise ValueError(f"Unsupported VFI model: {self.config['video_frame_interpolation']['algo']}")
@ProfilingContext("Load models") @ProfilingContext("Load models")
def load_model(self): def load_model(self):
......
...@@ -92,23 +92,6 @@ def main(): ...@@ -92,23 +92,6 @@ def main():
print("Error: flownet.pkl file not found") print("Error: flownet.pkl file not found")
return 1 return 1
# Clean up temporary files
print("Cleaning up temporary files...")
if zip_path.exists():
zip_path.unlink()
print(f"Deleted: {zip_path}")
# Delete extracted folders
for item in temp_dir.iterdir():
if item.is_dir():
shutil.rmtree(item)
print(f"Deleted directory: {item}")
# Delete the temp directory itself if empty
if temp_dir.exists() and not any(temp_dir.iterdir()):
temp_dir.rmdir()
print(f"Deleted temp directory: {temp_dir}")
print("RIFE model download and installation completed!") print("RIFE model download and installation completed!")
return 0 return 0
...@@ -116,11 +99,33 @@ def main(): ...@@ -116,11 +99,33 @@ def main():
print(f"Error: {e}") print(f"Error: {e}")
return 1 return 1
finally: finally:
# Clean up temporary files
print("Cleaning up temporary files...")
# Delete zip file if exists
if zip_path.exists(): if zip_path.exists():
try: try:
zip_path.unlink() zip_path.unlink()
print(f"Deleted: {zip_path}")
except Exception as e:
print(f"Error deleting zip file: {e}")
# Delete extracted folders
for item in temp_dir.iterdir():
if item.is_dir():
try:
shutil.rmtree(item)
print(f"Deleted directory: {item}")
except Exception as e:
print(f"Error deleting directory {item}: {e}")
# Delete the temp directory itself if empty
if temp_dir.exists() and not any(temp_dir.iterdir()):
try:
temp_dir.rmdir()
print(f"Deleted temp directory: {temp_dir}")
except Exception as e: except Exception as e:
print(f"Error: {e}") print(f"Error deleting temp directory: {e}")
if __name__ == "__main__": if __name__ == "__main__":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment