Skip to content

Commit

Permalink
upgrade sdk to 0.11.2 (#365)
Browse files Browse the repository at this point in the history
* serialization.legacy

* migrate conf_value and float32

* make dtype optional

* fix mapping issue

* fix serialization for FeatureType

* finish db migration
  • Loading branch information
lyuyangh authored Oct 10, 2022
1 parent fb6331a commit b4aed4e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 35 deletions.
2 changes: 1 addition & 1 deletion backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apache-beam~=2.41.0
boto3~=1.24.68
en_core_web_sm@https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.2.0/en_core_web_sm-3.2.0-py3-none-any.whl
explainaboard == 0.11.1
explainaboard == 0.11.2
Flask-PyMongo~=2.3.0
google-cloud-storage~=2.5.0
iso-639~=0.4.5
Expand Down
4 changes: 2 additions & 2 deletions backend/src/impl/db_utils/db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ class DBCollection:
class DBUtils:

# Names of DBs or collections
SYSTEM_OUTPUT_COLLECTION_DB = "system_output_collections_v011"
SYSTEM_OUTPUT_COLLECTION_DB = "system_output_collections_v012"
SYSTEM_OUTPUT_COLLECTION_PREFIX = "system_outputs"
DEV_SYSTEM_METADATA = DBCollection(
db_name="metadata", collection_name="system_metadata_v011"
db_name="metadata", collection_name="system_metadata_v012"
)

@staticmethod
Expand Down
11 changes: 2 additions & 9 deletions backend/src/impl/db_utils/system_db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
import traceback
import zlib
from datetime import datetime
from inspect import getsource
from types import FunctionType
from typing import Any

from bson import ObjectId
from explainaboard import DatalabLoaderOption, FileType, Source, get_processor
from explainaboard.loaders.file_loader import FileLoaderReturn
from explainaboard.loaders.loader_registry import get_loader_class
from explainaboard.utils.serialization import general_to_dict
from explainaboard.serialization.legacy import general_to_dict
from explainaboard_web.impl.auth import get_user
from explainaboard_web.impl.db_utils.dataset_db_utils import DatasetDBUtils
from explainaboard_web.impl.db_utils.db_utils import DBUtils
Expand Down Expand Up @@ -104,6 +102,7 @@ def system_from_dict(
if "metric_stats" in document:
metric_stats = document["metric_stats"]
document["metric_stats"] = []

system = System.from_dict(document)
if include_metric_stats:
# Unbinarize to numpy array and set explicitly
Expand Down Expand Up @@ -486,12 +485,6 @@ def db_operations(session: ClientSession) -> str:

# -- replace things that can't be returned through JSON for now
system.metric_stats = []
for analysis_level in system.system_info.analysis_levels:
for feature_name, feature in analysis_level.features.items():
if isinstance(feature.func, FunctionType):
# Convert the function to a string, this is noqa to prevent a
# typing error
feature.func = getsource(feature.func) # noqa

# -- return the system
return system
Expand Down
2 changes: 1 addition & 1 deletion backend/src/impl/default_controllers_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from explainaboard.info import SysOutputInfo
from explainaboard.loaders import get_loader_class
from explainaboard.metrics.metric import SimpleMetricStats
from explainaboard.serialization.legacy import general_to_dict
from explainaboard.utils.cache_api import get_cache_dir, open_cached_file, sanitize_path
from explainaboard.utils.serialization import general_to_dict
from explainaboard.utils.typing_utils import narrow
from explainaboard_web.impl.analyses.significance_analysis import (
pairwise_significance_test,
Expand Down
18 changes: 0 additions & 18 deletions frontend/src/components/Analysis/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,6 @@ export interface ResultFineGrainedParsed {
cases: number[][];
}

export interface SystemInfoFeatureBucketInfo {
method: string;
number: number;
setting: number | number[];
}

export interface SystemInfoFeature {
/**
* A single feature in the system info class.
*/
bucket_info: SystemInfoFeatureBucketInfo | null;
description: string | null;
dtype?: string;
is_bucket: boolean;
require_training_set: boolean;
_type: string;
}

export interface BucketIntervals {
/**
* Intervals over which to perform bucketing
Expand Down
13 changes: 9 additions & 4 deletions openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: "3.0.0"
info:
title: "ExplainaBoard"
description: "Backend APIs for ExplainaBoard"
version: "0.2.5"
version: "0.2.6"
contact:
email: "[email protected]"
license:
Expand Down Expand Up @@ -628,15 +628,20 @@ components:
properties:
dtype:
type: string
nullable: true
cls_name:
type: string
description:
type: string
nullable: true
func:
type: string
nullable: true
require_training_set:
type: boolean
required: [dtype, cls_name]
nullable: true
additionalProperties: true
required: [cls_name]

SystemInfo:
description: |
Expand Down Expand Up @@ -666,7 +671,7 @@ components:
example: en
reload_stat:
type: boolean
conf_value:
confidence_alpha:
type: number
system_details:
type: object
Expand Down Expand Up @@ -703,7 +708,7 @@ components:
source_language,
target_language,
reload_stat,
conf_value,
confidence_alpha,
source_tokenizer,
target_tokenizer,
analysis_levels,
Expand Down

0 comments on commit b4aed4e

Please sign in to comment.