Skip to content

Commit

Permalink
+ add use_cuda for get_model funcs in two OPs (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
HYLcool authored Aug 19, 2024
1 parent 7a00933 commit 3eaba7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion data_juicer/ops/filter/video_aesthetics_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ def compute_stats(self, sample, rank=None, context=False):

if len(frame_images) > 0:
# compute aesthetics_scores
model, processor = get_model(self.model_key, rank=rank)
model, processor = get_model(self.model_key,
rank=rank,
use_cuda=self.use_cuda())
inputs = processor(images=frame_images,
return_tensors='pt').to(model.device)
with torch.no_grad():
Expand Down
4 changes: 3 additions & 1 deletion data_juicer/ops/mapper/image_diffusion_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ def _real_guidance(self, caption: str, image: Image.Image, rank=None):
canvas = image.resize((512, 512), Image.BILINEAR)
prompt = caption

diffusion_model = get_model(model_key=self.model_key, rank=rank)
diffusion_model = get_model(model_key=self.model_key,
rank=rank,
use_cuda=self.use_cuda())

kwargs = dict(image=canvas,
prompt=[prompt],
Expand Down

0 comments on commit 3eaba7f

Please sign in to comment.