Commit 324f97a4 authored by zhengyaoqiu's avatar zhengyaoqiu

优化

parent 64288be5
...@@ -17,7 +17,6 @@ class FeatureExtractor: ...@@ -17,7 +17,6 @@ class FeatureExtractor:
@staticmethod @staticmethod
def init_model(device="xpu" if torch.xpu.is_available() else "cpu", model_name="ViT-B/32"): def init_model(device="xpu" if torch.xpu.is_available() else "cpu", model_name="ViT-B/32"):
torch.xpu.empty_cache()
print(f"创建并初始化 CLIP 模型: {model_name} 在设备: {device}") print(f"创建并初始化 CLIP 模型: {model_name} 在设备: {device}")
model, preprocess = clip.load(model_name, device=device) model, preprocess = clip.load(model_name, device=device)
return model, preprocess return model, preprocess
......
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