update readme
Browse files
README.md
CHANGED
|
@@ -27,6 +27,20 @@ TODO
|
|
| 27 |
|
| 28 |
**Tips: Our inference code still under updating, you could update it by assign "--include '\*.py'" in huggingface-cli to only update the inference code, avoid downloading the whole model.*
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
---
|
| 31 |
### 1. Inference w/o. Efficiency Optimization
|
| 32 |
```python
|
|
@@ -88,7 +102,7 @@ import argparse
|
|
| 88 |
|
| 89 |
torch.cuda.reset_peak_memory_stats()
|
| 90 |
# load model
|
| 91 |
-
model_path = '/
|
| 92 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 93 |
device = 'cuda:0' if torch.cuda.is_available() else 'cpu'
|
| 94 |
model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True, device_map=device,quantization_config=None, attn_implementation="sdpa", torch_dtype=torch.float16, low_cpu_mem_usage=True) # sdpa
|
|
|
|
| 27 |
|
| 28 |
**Tips: Our inference code still under updating, you could update it by assign "--include '\*.py'" in huggingface-cli to only update the inference code, avoid downloading the whole model.*
|
| 29 |
|
| 30 |
+
---
|
| 31 |
+
### 0. Installing Required Packages
|
| 32 |
+
```bash
|
| 33 |
+
pip install transformers==4.43.0
|
| 34 |
+
pip install torch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cu121
|
| 35 |
+
pip install decord
|
| 36 |
+
pip install einops
|
| 37 |
+
pip install opencv-python
|
| 38 |
+
pip install accelerate==0.30.0
|
| 39 |
+
pip install numpy==1.26.4
|
| 40 |
+
# optional
|
| 41 |
+
pip install flash-attn --no-build-isolation
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
---
|
| 45 |
### 1. Inference w/o. Efficiency Optimization
|
| 46 |
```python
|
|
|
|
| 102 |
|
| 103 |
torch.cuda.reset_peak_memory_stats()
|
| 104 |
# load model
|
| 105 |
+
model_path = '/root/Models/Video-XL-2'
|
| 106 |
tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 107 |
device = 'cuda:0' if torch.cuda.is_available() else 'cpu'
|
| 108 |
model = AutoModelForCausalLM.from_pretrained(model_path, trust_remote_code=True, device_map=device,quantization_config=None, attn_implementation="sdpa", torch_dtype=torch.float16, low_cpu_mem_usage=True) # sdpa
|