Browse Source

Merge pull request #98 from Learnware-LAMDA/publish1

Publish Beta 0.2.0.2
tags/v0.3.2
bxdd GitHub 2 years ago
parent
commit
2efa1278dc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 32 deletions
  1. +1
    -1
      learnware/__init__.py
  2. +4
    -2
      learnware/client/learnware_client.py
  3. +5
    -6
      learnware/config.py
  4. +3
    -2
      learnware/market/classes.py
  5. +1
    -21
      setup.py

+ 1
- 1
learnware/__init__.py View File

@@ -1,4 +1,4 @@
__version__ = "0.2.0.1"
__version__ = "0.2.0.2"

import os
import json


+ 4
- 2
learnware/client/learnware_client.py View File

@@ -376,7 +376,8 @@ class LearnwareClient:
from ..market import CondaChecker

stat_checker = CondaChecker(inner_checker=EasyStatChecker())
return stat_checker(learnware)[0] != BaseChecker.INVALID_LEARNWARE
check_status, message = stat_checker(learnware)
return check_status != BaseChecker.INVALID_LEARNWARE, message

@staticmethod
def check_learnware(learnware_zip_path, semantic_specification=None):
@@ -399,7 +400,8 @@ class LearnwareClient:
if learnware is None:
raise Exception("The learnware is not valid.")

assert LearnwareClient._check_stat_specification(learnware), "Stat specification check failed!"
check_status, message = LearnwareClient._check_stat_specification(learnware)
assert check_status is True, message

logger.info("The learnware has passed the test.")



+ 5
- 6
learnware/config.py View File

@@ -55,13 +55,12 @@ class SystemType(Enum):

def get_platform():
import platform

sys_platform = platform.platform().lower()
if "windows" in sys_platform:
return SystemType.WINDOWS
elif "macos" in sys_platform:
os_name = platform.system().lower()
if "macos" in os_name or "darwin" in os_name:
return SystemType.MACOS
elif "linux" in sys_platform:
elif "windows" in os_name:
return SystemType.WINDOWS
elif "linux" in os_name:
return SystemType.LINUX
raise SystemError("Learnware only support MACOS/Linux/Windows")



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

@@ -1,4 +1,5 @@
import traceback
from typing import Tuple
from .base import BaseChecker
from ..learnware import Learnware
from ..client.container import LearnwaresContainer
@@ -12,14 +13,14 @@ class CondaChecker(BaseChecker):
self.inner_checker = inner_checker
super(CondaChecker, self).__init__(**kwargs)

def __call__(self, learnware: Learnware) -> int:
def __call__(self, learnware: Learnware) -> Tuple[int, str]:
try:
with LearnwaresContainer(learnware, ignore_error=False) as env_container:
learnwares = env_container.get_learnwares_with_container()
check_status, message = self.inner_checker(learnwares[0])
except Exception as e:
traceback.print_exc()
message = f"Conda Checker failed due to installed learnware failed and {e}"
message = f"Conda Checker failed due to installed learnware failed or {e}"
logger.warning(message)
message += "\n" + traceback.format_exc()
return BaseChecker.INVALID_LEARNWARE, message


+ 1
- 21
setup.py View File

@@ -29,23 +29,6 @@ VERSION = get_version("learnware/__init__.py")
if os.path.exists("MANIFEST"):
os.remove("MANIFEST")

class SystemType(Enum):
LINUX = 0
MACOS = 1
WINDOWS = 2

def get_platform():
import platform

sys_platform = platform.platform().lower()
if "windows" in sys_platform:
return SystemType.WINDOWS
elif "macos" in sys_platform:
return SystemType.MACOS
elif "linux" in sys_platform:
return SystemType.LINUX
raise SystemError("Learnware only support MACOS/Linux/Windows")


# What packages are required for this module to be executed?
# `estimator` may depend on other packages. In order to reduce dependencies, it is not written here.
@@ -92,14 +75,11 @@ FULL_REQUIRED = [
"torch==2.0.1",
"torchvision==0.15.2",
"torch-optimizer>=0.3.0",
"lightgbm>=3.3.0",
"sentence_transformers==2.2.2",
"fast_pytorch_kmeans==0.2.0.1",
]

# In MACOS, the lightgbm package should be installed with brew.
if get_platform() != SystemType.MACOS:
FULL_REQUIRED += ["lightgbm>=3.3.0"]
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
long_description = f.read()


Loading…
Cancel
Save