FederatedAI / FATE

An Industrial Grade Federated Learning Framework
Apache License 2.0
5.72k stars 1.55k forks source link

使用fate rest api预测时出现多余组件问题 #4572

Closed relinda2019 closed 4 months ago

relinda2019 commented 1 year ago

Describe the bug When using the fate rest api to ptrdict, the flowchart has a reader1 branch, but the predict process does not write the reader1 branch in predict dsl. Take vertical xgb binary classification as an example, the flowchart is show as follows:

How to delete the reader1 -> data_transform_1 -> intersection_1.

To Reproduce Steps to reproduce the behavior:

  1. Train

    Url api: /v1/job/submit

    input json:

    {
       "job_runtime_conf": {
           "dsl_version": 2,
           "initiator": {
               "role": "guest",
               "party_id": 10000
           },
           "role": {
               "host": [
                   9997
               ],
               "guest": [
                   10000
               ]
           },
           "component_parameters": {
               "common": {
                   "hetero_secure_boost_0": {
                       "task_type": "classification",
                       "objective_param": {
                           "objective": "cross_entropy"
                       },
                       "num_trees": 3,
                       "validation_freqs": 1,
                       "encrypt_param": {
                           "method": "Paillier"
                       },
                       "tree_param": {
                           "max_depth": 3
                       }
                   },
                   "evaluation_0": {
                       "eval_type": "binary"
                   }
               },
               "role": {
                   "guest": {
                       "0": {
                           "reader_1": {
                               "table": {
                                   "name": "breast_hetero_guest_exam",
                                   "namespace": "breast_hetero_namespace_exam"
                               }
                           },
                           "reader_0": {
                               "table": {
                                   "name": "breast_hetero_test_exam",
                                   "namespace": "breast_hetero_namespace_exam"
                               }
                           },
                           "data_transform_0": {
                               "with_label": true,
                               "output_format": "dense"
                           },
                           "data_transform_1": {
                               "with_label": true,
                               "output_format": "dense"
                           }
                       }
                   },
                   "host": {
                       "0": {
                           "reader_1": {
                               "table": {
                                   "name": "breast_hetero_host_exam",
                                   "namespace": "breast_hetero_namespace_exam"
                               }
                           },
                           "reader_0": {
                               "table": {
                                   "name": "breast_hetero_host_test_exam",
                                   "namespace": "breast_hetero_namespace_exam"
                               }
                           },
                           "data_transform_0": {
                               "with_label": false
                           },
                           "data_transform_1": {
                               "with_label": false
                           }
                       }
                   }
               }
           }
       },
       "job_dsl": {
           "components": {
               "reader_0": {
                   "module": "Reader",
                   "output": {
                       "data": [
                           "data"
                       ]
                   }
               },
               "reader_1": {
                   "module": "Reader",
                   "output": {
                       "data": [
                           "data"
                       ]
                   }
               },
               "data_transform_0": {
                   "module": "DataTransform",
                   "input": {
                       "data": {
                           "data": [
                               "reader_0.data"
                           ]
                       }
                   },
                   "output": {
                       "data": [
                           "data"
                       ],
                       "model": [
                           "model"
                       ]
                   }
               },
               "data_transform_1": {
                   "module": "DataTransform",
                   "input": {
                       "data": {
                           "data": [
                               "reader_1.data"
                           ]
                       },
                       "model": [
                           "data_transform_0.model"
                       ]
                   },
                   "output": {
                       "data": [
                           "data"
                       ],
                       "model": [
                           "model"
                       ]
                   }
               },
               "intersection_0": {
                   "module": "Intersection",
                   "input": {
                       "data": {
                           "data": [
                               "data_transform_0.data"
                           ]
                       }
                   },
                   "output": {
                       "data": [
                           "data"
                       ]
                   }
               },
               "intersection_1": {
                   "module": "Intersection",
                   "input": {
                       "data": {
                           "data": [
                               "data_transform_1.data"
                           ]
                       }
                   },
                   "output": {
                       "data": [
                           "data"
                       ]
                   }
               },
               "hetero_secure_boost_0": {
                   "module": "HeteroSecureBoost",
                   "input": {
                       "data": {
                           "train_data": [
                               "intersection_0.data"
                           ],
                           "validate_data": [
                               "intersection_1.data"
                           ]
                       }
                   },
                   "output": {
                       "data": [
                           "data"
                       ],
                       "model": [
                           "model"
                       ]
                   }
               },
               "evaluation_0": {
                   "module": "Evaluation",
                   "input": {
                       "data": {
                           "data": [
                               "hetero_secure_boost_0.data"
                           ]
                       }
                   },
                   "output": {
                       "data": [
                           "data"
                       ]
                   }
               }
           }
       }
    }
  2. deploy

    Url api: /v1/model/deploy

    input json:

    {
       "model_id": "guest-10000#host-9997#model",
       "model_version": "202301050303281106140"
    }
  3. Predict

    Url api: /v1/job/submit

    input json:

    {
       "job_runtime_conf": {
           "dsl_version": 2,
           "initiator": {
               "role": "guest",
               "party_id": 10000
           },
           "role": {
               "host": [
                   9997
               ],
               "guest": [
                   10000
               ]
           },
           "job_parameters": {
               "common": {
                   "model_id": "guest-10000#host-9997#model",
                   "model_version": "202301050311480240940",
                   "job_type": "predict"
               }
           },
           "component_parameters": {
               "role": {
                   "guest": {
                       "0": {
                           "reader_0": {
                               "table": {
                                   "name": "breast_hetero_test_exam",
                                   "namespace": "breast_hetero_namespace_exam"
                               }
                           }
                       }
                   },
                   "host": {
                       "0": {
                           "reader_0": {
                               "table": {
                                   "name": "breast_hetero_host_test_exam",
                                   "namespace": "breast_hetero_namespace_exam"
                               }
                           }
                       }
                   }
               }
           }
       },
       "job_dsl": {
           "components": {
               "reader_0": {
                   "module": "Reader",
                   "output": {
                       "data": [
                           "data"
                       ]
                   }
               },
               "intersection_0": {
                   "input": {
                       "data": {
                           "data": [
                               "data_transform_0.data"
                           ]
                       }
                   },
                   "module": "Intersection",
                   "output": {
                       "data": [
                           "data"
                       ]
                   }
               },
               "data_transform_0": {
                   "input": {
                       "data": {
                           "data": [
                               "reader_0.data"
                           ]
                       },
                       "model": [
                           "pipeline.data_transform_0.model"
                       ]
                   },
                   "module": "DataTransform",
                   "output": {
                       "data": [
                           "data"
                       ]
                   }
               },
               "hetero_secure_boost_0": {
                   "input": {
                       "data": {
                           "test_data": [
                               "intersection_0.data"
                           ]
                       },
                       "model": [
                           "pipeline.hetero_secure_boost_0.model"
                       ]
                   },
                   "module": "HeteroSecureBoost",
                   "output": {
                       "data": [
                           "data"
                       ]
                   }
               },
               "evaluation_0": {
                   "input": {
                       "data": {
                           "data": [
                               "hetero_secure_boost_0.data"
                           ]
                       }
                   },
                   "module": "Evaluation",
                   "output": {
                       "data": [
                           "data"
                       ]
                   }
               }
           }
       }
    }
  4. See error

    the flowchart for predict has an extra branch. How to delete the extra reader1 -> data_transform_1 -> intersection_1 branch.

Thanks for helping!

relinda2019 commented 1 year ago

训练流程图: 训练

预测流程图, 部署后预测流程多了reader1->data_tranform->intersection_1, 但预测配置中并没有配置:

screenshot-20230105-153417

mgqa34 commented 1 year ago

试下在deploy的时候去指定,也可以指定cpn-list,参考下面的链接: https://federatedai.github.io/FATE-Flow/latest/cli/model/#deploy

github-actions[bot] commented 4 months ago

This issue has been marked as stale because it has been open for 365 days with no activity. If this issue is still relevant or if there is new information, please feel free to update or reopen it.

github-actions[bot] commented 4 months ago

This issue was closed because it has been inactive for 1 days since being marked as stale. If this issue is still relevant or if there is new information, please feel free to update or reopen it.