Browse Source

[MNT] Change semantic specs

tags/v0.3.2
xiey 3 years ago
parent
commit
e9a360281f
7 changed files with 21 additions and 15 deletions
  1. +2
    -2
      examples/example_image/main.py
  2. +2
    -2
      examples/example_m5/main.py
  3. +3
    -3
      examples/example_market_db/example_db.py
  4. +2
    -2
      examples/example_pfs/main.py
  5. +2
    -2
      examples/workflow_by_code/main.py
  6. +7
    -2
      learnware/config.py
  7. +3
    -2
      learnware/market/easy.py

+ 2
- 2
examples/example_image/main.py View File

@@ -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"},


+ 2
- 2
examples/example_m5/main.py View File

@@ -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"},


+ 3
- 3
examples/example_market_db/example_db.py View File

@@ -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"},


+ 2
- 2
examples/example_pfs/main.py View File

@@ -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"},


+ 2
- 2
examples/workflow_by_code/main.py View File

@@ -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"},


+ 7
- 2
learnware/config.py View File

@@ -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": {


+ 3
- 2
learnware/market/easy.py View File

@@ -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



Loading…
Cancel
Save