Skip to content

Commit

Permalink
feat: first commit with a codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
gwkrsrch committed Dec 14, 2023
1 parent 346146d commit 1baae68
Show file tree
Hide file tree
Showing 76 changed files with 3,907 additions and 10 deletions.
163 changes: 163 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
! tutorial/results/.gitkeep
tutorial/results
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Cream
Copyright (c) 2023-present NAVER Cloud Corp.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
46 changes: 46 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Cream
Copyright (c) 2023-present NAVER Cloud Corp.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--------------------------------------------------------------------------------------

This project contains subcomponents with separate copyright notices and license terms.
Your use of the source code for these subcomponents is subject to the terms and conditions of the following licenses.

=====

huggingface/transformers
https://github.com/huggingface/transformers


Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.

=====
66 changes: 56 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,72 @@
<div align="center">

# Cream🍦: Visually-Situated Natural Language Understanding with Contrastive Reading Model and Frozen Large Language Models
[![Paper](https://img.shields.io/badge/Paper-arxiv.2305.15080-orange)](https://arxiv.org/abs/2305.15080)
[![Conference](https://img.shields.io/badge/EMNLP-2023-red)](#how-to-cite)

Official Implementation of Cream | [Paper](https://arxiv.org/abs/2305.15080) | [Slide](https://docs.google.com/presentation/d/1KziORzEtfHelFmhDWGq9WXIlQzTSGHoiOylxbSK4jPs/edit?usp=sharing) | [Poster](https://drive.google.com/file/d/1nYzBgy9a1o0BunD5jsywPecGpPJakCz1/view?usp=sharing)
</div>

## Introduction
Cream (Contrastive Reading Model) is a language-image understanding module designed to enhance the visually-situated natural language understanding capability in Large Language Models (LLMs). The primary goal of Cream is to effectively capture intricate details in images (e.g., texts), ensuring accurate responses in various visual langauge precessing applications.

Our academic paper, which describes our method in detail and provides full experimental results and analyses, can be found here:<br>
> [**Visually-Situated Natural Language Understanding with Contrastive Reading Model and Frozen Large Language Models**](https://arxiv.org/abs/2305.15080).<br>
> [Geewook Kim](https://geewook.kim), [Hodong Lee](https://scholar.google.com/citations?user=XRuGyvkAAAAJ), [Daehee Kim](https://scholar.google.com/citations?user=x_tWgpsAAAAJ), [Haeji Jung](https://scholar.google.com/citations?user=cyhTZ0MAAAAJ), [Sanghee Park](https://scholar.google.com/citations?user=_ryVHp0AAAAJ), [Yoonsik Kim](https://scholar.google.com/citations?user=nuxd_BsAAAAJ), [Sangdoo Yun](https://sangdooyun.github.io), [Taeho Kil](https://scholar.google.co.kr/citations?user=cV4h5MsAAAAJ), [Bado Lee](https://scholar.google.co.kr/citations?user=UAcfGOgAAAAJ), [Seunghyun Park](https://scholar.google.com/citations?user=iowjmTwAAAAJ). In EMNLP 2023.
[![Paper](https://img.shields.io/badge/Paper-arxiv.2305.15080-red)](https://arxiv.org/abs/2305.15080)

The repository will be updated to contain the codebase and datasets for the paper:
## Updates

***2023-12-08*** First commit with a codebase. Further updates will follow shortly.

## Software Installation

```bash
pip install .
```

**"[Cream🍦: Visually-Situated Natural Language Understanding with Contrastive Reading Model and Frozen Large Language Models](https://arxiv.org/abs/2305.15080)"**
If you want to run `train.py` or `test.py`, please also install other dependencies:

Please stay tuned for the updates and thank you for your patience.
```bash
pip install -r requirements.txt
```

In the meantime, we invite you to read our paper for a comprehensive understanding of Cream and its implementation.

## Citation

If you find our work useful in your work, please consider citing our paper:

```
@misc{kim2023cream,
title={Cream: Visually-Situated Natural Language Understanding with Contrastive Reading Model and Frozen Large Language Models},
@inproceedings{kim2023cream,
title={Visually-Situated Natural Language Understanding with Contrastive Reading Model and Frozen Large Language Models},
author={Geewook Kim and Hodong Lee and Daehee Kim and Haeji Jung and Sanghee Park and Yoonsik Kim and Sangdoo Yun and Taeho Kil and Bado Lee and Seunghyun Park},
booktitle = {Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing},
year={2023},
eprint={2305.15080},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
```

## License

```
MIT license
Copyright (c) 2023-present NAVER Cloud Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
```
24 changes: 24 additions & 0 deletions cream/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Cream
Copyright (c) 2023-present NAVER Cloud Corp.
MIT license"""
from ._version import __version__
from .model import (
CreamAuxilaryEncoder,
CreamConfig,
CreamModel,
CreamVisionEncoder,
PrefixLMAttention,
get_pos_embed,
)
from .util import CreamDataset

__all__ = [
"__version__",
"CreamConfig",
"CreamModel",
"CreamAuxilaryEncoder",
"CreamVisionEncoder",
"PrefixLMAttention",
"get_pos_embed",
"CreamDataset",
]
4 changes: 4 additions & 0 deletions cream/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Cream
Copyright (c) 2023-present NAVER Cloud Corp.
MIT license"""
__version__ = "0.0.1"
Loading

0 comments on commit 1baae68

Please sign in to comment.