From e9a360281f01458fc9bbe37e91152c4d952df171 Mon Sep 17 00:00:00 2001 From: xiey Date: Fri, 21 Apr 2023 19:37:06 +0800 Subject: [PATCH] [MNT] Change semantic specs --- examples/example_image/main.py | 4 ++-- examples/example_m5/main.py | 4 ++-- examples/example_market_db/example_db.py | 6 +++--- examples/example_pfs/main.py | 4 ++-- examples/workflow_by_code/main.py | 4 ++-- learnware/config.py | 9 +++++++-- learnware/market/easy.py | 5 +++-- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/examples/example_image/main.py b/examples/example_image/main.py index 9bc7252..9f4279a 100644 --- a/examples/example_image/main.py +++ b/examples/example_image/main.py @@ -40,7 +40,7 @@ semantic_specs = [ { "Data": {"Values": ["Tabular"], "Type": "Class"}, "Task": {"Values": ["Classification"], "Type": "Class"}, - "Device": {"Values": ["GPU"], "Type": "Tag"}, + "Library": {"Values": ["Pytorch"], "Type": "Tag"}, "Scenario": {"Values": ["Business"], "Type": "Tag"}, "Description": {"Values": "", "Type": "String"}, "Name": {"Values": "learnware_1", "Type": "String"}, @@ -50,7 +50,7 @@ semantic_specs = [ user_senmantic = { "Data": {"Values": ["Tabular"], "Type": "Class"}, "Task": {"Values": ["Classification"], "Type": "Class"}, - "Device": {"Values": ["GPU"], "Type": "Tag"}, + "Library": {"Values": ["Pytorch"], "Type": "Tag"}, "Scenario": {"Values": ["Business"], "Type": "Tag"}, "Description": {"Values": "", "Type": "String"}, "Name": {"Values": "", "Type": "String"}, diff --git a/examples/example_m5/main.py b/examples/example_m5/main.py index 3759bb7..a19b14a 100644 --- a/examples/example_m5/main.py +++ b/examples/example_m5/main.py @@ -17,7 +17,7 @@ semantic_specs = [ { "Data": {"Values": ["Tabular"], "Type": "Class"}, "Task": {"Values": ["Classification"], "Type": "Class"}, - "Device": {"Values": ["GPU"], "Type": "Tag"}, + "Library": {"Values": ["Scikit-learn"], "Type": "Tag"}, "Scenario": {"Values": ["Business"], "Type": "Tag"}, "Description": {"Values": "", "Type": "String"}, "Name": {"Values": "learnware_1", "Type": "String"}, @@ -27,7 +27,7 @@ semantic_specs = [ user_semantic = { "Data": {"Values": ["Tabular"], "Type": "Class"}, "Task": {"Values": ["Classification"], "Type": "Class"}, - "Device": {"Values": ["GPU"], "Type": "Tag"}, + "Library": {"Values": ["Scikit-learn"], "Type": "Tag"}, "Scenario": {"Values": ["Business"], "Type": "Tag"}, "Description": {"Values": "", "Type": "String"}, "Name": {"Values": "", "Type": "String"}, diff --git a/examples/example_market_db/example_db.py b/examples/example_market_db/example_db.py index 11eb4cc..89f7f33 100644 --- a/examples/example_market_db/example_db.py +++ b/examples/example_market_db/example_db.py @@ -15,7 +15,7 @@ semantic_specs = [ { "Data": {"Values": ["Tabular"], "Type": "Class"}, "Task": {"Values": ["Classification"], "Type": "Class"}, - "Device": {"Values": ["GPU"], "Type": "Tag"}, + "Library": {"Values": ["Scikit-learn"], "Type": "Tag"}, "Scenario": {"Values": ["Nature"], "Type": "Tag"}, "Description": {"Values": "", "Type": "String"}, "Name": {"Values": "learnware_1", "Type": "String"}, @@ -23,7 +23,7 @@ semantic_specs = [ { "Data": {"Values": ["Tabular"], "Type": "Class"}, "Task": {"Values": ["Classification"], "Type": "Class"}, - "Device": {"Values": ["GPU"], "Type": "Tag"}, + "Library": {"Values": ["Scikit-learn"], "Type": "Tag"}, "Scenario": {"Values": ["Business", "Nature"], "Type": "Tag"}, "Description": {"Values": "", "Type": "String"}, "Name": {"Values": "learnware_2", "Type": "String"}, @@ -31,7 +31,7 @@ semantic_specs = [ { "Data": {"Values": ["Tabular"], "Type": "Class"}, "Task": {"Values": ["Regression"], "Type": "Class"}, - "Device": {"Values": ["GPU"], "Type": "Tag"}, + "Library": {"Values": ["Scikit-learn"], "Type": "Tag"}, "Scenario": {"Values": ["Business"], "Type": "Tag"}, "Description": {"Values": "", "Type": "String"}, "Name": {"Values": "learnware_3", "Type": "String"}, diff --git a/examples/example_pfs/main.py b/examples/example_pfs/main.py index f42b3a9..f6038dc 100644 --- a/examples/example_pfs/main.py +++ b/examples/example_pfs/main.py @@ -17,7 +17,7 @@ semantic_specs = [ { "Data": {"Values": ["Tabular"], "Type": "Class"}, "Task": {"Values": ["Classification"], "Type": "Class"}, - "Device": {"Values": ["GPU"], "Type": "Tag"}, + "Library": {"Values": ["Scikit-learn"], "Type": "Tag"}, "Scenario": {"Values": ["Business"], "Type": "Tag"}, "Description": {"Values": "", "Type": "String"}, "Name": {"Values": "learnware_1", "Type": "String"}, @@ -27,7 +27,7 @@ semantic_specs = [ user_semantic = { "Data": {"Values": ["Tabular"], "Type": "Class"}, "Task": {"Values": ["Classification"], "Type": "Class"}, - "Device": {"Values": ["GPU"], "Type": "Tag"}, + "Library": {"Values": ["Scikit-learn"], "Type": "Tag"}, "Scenario": {"Values": ["Business"], "Type": "Tag"}, "Description": {"Values": "", "Type": "String"}, "Name": {"Values": "", "Type": "String"}, diff --git a/examples/workflow_by_code/main.py b/examples/workflow_by_code/main.py index 1208c52..204cb07 100644 --- a/examples/workflow_by_code/main.py +++ b/examples/workflow_by_code/main.py @@ -19,7 +19,7 @@ semantic_specs = [ { "Data": {"Values": ["Tabular"], "Type": "Class"}, "Task": {"Values": ["Classification"], "Type": "Class"}, - "Device": {"Values": ["GPU"], "Type": "Tag"}, + "Library": {"Values": ["Scikit-learn"], "Type": "Tag"}, "Scenario": {"Values": ["Business"], "Type": "Tag"}, "Description": {"Values": "", "Type": "String"}, "Name": {"Values": "learnware_1", "Type": "String"}, @@ -32,7 +32,7 @@ user_semantic = { "Values": ["Classification"], "Type": "Class", }, - "Device": {"Values": ["GPU"], "Type": "Tag"}, + "Library": {"Values": ["Scikit-learn"], "Type": "Tag"}, "Scenario": {"Values": ["Business"], "Type": "Tag"}, "Description": {"Values": "", "Type": "String"}, "Name": {"Values": "", "Type": "String"}, diff --git a/learnware/config.py b/learnware/config.py index 18c2a15..2c79f5a 100644 --- a/learnware/config.py +++ b/learnware/config.py @@ -79,11 +79,16 @@ semantic_config = { # "Generation", "Segmentation", "Object Detection", + "Others", ], "Type": "Class", # Choose only one class }, - "Device": { - "Values": ["CPU", "GPU"], + # "Device": { + # "Values": ["CPU", "GPU"], + # "Type": "Tag", + # }, # Choose one or more tags + "Library": { + "Values": ["Scikit-learn", "PyTorch", "TensorFlow", "Others"], "Type": "Tag", }, # Choose one or more tags "Scenario": { diff --git a/learnware/market/easy.py b/learnware/market/easy.py index 4fbe859..1a04f9e 100644 --- a/learnware/market/easy.py +++ b/learnware/market/easy.py @@ -128,7 +128,7 @@ class EasyMarket(BaseMarket): if len(semantic_spec["Task"]["Values"]) == 0: logger.warning("Illegal semantic specification, please choose Task.") return None, False - if len(semantic_spec["Device"]["Values"]) == 0: + if len(semantic_spec["Library"]["Values"]) == 0: logger.warning("Illegal semantic specification, please choose Device.") return None, False if len(semantic_spec["Name"]["Values"]) == 0: @@ -140,7 +140,7 @@ class EasyMarket(BaseMarket): if ( semantic_spec["Data"]["Type"] != "Class" or semantic_spec["Task"]["Type"] != "Class" - or semantic_spec["Device"]["Type"] != "Tag" + or semantic_spec["Library"]["Type"] != "Tag" or semantic_spec["Scenario"]["Type"] != "Tag" or semantic_spec["Name"]["Type"] != "String" or semantic_spec["Description"]["Type"] != "String" @@ -148,6 +148,7 @@ class EasyMarket(BaseMarket): logger.warning("Illegal semantic specification, please provide the right type.") return None, False except: + print(semantic_spec) logger.warning("Illegal semantic specification, some keys are missing.") return None, False