[feat] update requirements

This commit is contained in:
zhengzangw 2024-05-16 09:53:52 +00:00
parent ef0159f6bf
commit b93a254abb
8 changed files with 55 additions and 76 deletions

View file

@ -146,7 +146,7 @@ Other useful documents and links are listed below.
### Install from Source
For CUDA 12.1, you can install the dependencies with the following commands. Otherwise, please refer to [Installation](docs/installation.md) for more instructions.
For CUDA 12.1, you can install the dependencies with the following commands. Otherwise, please refer to [Installation](docs/installation.md) for more instructions on different cuda version, and additional dependency for data preprocessing.
```bash
# create a virtual env and activate (conda as an example)
@ -159,9 +159,24 @@ pip install -r requirements/requirements_cu121.txt
# install this project
git clone https://github.com/hpcaitech/Open-Sora
cd Open-Sora
# the default installation is for inference only
pip install -v .
```
(Optional, recommended for fast speed, especially for training) To enable `layernorm_kernel` and `flash_attn`, you need to install `apex` and `flash-attn` with the following commands.
```bash
# install flash attention
# set enable_flash_attn=False in config to disable flash attention
pip install packaging ninja
pip install flash-attn --no-build-isolation
# install apex
# set enable_layernorm_kernel=False in config to disable apex
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" git+https://github.com/NVIDIA/apex.git
```
### Use Docker
Run the following command to build a docker image from Dockerfile provided.

View file

@ -18,23 +18,11 @@ pip install torch==2.2.2 torchvision==0.17.2 --index-url https://download.pytorc
pip install xformers --index-url https://download.pytorch.org/whl/cu121
```
## Different Dependencies
The default installation is for inference only. Other optional dependencies are listed below.
```bash
# install flash attention (optional)
# set enable_flash_attn=False in config to avoid using flash attention
pip install packaging ninja
pip install flash-attn --no-build-isolation
# install apex (optional)
# set enable_layernorm_kernel=False in config to avoid using apex
pip install -v --disable-pip-version-check --no-cache-dir --no-build-isolation --config-settings "--build-option=--cpp_ext" --config-settings "--build-option=--cuda_ext" git+https://github.com/NVIDIA/apex.git
pip install -v .[data] # for data preprocessing
pip install -v .[eval] # for evaluation
```
gdown
pre-commit
pyarrow
tensorboard
transformers
wandb
pandarallel
gradio
spaces

View file

@ -16,7 +16,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@ -38,26 +38,9 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/home/zhengzangwei/.conda/envs/opensora/lib/python3.10/site-packages/transformers/utils/generic.py:441: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
" _torch_pytree._register_pytree_node(\n",
"/home/zhengzangwei/.conda/envs/opensora/lib/python3.10/site-packages/colossalai/pipeline/schedule/_utils.py:19: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
" _register_pytree_node(OrderedDict, _odict_flatten, _odict_unflatten)\n",
"/home/zhengzangwei/.conda/envs/opensora/lib/python3.10/site-packages/torch/utils/_pytree.py:254: UserWarning: <class 'collections.OrderedDict'> is already registered as pytree node. Overwriting the previous registration.\n",
" warnings.warn(\n",
"/home/zhengzangwei/.conda/envs/opensora/lib/python3.10/site-packages/transformers/utils/generic.py:309: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
" _torch_pytree._register_pytree_node(\n",
"/home/zhengzangwei/.conda/envs/opensora/lib/python3.10/site-packages/transformers/utils/generic.py:309: UserWarning: torch.utils._pytree._register_pytree_node is deprecated. Please use torch.utils._pytree.register_pytree_node instead.\n",
" _torch_pytree._register_pytree_node(\n"
]
}
],
"outputs": [],
"source": [
"import os\n",
"from pprint import pformat\n",
@ -90,20 +73,9 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"42"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"torch.set_grad_enabled(False)\n",
"\n",
@ -124,24 +96,9 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "dbb26c0ba0824c69b1e1d293fbfe3d9a",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Loading checkpoint shards: 0%| | 0/2 [00:00<?, ?it/s]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"outputs": [],
"source": [
"# == build text-encoder and vae ==\n",
"text_encoder = build_module(cfg.text_encoder, MODELS, device=device)\n",
@ -174,7 +131,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@ -314,7 +271,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@ -513,7 +470,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.9"
"version": "3.10.14"
}
},
"nbformat": 4,

View file

@ -0,0 +1,4 @@
gdown
# [aesthetic]
clip @ git+https://github.com/openai/CLIP.git

View file

View file

@ -1,3 +0,0 @@
packaging
ninja
flash-attn --no-build-isolation

View file

@ -7,3 +7,20 @@ ftfy>=6.2.0 # for t5
diffusers==0.27.2 # for vae
accelerate==0.29.2 # for t5
av>=12.0.0
# [gradio]
gradio
spaces
# [notebook]
ipykernel
ipywidgets
# [training]
wandb
tensorboard
pandarallel
pyarrow # for parquet
# [dev]
pre-commit

View file

@ -77,6 +77,7 @@ setup(
"Topic :: System :: Distributed Computing",
],
extras_require={
"fast": ["flash-attn --no-build-isolation"],
"data": fetch_requirements("requirements/requirements-data.txt"),
"eval": fetch_requirements("requirements/requirements-eval.txt"),
},
)