From f9e6081941ca550068b5ba22615b11dfaedd1d69 Mon Sep 17 00:00:00 2001 From: teowu Date: Wed, 3 Jan 2024 01:53:40 +0800 Subject: [PATCH] AutoModel --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index fcdfd8f..8fa9e5a 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,23 @@ pip install -e ".[train]" pip install flash_attn --no-build-isolation ``` + +## Quicker Start with HuggingFace AutoModel + +No need to install this GitHub repo. + +```python +import requests +import torch +from transformers import AutoModelForCausalLM + +model = AutoModelForCausalLM.from_pretrained("q-future/one-align", trust_remote_code=True, + torch_dtype=torch.float16, device_map={"":"cuda:0"}) + +from PIL import Image +model.score([Image.open(requests.get("https://raw.githubusercontent.com/Q-Future/Q-Align/main/fig/singapore_flyer.jpg", stream=True).raw)], task_="quality", input_="image") # task_ : quality | aesthetics; # input_: image | video + +``` ## Quick Start ### Image Quality Scorer