|
47 | 47 | from fastdeploy.plugins.token_processor import load_token_processor_plugins |
48 | 48 | from fastdeploy.splitwise.internal_adapter_utils import InternalAdapter |
49 | 49 | from fastdeploy.splitwise.splitwise_connector import SplitwiseConnector |
50 | | -from fastdeploy.utils import EngineError, envs, get_logger, llm_logger |
| 50 | +from fastdeploy.utils import ( |
| 51 | + EngineError, |
| 52 | + check_download_links, |
| 53 | + envs, |
| 54 | + get_logger, |
| 55 | + init_bos_client, |
| 56 | + llm_logger, |
| 57 | +) |
51 | 58 |
|
52 | 59 | try: |
53 | 60 | TokenProcessor = load_token_processor_plugins() |
@@ -128,6 +135,7 @@ def __init__(self, cfg, start_queue=True): |
128 | 135 | * self.cfg.cache_config.block_size |
129 | 136 | ) |
130 | 137 |
|
| 138 | + self.bos_client = None |
131 | 139 | self.guided_decoding_checker = None |
132 | 140 | if self.cfg.structured_outputs_config.guided_decoding_backend != "off": |
133 | 141 | self.guided_decoding_checker = schema_checker( |
@@ -827,6 +835,24 @@ def _insert_zmq_task_to_scheduler(self): |
827 | 835 | self.llm_logger.error(f"Receive request error: {err_msg}") |
828 | 836 | results.append((request.request_id, err_msg)) |
829 | 837 |
|
| 838 | + if self._has_features_info(request) and err_msg is None: |
| 839 | + if self.bos_client is None: |
| 840 | + self.bos_client = init_bos_client() |
| 841 | + |
| 842 | + download_urls = [] |
| 843 | + inputs = request.multimodal_inputs |
| 844 | + if inputs.get("video_feature_urls") is not None: |
| 845 | + download_urls.extend(inputs.get("video_feature_urls")) |
| 846 | + if inputs.get("image_feature_urls") is not None: |
| 847 | + download_urls.extend(inputs.get("image_feature_urls")) |
| 848 | + if inputs.get("audio_feature_urls") is not None: |
| 849 | + download_urls.extend(inputs.get("audio_feature_urls")) |
| 850 | + |
| 851 | + err_msg = check_download_links(self.bos_client, download_urls) |
| 852 | + if err_msg: |
| 853 | + llm_logger.error(f"Receive request {request.request_id} download error: {err_msg}") |
| 854 | + results.append((request.request_id, err_msg)) |
| 855 | + |
830 | 856 | if err_msg is None: |
831 | 857 | insert_task.append(request) |
832 | 858 |
|
@@ -877,6 +903,19 @@ def _decode_token(self, token_ids, req_id, is_end): |
877 | 903 | del self.data_processor.decode_status[req_id] |
878 | 904 | return delta_text, token_ids |
879 | 905 |
|
| 906 | + def _has_features_info(self, task): |
| 907 | + inputs = task.multimodal_inputs |
| 908 | + if inputs is None or len(inputs) == 0: |
| 909 | + return False |
| 910 | + |
| 911 | + if ( |
| 912 | + (inputs.get("video_feature_urls") is not None and len(inputs["video_feature_urls"]) > 0) |
| 913 | + or (inputs.get("image_feature_urls") is not None and len(inputs["image_feature_urls"]) > 0) |
| 914 | + or (inputs.get("audio_feature_urls") is not None and len(inputs["audio_feature_urls"]) > 0) |
| 915 | + ): |
| 916 | + return True |
| 917 | + return False |
| 918 | + |
880 | 919 | def _zmq_send_generated_tokens(self): |
881 | 920 | """ |
882 | 921 | Recieve output for zmq |
|
0 commit comments