Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the requirements and fix the _expand_mask import issue #705

Open
wants to merge 198 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
198 commits
Select commit Hold shift + click to select a range
61e532b
Update README.md
Sep 16, 2022
8989543
Merge branch 'main' of https://github.com/salesforce/LAVIS
dxli94 Sep 16, 2022
5498416
Update getting_started.rst
Sep 16, 2022
33a763d
Update getting_started.rst
Sep 16, 2022
f6e1354
renaming features to embeds_proj.
dxli94 Sep 16, 2022
40b5022
Merge branch 'main' of https://github.com/salesforce/LAVIS
dxli94 Sep 16, 2022
6f6c40e
update docs.
dxli94 Sep 16, 2022
2e072e6
update docs.
dxli94 Sep 16, 2022
4e69f40
update README and docs.
dxli94 Sep 16, 2022
e4ab2b1
update README.
dxli94 Sep 16, 2022
8961e6d
update README.
dxli94 Sep 16, 2022
f42138b
relax hf version.
dxli94 Sep 16, 2022
b057e38
Update README.md
schhoi Sep 16, 2022
0f94053
Update README.md
schhoi Sep 16, 2022
5db17b9
update README.
dxli94 Sep 16, 2022
5d4798a
default cache root.
dxli94 Sep 16, 2022
e28a480
update README.
dxli94 Sep 16, 2022
34b3b69
Merge branch 'main' of https://github.com/salesforce/LAVIS
dxli94 Sep 16, 2022
210d9bc
Update README.md
Sep 19, 2022
70e5e0f
Update README.md
Sep 19, 2022
96d474a
Update README.md
dxli94 Sep 19, 2022
5ea4f13
update app.
dxli94 Sep 19, 2022
2c1c6dd
Update README.md
dxli94 Sep 20, 2022
2d13d3c
Update README.md
dxli94 Sep 20, 2022
ef82902
update docs.
dxli94 Sep 20, 2022
3ca8448
Merge branch 'main' of https://github.com/salesforce/LAVIS
dxli94 Sep 20, 2022
4001f32
(fix) ALBEF feature extractor mismatch keys.
dxli94 Sep 22, 2022
afca26d
Update README.md
dxli94 Sep 22, 2022
1733225
remove license headers from create_annotation_12m.ipynb create_annota…
dxli94 Sep 22, 2022
a2cc24f
Merge branch 'main' of https://github.com/salesforce/LAVIS
dxli94 Sep 22, 2022
b964f12
Update README.md
dxli94 Sep 25, 2022
924d4d4
Update README.md
dxli94 Sep 25, 2022
aa66440
Fix LICENSE link
kpister Sep 25, 2022
a311bb1
Merge pull request #8 from kpister/patch-1
dxli94 Sep 27, 2022
130ad3b
(feat) update zero-shot classfication demo with ALBEF model.
dxli94 Oct 6, 2022
0b74b2e
Merge branch 'main' of https://github.com/salesforce/LAVIS into main
dxli94 Oct 6, 2022
80e1c13
(docs) update docs for ALBEF, BLIP VQA.
dxli94 Oct 6, 2022
8ed6b7a
fix: added `scikit-image` to requirements for run_demo.sh
nick-konovalchuk Oct 5, 2022
2ba2677
Merge pull request #13 from bottledmind/fix/demo-requirements
dxli94 Oct 7, 2022
40ea7e6
(feat) add blip itm and tests.
dxli94 Oct 7, 2022
b4130cd
(docs) add notebook examples.
dxli94 Oct 8, 2022
a0e98de
Merge branch 'main' of https://github.com/salesforce/LAVIS into main
dxli94 Oct 8, 2022
bd0738a
Update README.md
dxli94 Oct 8, 2022
570aef8
Update README.md
dxli94 Oct 11, 2022
2b592e5
fix: changed MRO and removed from
nick-konovalchuk Oct 13, 2022
0fc3171
Merge pull request #20 from bottledmind/fix/gpt-dialogue-loading-issue
henryhungle Oct 15, 2022
b587543
(docs) empty readme for PnP-VQA.
dxli94 Oct 18, 2022
a2ed3d4
Update README.md
dxli94 Oct 18, 2022
7c5a051
(fix) updated SBU annotation url.
dxli94 Oct 19, 2022
c711229
Merge branch 'main' of https://github.com/salesforce/LAVIS
dxli94 Oct 19, 2022
1daccd8
(fix) upload aokvqa vocab to gcp storage and update urls accordingly.
dxli94 Oct 20, 2022
28d9d9e
Pnp vqa (#27)
anthonytmh Oct 25, 2022
d6c54cf
Update README.md to include PnP-VQA.
dxli94 Oct 25, 2022
f95a3da
Update README.md
dxli94 Oct 25, 2022
fa8d067
Update README.md
dxli94 Oct 28, 2022
ae75fb6
Fix git url for git clone in documentation (#21)
gschurck Oct 28, 2022
e71f49c
bug fix for colab pnp_vqa model_type (#38)
anthonytmh Nov 7, 2022
e6caa1b
(fix) downloading sbu caption images from source urls.
dxli94 Nov 21, 2022
702c0fc
(fix) update msrvtt download link, and instructions for further downl…
dxli94 Nov 21, 2022
2e97fd0
Fix error failling VQA evaluation (#59)
raven38 Dec 8, 2022
23d7ca8
Fix barrier on single gpu (#61)
pldlgb Dec 8, 2022
5913ce8
Img2Prompt (#69)
dxli94 Dec 21, 2022
7b40786
Update img2prompt_vqa.ipynb
dxli94 Dec 21, 2022
c61c15d
Update README.md
dxli94 Dec 21, 2022
ea65aab
Update README.md
dxli94 Dec 21, 2022
c8dc409
Update README.md
Dec 22, 2022
fe50fe4
Update README.md
Dec 22, 2022
6e9fd2f
Update README.md
dxli94 Dec 22, 2022
013dd0f
BLIP-2 integration and amp fix (#87)
Jan 26, 2023
3ff9616
update blip2 instructed generation notebook.
dxli94 Jan 26, 2023
b800408
update blip2 instructed generation notebook.
dxli94 Jan 26, 2023
9474e59
update setup.py
dxli94 Jan 26, 2023
f9e0d44
updated requirements.txt with spacy.
dxli94 Jan 26, 2023
bda0774
fix https://github.com/salesforce/LAVIS/issues/68.
dxli94 Jan 26, 2023
229715b
update blip2 demo
Jan 27, 2023
6f7b3ad
update blip2 demo
Jan 27, 2023
48ad4a9
no autocast for cpu
Jan 27, 2023
7d78e80
create blip2 readme
Jan 27, 2023
192560f
allow cpu autocast for t5
Jan 27, 2023
1bfe81b
update blip2 demo
Jan 27, 2023
2e958c1
update blip2 demo
Jan 27, 2023
fcc1ad3
fix device type for blip2_t5.
dxli94 Jan 27, 2023
1bd3686
fix autocast on cuda
Jan 28, 2023
23145a7
Revert "fix autocast on cuda"
Jan 28, 2023
dd1b800
fix autocast for opt
Jan 28, 2023
3aa6d64
Merge branch 'main' of github.com:salesforce/LAVIS into main
Jan 28, 2023
671f543
fix autocast for opt
Jan 28, 2023
1c48800
add illustration figure
Jan 28, 2023
561d8af
update eva source
Jan 30, 2023
4426e83
Merge branch 'main' of github.com:salesforce/LAVIS into main
Jan 30, 2023
d46d598
Update README.md
Jan 30, 2023
0d09ec6
update training yaml
Jan 30, 2023
30e7970
Update README.md
dxli94 Jan 30, 2023
2e96b27
Update README.md
Jan 31, 2023
b822216
Update README.md
Jan 31, 2023
9700552
Update README.md
Jan 31, 2023
a70e108
Update README.md
dxli94 Jan 31, 2023
4edf808
Update README.md
dxli94 Jan 31, 2023
bbe85c4
Update README.md
Jan 31, 2023
a852b02
Update README.md
Jan 31, 2023
f9e02ef
Update README.md
Jan 31, 2023
c4bdd6b
Update README.md
dxli94 Jan 31, 2023
458bbc4
replace blip2 illustration image with high res.
dxli94 Jan 31, 2023
981a636
Fixed typo in BLIP2 readme (#90)
chavinlo Feb 1, 2023
24c8811
Update blip2_qformer.py
Quan-Sun Feb 1, 2023
1b2766b
Merge pull request #94 from Quan-Sun/blip2
Feb 2, 2023
d4bd546
Update README.md
Feb 3, 2023
5d5a559
Update README.md
dxli94 Feb 4, 2023
cc598dc
Update README.md
dxli94 Feb 4, 2023
392e28f
Update README.md
Feb 4, 2023
fa95939
update Google Colab link img2_prompt -> blip2 (#102)
mrdbourke Feb 6, 2023
0769b74
Fix https://github.com/salesforce/LAVIS/issues/100. (#103)
dxli94 Feb 6, 2023
edfd376
Added BLIP2 feature extractor and ITM matching (#104)
dxli94 Feb 6, 2023
9f6429f
update readme with example notebooks
Feb 6, 2023
4fede64
Add COCO finetuning (#117)
dxli94 Feb 8, 2023
1a62e39
GQA evaluation and BLIP2 ITM bugfix. (#121)
dxli94 Feb 9, 2023
1118c1b
add BLIP2 pretraining (#130)
dxli94 Feb 13, 2023
5b06fa4
blip-2 readme add advice on model selection
Feb 15, 2023
c8d8a8c
fix max_txt_len typos in blip2_t5 model
yqy2001 Feb 19, 2023
6958b47
Merge pull request #141 from yqy2001/main
Feb 20, 2023
148f244
pin transformers version >=4.25,<4.27 (#157)
dxli94 Feb 25, 2023
141367f
Dev0.5 (#169)
dxli94 Mar 3, 2023
c8a1735
added clip models vocab file to manifest (#105)
maxi-w Mar 3, 2023
dbea3cd
Fix command path in docs (#109)
Mar 3, 2023
bb5535b
type in getting_started.rst (#53)
altryne Mar 3, 2023
b67358e
Fix typo in intro.rst (#70)
eltociear Mar 3, 2023
c6fb2c4
Fix BLIP2 mixed precision on CPU (#179)
dxli94 Mar 6, 2023
c5ebfdf
Update README.md
Mar 23, 2023
f2ec44d
Update README.md
Mar 23, 2023
745ba73
Renaming img2prompt to img2llm (#213)
dxli94 Mar 24, 2023
3a3018e
20230224 img2llm (#214)
dxli94 Mar 24, 2023
dc34267
add back img2prompt README. (#215)
dxli94 Mar 24, 2023
f713f5f
Add HF mention and example code (#220)
NielsRogge Mar 29, 2023
fd50693
add blip2 model card
LiJunnan1992 Apr 4, 2023
e3fd194
instruct models
May 5, 2023
a7af4ae
taxi image
May 5, 2023
8ee3c44
update blip2-opt for transformers>=4.27
May 5, 2023
62302d1
update blip2_opt to work with transformers>=4.27
May 6, 2023
2ee6793
transformer version check for blip and blip2 models
May 7, 2023
1424a68
transformer version check for blip and blip2 models
May 7, 2023
d771c40
support pretrain from scratch
May 8, 2023
288c795
Update README.md
May 8, 2023
ad83e3e
update example image
May 9, 2023
eaad672
Merge branch 'main' of github.com:salesforce/LAVIS into main
May 9, 2023
8aa38dc
instructblip
May 10, 2023
cdeff33
Create README.md
May 10, 2023
a7236c0
Add files via upload
LiJunnan1992 May 10, 2023
3a94824
Update README.md
May 10, 2023
db854af
Update README.md
May 10, 2023
06d6ebd
Update README.md
May 10, 2023
627adbe
Update README.md
May 10, 2023
9e66acc
Update README.md
May 10, 2023
afb3338
Add files via upload
LiJunnan1992 May 11, 2023
2eda702
Add files via upload
LiJunnan1992 May 11, 2023
1a9aa88
Delete showcase.png
May 11, 2023
fd83234
Add files via upload
LiJunnan1992 May 11, 2023
11c771f
Update README.md
May 11, 2023
e075e97
Update README.md
May 11, 2023
52776dd
Update README.md
May 11, 2023
ecf9ff2
Update README.md
May 12, 2023
e4bd4fd
Update README.md
May 12, 2023
6bd0b9f
Update README.md
May 12, 2023
43cd66f
fix blip2 clip vit layer
May 15, 2023
3bd5a7d
Merge branch 'main' of github.com:salesforce/LAVIS into main
May 15, 2023
f8db665
Update README.md
May 16, 2023
fa300eb
Update clip_vit.py
May 18, 2023
af610d2
fix loss logging issue
May 23, 2023
6f5a165
Blip diffusion first cut (#319)
dxli94 May 23, 2023
b3a3fbf
Update README.md
dxli94 May 24, 2023
b9f9e97
Update README.md
dxli94 May 25, 2023
3d2b535
Update README.md
dxli94 May 25, 2023
7a08d0c
fix gqa post-processing
May 25, 2023
5f7585d
Merge branch 'main' of github.com:salesforce/LAVIS into main
May 25, 2023
c0c6c47
finetune BLIP-2 for coco retrieval
Jul 3, 2023
35923fe
update pnp vqa collab
Jul 7, 2023
fceaaa2
Update README.md
dxli94 Jul 12, 2023
bbac655
20230623 blip diffusion documentation (#441)
dxli94 Jul 21, 2023
2be8ee8
Update README.md
dxli94 Jul 21, 2023
7fe1dd5
Add dependency installation to notebook (#442)
kopyl Jul 21, 2023
61989d7
[hotfix] https://github.com/salesforce/LAVIS/issues/449 (#450)
dxli94 Jul 24, 2023
54c2d64
Update README.md (#452)
Jebiel Jul 25, 2023
ea84b8b
blip diffusion editing and examples. (#462)
dxli94 Aug 1, 2023
e6b5dd4
Update README.md
dxli94 Aug 18, 2023
b693170
Update README.md
dxli94 Sep 25, 2023
174ac24
Init Commit
artemisp Nov 30, 2023
c7ad620
Update main LAVIS readme
artemisp Dec 1, 2023
50ea400
Update README.md
artemisp Dec 1, 2023
f534093
Update vicuna7b_v2.yaml
artemisp Dec 1, 2023
bb1a73b
Update readme
artemisp Dec 5, 2023
0c411c6
Update readme
artemisp Dec 5, 2023
0de4834
Add init files for processors,models,datasets were missed before
artemisp Dec 5, 2023
adf49eb
Add missing files from earlier commit: mostly datasets, and updated t…
artemisp Dec 6, 2023
dee6dda
Updated README
artemisp Dec 8, 2023
b28106d
Merge pull request #599 from artemisp/main
henryhungle Dec 12, 2023
f0317e0
update the requirements and fix the `_expand_mask` import issue
maulikmadhavi May 19, 2024
ef2bf01
update the requirements and fix the `_expand_mask` import issue
May 19, 2024
0871b23
requirements update
maulikmadhavi May 19, 2024
6a00768
Merge branch 'patch-requirements' of https://github.com/maulikmadhavi…
maulikmadhavi Jun 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lavis/models/blip_diffusion_models/modeling_ctx_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,22 @@
from transformers.models.clip.modeling_clip import (
CLIPEncoder,
CLIPPreTrainedModel,
_expand_mask,
)

def _expand_mask(mask: torch.Tensor, dtype: torch.dtype, tgt_len: Optional[int] = None):
"""
Expands attention_mask from `[bsz, seq_len]` to `[bsz, 1, tgt_seq_len, src_seq_len]`.
"""
bsz, src_len = mask.size()
tgt_len = tgt_len if tgt_len is not None else src_len

expanded_mask = mask[:, None, None, :].expand(bsz, 1, tgt_len, src_len).to(dtype)

inverted_mask = 1.0 - expanded_mask

return inverted_mask.masked_fill(inverted_mask.to(torch.bool), torch.finfo(dtype).min)



class CtxCLIPTextModel(CLIPPreTrainedModel):
config_class = CLIPTextConfig
Expand Down
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,19 @@ scikit-image
sentencepiece
spacy
streamlit
timm==0.4.12
timm
torch>=1.10.0
torchvision
tqdm
transformers==4.33.2
transformers
webdataset
wheel
torchaudio
soundfile
moviepy
nltk
peft

easydict==1.9
pyyaml_env_tag==0.1
open3d==0.13.0
open3d
h5py