Skip to content

Commit c364c0f

Browse files
author
haoning.wu
committed
Upgrade to transformers==4.36.1; q_align==1.1.0
1 parent d3bae04 commit c364c0f

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

README.md

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,33 @@
5959
</div>
6060
</div>
6161

62-
## [Important Note!]
62+
## [Important Note!] v1.1 <-> transformers==4.36.1
6363

64+
This LLaVA-style repository has been built on `transformers==4.31.0`, which is incompatible with many new models available on Hugging Face. This requires to build a separate environment for the MLLM/LMM repository, which is somewhat troublesome for this **visual scoring** model, as we expect the **Q-Align/OneAlign** to effectively boost other disciplines (image/video generation, *etc*). Both the repository and the **AutoModel** (as follows) are updated to the newest version.
6465

65-
Thus, we have modified respective code for mPLUG-Owl2 to adapt it to the newest transformer version, i.e. `transformers==4.36.1`, so that you do not need to create a separate outdated environment while using it alongside other projects. The updated code is no longer compatible with the old-version Q-Align (v1.0.1/v1.0.0, and before), please update to the newest version via the following scripts:
66+
To this end, we have modified respective code for mPLUG-Owl2 to adapt it to the newest transformer version, i.e. `transformers==4.36.1`, so that you do not need to create a separate outdated environment while using it alongside other projects. The updated code is no longer compatible with the old-version Q-Align (v1.0.1/v1.0.0, and before), please update to the newest version via the following scripts:
6667

6768
```shell
6869
git pull
6970
pip install -e .
7071
```
7172

73+
## [Installation Free!] Quicker Start with HuggingFace AutoModel
74+
75+
No need to install this GitHub repo.
76+
77+
```python
78+
import requests
79+
import torch
80+
from transformers import AutoModelForCausalLM
81+
82+
model = AutoModelForCausalLM.from_pretrained("q-future/one-align", trust_remote_code=True,
83+
torch_dtype=torch.float16, device_map="auto")
84+
85+
from PIL import Image
86+
model.score([Image.open(requests.get("https://raw.githubusercontent.com/Q-Future/Q-Align/main/fig/singapore_flyer.jpg",
87+
stream=True).raw)], task_="quality", input_="image") # task_ : quality | aesthetics; # input_: image | video
88+
```
7289

7390
## Installation
7491

@@ -88,22 +105,7 @@ pip install flash_attn --no-build-isolation
88105
```
89106

90107

91-
## Quicker Start with HuggingFace AutoModel
92108

93-
No need to install this GitHub repo.
94-
95-
```python
96-
import requests
97-
import torch
98-
from transformers import AutoModelForCausalLM
99-
100-
model = AutoModelForCausalLM.from_pretrained("q-future/one-align", trust_remote_code=True,
101-
torch_dtype=torch.float16, device_map="auto")
102-
103-
from PIL import Image
104-
model.score([Image.open(requests.get("https://raw.githubusercontent.com/Q-Future/Q-Align/main/fig/singapore_flyer.jpg",
105-
stream=True).raw)], task_="quality", input_="image") # task_ : quality | aesthetics; # input_: image | video
106-
```
107109
## Quick Start
108110

109111
We have fixed the multi-GPU inference problem.

0 commit comments

Comments
 (0)