|
80 | 80 | StatefulSemaphore, |
81 | 81 | api_server_logger, |
82 | 82 | console_logger, |
| 83 | + get_version_info, |
83 | 84 | is_port_available, |
84 | 85 | retrive_model_from_server, |
85 | 86 | ) |
@@ -719,11 +720,60 @@ def config_info() -> Response: |
719 | 720 |
|
720 | 721 | def process_object(obj): |
721 | 722 | if hasattr(obj, "__dict__"): |
722 | | - # 处理有__dict__属性的对象 |
723 | 723 | return obj.__dict__ |
724 | | - return None # 或其他默认处理 |
| 724 | + if isinstance(obj, (set, frozenset)): |
| 725 | + return list(obj) |
| 726 | + return str(obj) |
725 | 727 |
|
726 | 728 | cfg_dict = {k: v for k, v in cfg.__dict__.items()} |
| 729 | + |
| 730 | + # Version info |
| 731 | + cfg_dict["version_info"] = get_version_info() |
| 732 | + |
| 733 | + # Chat template |
| 734 | + cfg_dict["chat_template"] = chat_template |
| 735 | + |
| 736 | + # Server config from args |
| 737 | + cfg_dict["server_config"] = { |
| 738 | + "host": args.host, |
| 739 | + "port": args.port, |
| 740 | + "workers": args.workers, |
| 741 | + "metrics_port": args.metrics_port, |
| 742 | + "controller_port": args.controller_port, |
| 743 | + "max_concurrency": args.max_concurrency, |
| 744 | + "max_waiting_time": args.max_waiting_time, |
| 745 | + "timeout": args.timeout, |
| 746 | + "timeout_graceful_shutdown": args.timeout_graceful_shutdown, |
| 747 | + "served_model_name": args.served_model_name, |
| 748 | + "task": args.task, |
| 749 | + "model_config_name": args.model_config_name, |
| 750 | + "tokenizer_base_url": args.tokenizer_base_url, |
| 751 | + "enable_mm_output": args.enable_mm_output, |
| 752 | + "tool_call_parser": args.tool_call_parser, |
| 753 | + "tool_parser_plugin": args.tool_parser_plugin, |
| 754 | + } |
| 755 | + |
| 756 | + # GPU info |
| 757 | + try: |
| 758 | + import paddle |
| 759 | + |
| 760 | + from fastdeploy.platforms import current_platform |
| 761 | + |
| 762 | + device_info = {} |
| 763 | + device_info["device_type"] = current_platform.device_name |
| 764 | + device_info["device_count"] = paddle.device.cuda.device_count() |
| 765 | + device_ids = str(cfg.parallel_config.device_ids).split(",") if cfg.parallel_config else ["0"] |
| 766 | + first_device = int(device_ids[0].strip()) - 1 |
| 767 | + props = paddle.device.cuda.get_device_properties(first_device) |
| 768 | + device_info["device_name"] = props.name |
| 769 | + device_info["device_total_memory"] = props.total_memory |
| 770 | + device_info["device_multi_processor_count"] = props.multi_processor_count |
| 771 | + device_info["device_major"] = props.major |
| 772 | + device_info["device_minor"] = props.minor |
| 773 | + cfg_dict["device_info"] = device_info |
| 774 | + except Exception: |
| 775 | + cfg_dict["device_info"] = None |
| 776 | + |
727 | 777 | env_dict = {k: v() for k, v in environment_variables.items()} |
728 | 778 | cfg_dict["env_config"] = env_dict |
729 | 779 | result_content = json.dumps(cfg_dict, default=process_object, ensure_ascii=False) |
|
0 commit comments