| @@ -6,14 +6,15 @@ nodes: | |||||
| outputs: | outputs: | ||||
| - text | - text | ||||
| env: | env: | ||||
| DATA: "Please only generate the following output: This is a test" | |||||
| TEXT: "Please only generate the following output: This is a test" | |||||
| TEXT_TRUTH: "This is a test" | |||||
| - id: llm | - id: llm | ||||
| build: pip install -e ../../node-hub/dora-llama-cpp-python | build: pip install -e ../../node-hub/dora-llama-cpp-python | ||||
| path: dora-llama-cpp-python | path: dora-llama-cpp-python | ||||
| inputs: | inputs: | ||||
| text: | text: | ||||
| source: benchmark_script/data | |||||
| source: benchmark_script/text | |||||
| queue-size: 10 | queue-size: 10 | ||||
| outputs: | outputs: | ||||
| - text | - text | ||||
| @@ -6,7 +6,8 @@ nodes: | |||||
| outputs: | outputs: | ||||
| - text | - text | ||||
| env: | env: | ||||
| DATA: "Please only generate the following output: This is a test" | |||||
| TEXT: "Please only generate the following output: This is a test" | |||||
| TEXT_TRUTH: "This is a test" | |||||
| - id: llm | - id: llm | ||||
| build: | | build: | | ||||
| @@ -14,6 +15,6 @@ nodes: | |||||
| pip install -e ../../node-hub/dora-phi4 | pip install -e ../../node-hub/dora-phi4 | ||||
| path: dora-phi4 | path: dora-phi4 | ||||
| inputs: | inputs: | ||||
| text: benchmark_script/data | |||||
| text: benchmark_script/text | |||||
| outputs: | outputs: | ||||
| - text | - text | ||||
| @@ -6,13 +6,14 @@ nodes: | |||||
| outputs: | outputs: | ||||
| - text | - text | ||||
| env: | env: | ||||
| DATA: "Please only generate the following output: This is a test" | |||||
| TEXT: "Please only generate the following output: This is a test" | |||||
| TEXT_TRUTH: "This is a test" | |||||
| - id: llm | - id: llm | ||||
| build: | | build: | | ||||
| pip install -e ../../node-hub/dora-qwen | pip install -e ../../node-hub/dora-qwen | ||||
| path: dora-qwen | path: dora-qwen | ||||
| inputs: | inputs: | ||||
| text: benchmark_script/data | |||||
| text: benchmark_script/text | |||||
| outputs: | outputs: | ||||
| - text | - text | ||||
| @@ -6,13 +6,14 @@ nodes: | |||||
| outputs: | outputs: | ||||
| - text | - text | ||||
| env: | env: | ||||
| DATA: "Please only generate the following output: This is a test" | |||||
| TEXT: "Please only generate the following output: This is a test" | |||||
| TEXT_TRUTH: "This is a test" | |||||
| - id: llm | - id: llm | ||||
| build: pip install -e ../../node-hub/dora-transformers | build: pip install -e ../../node-hub/dora-transformers | ||||
| path: dora-transformers | path: dora-transformers | ||||
| inputs: | inputs: | ||||
| text: benchmark_script/data | |||||
| text: benchmark_script/text | |||||
| outputs: | outputs: | ||||
| - text | - text | ||||
| env: | env: | ||||
| @@ -110,7 +110,7 @@ def main(): | |||||
| default="pyarrow-sender", | default="pyarrow-sender", | ||||
| ) | ) | ||||
| parser.add_argument( | parser.add_argument( | ||||
| "--data", | |||||
| "--text", | |||||
| type=str, | type=str, | ||||
| required=False, | required=False, | ||||
| help="Arrow Data as string.", | help="Arrow Data as string.", | ||||
| @@ -119,23 +119,24 @@ def main(): | |||||
| args = parser.parse_args() | args = parser.parse_args() | ||||
| data = os.getenv("DATA", args.data) | |||||
| text = os.getenv("TEXT", args.text) | |||||
| text_truth = os.getenv("TEXT_TRUTH", args.text) | |||||
| cat = get_cat_image() | cat = get_cat_image() | ||||
| audio, sample_rate = get_c3po_audio() | audio, sample_rate = get_c3po_audio() | ||||
| if data is None: | |||||
| if text is None: | |||||
| raise ValueError( | raise ValueError( | ||||
| "No data provided. Please specify `DATA` environment argument or as `--data` argument", | |||||
| "No data provided. Please specify `TEXT` environment argument or as `--text` argument", | |||||
| ) | ) | ||||
| try: | try: | ||||
| data = ast.literal_eval(data) | |||||
| text = ast.literal_eval(text) | |||||
| except Exception: # noqa | except Exception: # noqa | ||||
| print("Passing input as string") | print("Passing input as string") | ||||
| if isinstance(data, (str, int, float)): | |||||
| data = pa.array([data]) | |||||
| if isinstance(text, (str, int, float)): | |||||
| text = pa.array([text]) | |||||
| else: | else: | ||||
| data = pa.array(data) # initialize pyarrow array | |||||
| text = pa.array(text) # initialize pyarrow array | |||||
| node = Node( | node = Node( | ||||
| args.name, | args.name, | ||||
| ) # provide the name to connect to the dataflow if dynamic node | ) # provide the name to connect to the dataflow if dynamic node | ||||
| @@ -156,15 +157,15 @@ def main(): | |||||
| ) | ) | ||||
| time.sleep(0.1) | time.sleep(0.1) | ||||
| start_time = time.time() | start_time = time.time() | ||||
| node.send_output("text", data) | |||||
| node.send_output("text", text) | |||||
| event = node.next() | event = node.next() | ||||
| duration = time.time() - start_time | duration = time.time() - start_time | ||||
| if event is not None and event["type"] == "INPUT": | if event is not None and event["type"] == "INPUT": | ||||
| text = event["value"][0].as_py() | |||||
| received_text = event["value"][0].as_py() | |||||
| tokens = event["metadata"].get("tokens", 6) | tokens = event["metadata"].get("tokens", 6) | ||||
| assert ( | assert ( | ||||
| "this is a cat" in text.lower() | |||||
| ), f"Expected 'This is a cat', got {text}" | |||||
| text_truth in received_text | |||||
| ), f"Expected '{text_truth}', got {received_text}" | |||||
| durations.append(duration) | durations.append(duration) | ||||
| speed.append(tokens / duration) | speed.append(tokens / duration) | ||||
| time.sleep(0.1) | time.sleep(0.1) | ||||
| @@ -8,7 +8,8 @@ nodes: | |||||
| - image | - image | ||||
| - audio | - audio | ||||
| env: | env: | ||||
| DATA: "Please only generate the following output: This is a cat" | |||||
| TEXT: "Please only generate the following output: This is a cat" | |||||
| TEXT_TRUTH: "This is a cat" | |||||
| - id: llm | - id: llm | ||||
| build: | | build: | | ||||
| @@ -7,7 +7,8 @@ nodes: | |||||
| - text | - text | ||||
| - image | - image | ||||
| env: | env: | ||||
| DATA: "Please only generate the following output: This is a test" | |||||
| TEXT: "Please only generate the following output: This is a cat" | |||||
| TEXT_TRUTH: "This is a cat" | |||||
| - id: llm | - id: llm | ||||
| build: pip install -e ../../node-hub/dora-magma | build: pip install -e ../../node-hub/dora-magma | ||||
| @@ -7,7 +7,8 @@ nodes: | |||||
| - text | - text | ||||
| - image | - image | ||||
| env: | env: | ||||
| DATA: "Please only generate the following output: This is a cat" | |||||
| TEXT: "Please only generate the following output: This is a cat" | |||||
| TEXT_TRUTH: "This is a cat" | |||||
| - id: llm | - id: llm | ||||
| build: | | build: | | ||||
| @@ -7,7 +7,8 @@ nodes: | |||||
| - text | - text | ||||
| - image | - image | ||||
| env: | env: | ||||
| DATA: "Please only generate the following output: This is a cat" | |||||
| TEXT: "Please only generate the following output: This is a cat" | |||||
| TEXT_TRUTH: "This is a cat" | |||||
| - id: vlm | - id: vlm | ||||
| # Comment flash_attn if not on cuda hardware | # Comment flash_attn if not on cuda hardware | ||||