Skip to content

Commit

Permalink
Merge branch 'dev-1.x' into plyfager/requires
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyh1900 authored Nov 9, 2022
2 parents 8a6ae4f + ce064f4 commit a1a4b5b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .circleci/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
mim install 'mmcv >= 2.0.0rc1'
mim install 'mmdet >= 3.0.0rc2'
pip install -r requirements/tests.txt
pip install git+https://github.com/openai/CLIP.git
- run:
name: Build and install
command: |
Expand Down Expand Up @@ -108,6 +109,7 @@ jobs:
docker exec mmedit mim install 'mmcv >= 2.0.0rc1'
docker exec mmedit mim install 'mmdet >= 3.0.0rc2'
docker exec mmedit pip install -r requirements/tests.txt
docker exec mmedit pip install git+https://github.com/openai/CLIP.git
- run:
name: Build and install
command: |
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/pr_stage_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ jobs:
mim install 'mmcv >= 2.0.0rc1'
mim install 'mmdet >= 3.0.0rc2'
- name: Install other dependencies
run: pip install -r requirements/tests.txt
run: |
pip install -r requirements/tests.txt
pip install git+https://github.com/openai/CLIP.git
- name: Build and install
run: rm -rf .eggs && pip install -e .
- name: Run unittests and generate coverage report
Expand Down Expand Up @@ -97,6 +99,7 @@ jobs:
mim install 'mmcv >= 2.0.0rc1'
mim install 'mmdet >= 3.0.0rc2'
pip install -r requirements/tests.txt
pip install git+https://github.com/openai/CLIP.git
- name: Build and install
run: |
python setup.py check -m -s
Expand Down Expand Up @@ -131,6 +134,7 @@ jobs:
mim install 'mmcv >= 2.0.0rc1'
mim install 'mmdet >= 3.0.0rc2'
python -m pip install -r requirements/tests.txt
pip install git+https://github.com/openai/CLIP.git
- name: Build and install
run: |
python -m pip install -e .
Expand Down
7 changes: 7 additions & 0 deletions mmedit/models/losses/clip_loss.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import torch.nn as nn

from mmedit.registry import MODULES
from mmedit.utils import try_import

clip = try_import('clip')


class CLIPLossModel(torch.nn.Module):
Expand Down Expand Up @@ -31,6 +34,10 @@ def __init__(self,
import clip
except ImportError:
raise 'To use clip loss, openai clip need to be installed first'

assert clip is not None, (
"Cannot import 'clip'. Please install 'clip' via "
"\"pip install git+https://github.com/openai/CLIP.git\".")
self.model, self.preprocess = clip.load(clip_type, device='cpu')
self.upsample = torch.nn.Upsample(scale_factor=scale_factor)
self.avg_pool = torch.nn.AvgPool2d(
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
-r requirements/runtime.txt
-r requirements/tests.txt
-r requirements/optional.txt
3 changes: 2 additions & 1 deletion requirements/optional.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
mmdet
PyQt5
clip @ git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1
mmdet >= 3.0.0rc2
1 change: 0 additions & 1 deletion requirements/runtime.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
av
av==8.0.3; python_version < '3.7'
clip @ git+https://github.com/openai/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1
face-alignment
facexlib
lmdb
Expand Down

0 comments on commit a1a4b5b

Please sign in to comment.