Browse Source

Merge branch 'dev' of ssh://git.nju.edu.cn/learnware/learnware-market into dev

tags/v0.3.2
liuht 3 years ago
parent
commit
cd28dc24e3
4 changed files with 32 additions and 2 deletions
  1. +27
    -0
      examples/workflow_by_code/environment.yml
  2. +1
    -1
      learnware/learnware/base.py
  3. +3
    -0
      learnware/market/base.py
  4. +1
    -1
      learnware/market/easy.py

+ 27
- 0
examples/workflow_by_code/environment.yml View File

@@ -0,0 +1,27 @@
name: learnware_example_env
channels:
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- _openmp_mutex=5.1=1_gnu
- ca-certificates=2023.01.10=h06a4308_0
- ld_impl_linux-64=2.38=h1181459_1
- libffi=3.4.2=h6a678d5_6
- libgcc-ng=11.2.0=h1234567_1
- libgomp=11.2.0=h1234567_1
- libstdcxx-ng=11.2.0=h1234567_1
- ncurses=6.4=h6a678d5_0
- openssl=1.1.1t=h7f8727e_0
- pip=23.0.1=py38h06a4308_0
- python=3.8.16=h7a1cb2a_3
- readline=8.2=h5eee18b_0
- setuptools=66.0.0=py38h06a4308_0
- sqlite=3.41.2=h5eee18b_0
- tk=8.6.12=h1ccaba5_0
- wheel=0.38.4=py38h06a4308_0
- xz=5.2.10=h5eee18b_1
- zlib=1.2.13=h5eee18b_0
- pip:
- joblib==1.2.0
- learnware==0.0.1.99
- numpy==1.19.5

+ 1
- 1
learnware/learnware/base.py View File

@@ -45,7 +45,7 @@ class Learnware:
logger.info("The learnware had been instantiated, thus the instantiation operation is ignored!")
elif isinstance(self.model, dict):
model_module = get_module_by_module_path(self.model["module_path"])
return getattr(model_module, self.model["class_name"])(**self.model.get("kwargs", {}))
self.model = getattr(model_module, self.model["class_name"])(**self.model.get("kwargs", {}))
else:
raise TypeError(f"Model must be BaseModel or dict, not {type(self.model)}")



+ 3
- 0
learnware/market/base.py View File

@@ -49,6 +49,9 @@ class BaseMarket:
learnmarket = BaseMarket()
"""

def __init__(self, market_id: str = None):
self.market_id = market_id

def reload_market(self, market_path: str, semantic_spec_list_path: str) -> bool:
"""Reload the market when server restared.



+ 1
- 1
learnware/market/easy.py View File

@@ -23,7 +23,7 @@ class EasyMarket(BaseMarket):
NOPREDICTION_LEARNWARE = 0
PREDICTION_LEARWARE = 1

def __init__(self, rebuild: bool = False):
def __init__(self, market_id: str = None, rebuild: bool = False):
"""Initialize Learnware Market.
Automatically reload from db if available.
Build an empty db otherwise.


Loading…
Cancel
Save