diff --git a/.github/workflows/package.json b/.github/workflows/package.json index d166b72..8ec5356 100644 --- a/.github/workflows/package.json +++ b/.github/workflows/package.json @@ -22,6 +22,10 @@ "tag": "Add", "release": "minor" }, + { + "tag": "Break", + "release": "major" + }, { "tag": "Improve", "release": "patch" @@ -46,6 +50,10 @@ "tag": "Add", "release": "minor" }, + { + "tag": "Break", + "release": "major" + }, { "tag": "Improve", "release": "patch" diff --git a/README.md b/README.md index 1bbb7f3..5f57c68 100755 --- a/README.md +++ b/README.md @@ -141,8 +141,8 @@ decoded_text = processor.batch_decode(output[:, prompt_len:])[0] The generative models can be used for chat-like experiences, where the user can provide both text and images as input. To use that feature, you can start with the following CLI command: - -```bash +image +```bashimage uform-chat --model unum-cloud/uform-gen-chat --image_path=zebra.jpg uform-chat --model unum-cloud/uform-gen-chat --image_path=zebra.jpg --device="cuda:0" --fp16 ``` diff --git a/src/uform/chat.py b/src/uform/chat.py index f29ed30..a09269f 100644 --- a/src/uform/chat.py +++ b/src/uform/chat.py @@ -14,9 +14,9 @@ def parse_args(): parser = ArgumentParser(description="Chat with UForm generative model") parser.add_argument("--model", type=str, default="unum-cloud/uform-gen-chat") - parser.add_argument("--image_path", type=str, help="", required=True) + parser.add_argument("--image", type=str, help="", required=True) parser.add_argument("--device", type=str, required=True) - parser.add_argument("--fp16", action="store_true") + parser.add_argument("--fp16", action="store_true") return parser.parse_args() @@ -30,10 +30,10 @@ def run_chat(opts, model, processor): messages = [{"role": "system", "content": "You are a helpful assistant."}] is_first_message = True - if opts.image_path.startswith("http"): + if opts.image.startswith("http"): image = ( processor.image_processor( - Image.open(requests.get(opts.image_path, stream=True).raw) + Image.open(requests.get(opts.image, stream=True).raw) ) .unsqueeze(0) .to(torch.bfloat16 if opts.fp16 else torch.float32) @@ -41,7 +41,7 @@ def run_chat(opts, model, processor): ) else: image = ( - processor.image_processor(Image.open(opts.image_path)) + processor.image_processor(Image.open(opts.image)) .unsqueeze(0) .to(torch.bfloat16 if opts.fp16 else torch.float32) .to(opts.device)