From 3e88f3f24a95b6142a360a53f69c45bafc92f2b1 Mon Sep 17 00:00:00 2001 From: Davidqian123 Date: Sat, 24 Aug 2024 05:34:18 +0000 Subject: [PATCH 1/2] update --- nexa/cli/entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nexa/cli/entry.py b/nexa/cli/entry.py index bc3aac1c..e1995f28 100644 --- a/nexa/cli/entry.py +++ b/nexa/cli/entry.py @@ -102,7 +102,7 @@ def main(): image_group = run_parser.add_argument_group('Image generation options') image_group.add_argument("-i2i", "--img2img", action="store_true", help="Whether to run image-to-image generation") image_group.add_argument("-ns", "--num_inference_steps", type=int, help="Number of inference steps") - image_group.add_argument("-np", "--num_images_per_prompt", type=int, deafult=1, help="Number of images to generate per prompt") + image_group.add_argument("-np", "--num_images_per_prompt", type=int, default=1, help="Number of images to generate per prompt") image_group.add_argument("-H", "--height", type=int, help="Height of the output image") image_group.add_argument("-W", "--width", type=int, help="Width of the output image") image_group.add_argument("-g", "--guidance_scale", type=float, help="Guidance scale for diffusion") From c5becf2729862d5b2a53f7e6adeae3c5db647eba Mon Sep 17 00:00:00 2001 From: Davidqian123 Date: Sat, 24 Aug 2024 05:35:12 +0000 Subject: [PATCH 2/2] update --- tests/test_vlm_generation.py | 58 ------------------------------------ 1 file changed, 58 deletions(-) delete mode 100644 tests/test_vlm_generation.py diff --git a/tests/test_vlm_generation.py b/tests/test_vlm_generation.py deleted file mode 100644 index b5f2e123..00000000 --- a/tests/test_vlm_generation.py +++ /dev/null @@ -1,58 +0,0 @@ -from nexa.gguf import NexaVLMInference -from tempfile import TemporaryDirectory -from .utils import download_model -import os - -vlm = NexaVLMInference( - model_path="llava-phi-3-mini:q4_0", - local_path=None, -) - -# Test create_chat_completion -def test_create_chat_completion(): - messages = [ - {"role": "system", "content": "You are a helpful assistant."}, - {"role": "user", "content": "What is the capital of France?"} - ] - completion = vlm.create_chat_completion( - messages=messages, - max_tokens=50, - temperature=0.7, - top_p=0.95, - top_k=40, - stream=False - ) - - print(completion) - -# Test _chat method -def test_chat(): - with TemporaryDirectory() as temp_dir: - # Download a sample image - img_url = "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" - img_path = download_model(img_url, temp_dir) - - # Test _chat with image - chat_output = vlm._chat("Describe this image", image_path=img_path) - - # Check if the output is an iterator - assert hasattr(chat_output, '__iter__') - - # Collect the output - output_text = "" - for chunk in chat_output: - assert "choices" in chunk - assert len(chunk["choices"]) > 0 - assert "delta" in chunk["choices"][0] - delta = chunk["choices"][0]["delta"] - if "content" in delta: - output_text += delta["content"] - - assert len(output_text) > 0 - print("_chat test with image passed") - -if __name__ == "__main__": - print("=== Testing 1 ===") - test_create_chat_completion() - print("=== Testing 2 ===") - test_chat() \ No newline at end of file