Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -377,14 +377,14 @@ def get_arguments():
|
|
377 |
"""获取参数配置"""
|
378 |
parser = argparse.ArgumentParser(description="MiniGPT4-Video参数")
|
379 |
parser.add_argument("--cfg-path", help="配置文件路径",
|
380 |
-
default="test_configs/mistral_test_config.yaml")
|
381 |
parser.add_argument("--ckpt", type=str,
|
382 |
-
default='checkpoints/video_mistral_checkpoint_last.pth',
|
383 |
help="模型检查点路径")
|
384 |
parser.add_argument("--max_new_tokens", type=int, default=512,
|
385 |
help="最大生成token数")
|
386 |
-
parser.add_argument("--lora_r", type=int, default=
|
387 |
-
parser.add_argument("--lora_alpha", type=int, default=
|
388 |
parser.add_argument("--options", nargs="+", help="覆盖配置选项")
|
389 |
return parser.parse_args()
|
390 |
|
@@ -437,7 +437,7 @@ def load_minigpt4_model():
|
|
437 |
print("🔄 回退到模拟模式...")
|
438 |
return None, None, None
|
439 |
|
440 |
-
@spaces.GPU(duration=600)
|
441 |
def analyze_video_with_minigpt4(video_file, instruction):
|
442 |
"""使用MiniGPT4-Video分析视频内容并进行巨量引擎规则检测"""
|
443 |
if video_file is None:
|
|
|
377 |
"""获取参数配置"""
|
378 |
parser = argparse.ArgumentParser(description="MiniGPT4-Video参数")
|
379 |
parser.add_argument("--cfg-path", help="配置文件路径",
|
380 |
+
default="test_configs/mistral_test_config.yaml") # 使用mistral配置
|
381 |
parser.add_argument("--ckpt", type=str,
|
382 |
+
default='checkpoints/video_mistral_checkpoint_last.pth', # 使用mistral checkpoint
|
383 |
help="模型检查点路径")
|
384 |
parser.add_argument("--max_new_tokens", type=int, default=512,
|
385 |
help="最大生成token数")
|
386 |
+
parser.add_argument("--lora_r", type=int, default=64, help="LoRA rank") # 修改为64匹配checkpoint
|
387 |
+
parser.add_argument("--lora_alpha", type=int, default=16, help="LoRA alpha") # 修改为16匹配checkpoint
|
388 |
parser.add_argument("--options", nargs="+", help="覆盖配置选项")
|
389 |
return parser.parse_args()
|
390 |
|
|
|
437 |
print("🔄 回退到模拟模式...")
|
438 |
return None, None, None
|
439 |
|
440 |
+
@spaces.GPU(duration=600) # 增加到10分钟以支持模型下载
|
441 |
def analyze_video_with_minigpt4(video_file, instruction):
|
442 |
"""使用MiniGPT4-Video分析视频内容并进行巨量引擎规则检测"""
|
443 |
if video_file is None:
|