diff --git a/.gitattributes b/.gitattributes index 84d17c0c139c5f0a86caf38d71561e2aff949fad..8deb701af1e02621d3f7b222d1b26ac5223979a8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2819,3 +2819,36 @@ SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/ef SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/ef_vfm/result/pipeline_c19/adapter_efvfm/100/shapes.csv filter=lfs diff=lfs merge=lfs -text SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/ef_vfm/result/pipeline_c19/adapter_efvfm/100/trends.csv filter=lfs diff=lfs merge=lfs -text SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/pyproject.toml filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/synthetic/pipeline_c19/real.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/synthetic/pipeline_c19/test.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/synthetic/pipeline_c19/val.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/gen_20260510_210653.log filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/input_snapshot.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/models_tabbyflow/trained.pt filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/public_gate/normalized_schema_snapshot.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/public_gate/public_gate_report.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/public_gate/staged_input_manifest.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/run_config.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/runtime_result.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/staged_features.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/test.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/train.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/val.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/tabbyflow/adapter_report.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/tabbyflow/adapter_transforms_applied.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/tabbyflow/model_input_manifest.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabbyflow-c19-32759-20260510_210653.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabbyflow_train_meta.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_cat_test.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_cat_train.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_cat_val.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_num_test.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_num_train.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_num_val.npy filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/info.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/real.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/staged_features.json filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/test.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/train.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/val.csv filter=lfs diff=lfs merge=lfs -text +SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/y_test.npy filter=lfs diff=lfs merge=lfs -text diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/src/env.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/src/env.py new file mode 100644 index 0000000000000000000000000000000000000000..0b9dd619f31450414a9b31585aa58b9121834fbe --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/src/env.py @@ -0,0 +1,39 @@ +""" +Have not used in TabDDPM project. +""" + +import datetime +import os +import shutil +import typing as ty +from pathlib import Path + +PROJ = Path('tab-ddpm/').absolute().resolve() +EXP = PROJ / 'exp' +DATA = PROJ / 'data' + + +def get_path(path: ty.Union[str, Path]) -> Path: + if isinstance(path, str): + path = Path(path) + if not path.is_absolute(): + path = PROJ / path + return path.resolve() + + +def get_relative_path(path: ty.Union[str, Path]) -> Path: + return get_path(path).relative_to(PROJ) + + +def duplicate_path( + src: ty.Union[str, Path], alternative_project_dir: ty.Union[str, Path] +) -> None: + src = get_path(src) + alternative_project_dir = get_path(alternative_project_dir) + dst = alternative_project_dir / src.relative_to(PROJ) + dst.parent.mkdir(parents=True, exist_ok=True) + if dst.exists(): + dst = dst.with_name( + dst.name + '_' + datetime.datetime.now().strftime('%Y%m%dT%H%M%S') + ) + (shutil.copytree if src.is_dir() else shutil.copyfile)(src, dst) \ No newline at end of file diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/src/metrics.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/src/metrics.py new file mode 100644 index 0000000000000000000000000000000000000000..188a9be3f8e9d59b07688aa189a876660dbef7cd --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/src/metrics.py @@ -0,0 +1,157 @@ +import enum +from typing import Any, Optional, Tuple, Dict, Union, cast +from functools import partial + +import numpy as np +import scipy.special +import sklearn.metrics as skm + +from . import util +from .util import TaskType + + +class PredictionType(enum.Enum): + LOGITS = 'logits' + PROBS = 'probs' + +class MetricsReport: + def __init__(self, report: dict, task_type: TaskType): + self._res = {k: {} for k in report.keys()} + if task_type in (TaskType.BINCLASS, TaskType.MULTICLASS): + self._metrics_names = ["acc", "f1"] + for k in report.keys(): + self._res[k]["acc"] = report[k]["accuracy"] + self._res[k]["f1"] = report[k]["macro avg"]["f1-score"] + if task_type == TaskType.BINCLASS: + self._res[k]["roc_auc"] = report[k]["roc_auc"] + self._metrics_names.append("roc_auc") + + elif task_type == TaskType.REGRESSION: + self._metrics_names = ["r2", "rmse"] + for k in report.keys(): + self._res[k]["r2"] = report[k]["r2"] + self._res[k]["rmse"] = report[k]["rmse"] + else: + raise "Unknown TaskType!" + + def get_splits_names(self) -> list[str]: + return self._res.keys() + + def get_metrics_names(self) -> list[str]: + return self._metrics_names + + def get_metric(self, split: str, metric: str) -> float: + return self._res[split][metric] + + def get_val_score(self) -> float: + return self._res["val"]["r2"] if "r2" in self._res["val"] else self._res["val"]["f1"] + + def get_test_score(self) -> float: + return self._res["test"]["r2"] if "r2" in self._res["test"] else self._res["test"]["f1"] + + def print_metrics(self) -> None: + res = { + "val": {k: np.around(self._res["val"][k], 4) for k in self._res["val"]}, + "test": {k: np.around(self._res["test"][k], 4) for k in self._res["test"]} + } + + print("*"*100) + print("[val]") + print(res["val"]) + print("[test]") + print(res["test"]) + + return res + +class SeedsMetricsReport: + def __init__(self): + self._reports = [] + + def add_report(self, report: MetricsReport) -> None: + self._reports.append(report) + + def get_mean_std(self) -> dict: + res = {k: {} for k in ["train", "val", "test"]} + for split in self._reports[0].get_splits_names(): + for metric in self._reports[0].get_metrics_names(): + res[split][metric] = [x.get_metric(split, metric) for x in self._reports] + + agg_res = {k: {} for k in ["train", "val", "test"]} + for split in self._reports[0].get_splits_names(): + for metric in self._reports[0].get_metrics_names(): + for k, f in [("count", len), ("mean", np.mean), ("std", np.std)]: + agg_res[split][f"{metric}-{k}"] = f(res[split][metric]) + self._res = res + self._agg_res = agg_res + + return agg_res + + def print_result(self) -> dict: + res = {split: {k: float(np.around(self._agg_res[split][k], 4)) for k in self._agg_res[split]} for split in ["val", "test"]} + print("="*100) + print("EVAL RESULTS:") + print("[val]") + print(res["val"]) + print("[test]") + print(res["test"]) + print("="*100) + return res + +def calculate_rmse( + y_true: np.ndarray, y_pred: np.ndarray, std = None) -> float: + rmse = skm.mean_squared_error(y_true, y_pred) ** 0.5 + if std is not None: + rmse *= std + return rmse + + +def _get_labels_and_probs( + y_pred: np.ndarray, task_type: TaskType, prediction_type: Optional[PredictionType] +) -> Tuple[np.ndarray, Optional[np.ndarray]]: + assert task_type in (TaskType.BINCLASS, TaskType.MULTICLASS) + + if prediction_type is None: + return y_pred, None + + if prediction_type == PredictionType.LOGITS: + probs = ( + scipy.special.expit(y_pred) + if task_type == TaskType.BINCLASS + else scipy.special.softmax(y_pred, axis=1) + ) + elif prediction_type == PredictionType.PROBS: + probs = y_pred + else: + util.raise_unknown('prediction_type', prediction_type) + + assert probs is not None + labels = np.round(probs) if task_type == TaskType.BINCLASS else probs.argmax(axis=1) + return labels.astype('int64'), probs + + +def calculate_metrics( + y_true: np.ndarray, + y_pred: np.ndarray, + task_type: Union[str, TaskType], + prediction_type: Optional[Union[str, PredictionType]], + y_info: Dict[str, Any], +) -> Dict[str, Any]: + # Example: calculate_metrics(y_true, y_pred, 'binclass', 'logits', {}) + task_type = TaskType(task_type) + if prediction_type is not None: + prediction_type = PredictionType(prediction_type) + + if task_type == TaskType.REGRESSION: + assert prediction_type is None + assert 'std' in y_info + rmse = calculate_rmse(y_true, y_pred, y_info['std']) + r2 = skm.r2_score(y_true, y_pred) + result = {'rmse': rmse, 'r2': r2} + else: + labels, probs = _get_labels_and_probs(y_pred, task_type, prediction_type) + result = cast( + Dict[str, Any], skm.classification_report(y_true, labels, output_dict=True) + ) + if task_type == TaskType.BINCLASS: + result['roc_auc'] = skm.roc_auc_score(y_true, probs) + return result \ No newline at end of file diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/src/util.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/src/util.py new file mode 100644 index 0000000000000000000000000000000000000000..e105c961803b3bf0f8282e673eed8e84eaaa3891 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/src/util.py @@ -0,0 +1,347 @@ +import argparse +import atexit +import enum +import json +import os +import pickle +import shutil +import sys +import time +import uuid +from copy import deepcopy +from dataclasses import asdict, fields, is_dataclass +from pathlib import Path +from pprint import pprint +from typing import Any, Callable, List, Dict, Type, Optional, Tuple, TypeVar, Union, cast, get_args, get_origin + +import __main__ +import numpy as np +import tomli +import tomli_w +import torch +import typing as ty + +from . import env + +RawConfig = Dict[str, Any] +Report = Dict[str, Any] +T = TypeVar('T') + + +class Part(enum.Enum): + TRAIN = 'train' + VAL = 'val' + TEST = 'test' + + def __str__(self) -> str: + return self.value + + +class TaskType(enum.Enum): + BINCLASS = 'binclass' + MULTICLASS = 'multiclass' + REGRESSION = 'regression' + + def __str__(self) -> str: + return self.value + + + +def update_training_log(training_log, data, metrics): + def _update(log_part, data_part): + for k, v in data_part.items(): + if isinstance(v, dict): + _update(log_part.setdefault(k, {}), v) + elif isinstance(v, list): + log_part.setdefault(k, []).extend(v) + else: + log_part.setdefault(k, []).append(v) + + _update(training_log, data) + transposed_metrics = {} + for part, part_metrics in metrics.items(): + for metric_name, value in part_metrics.items(): + transposed_metrics.setdefault(metric_name, {})[part] = value + _update(training_log, transposed_metrics) + + +def raise_unknown(unknown_what: str, unknown_value: Any): + raise ValueError(f'Unknown {unknown_what}: {unknown_value}') + + +def _replace(data, condition, value): + def do(x): + if isinstance(x, dict): + return {k: do(v) for k, v in x.items()} + elif isinstance(x, list): + return [do(y) for y in x] + else: + return value if condition(x) else x + + return do(data) + + +_CONFIG_NONE = '__none__' + + +def unpack_config(config: RawConfig) -> RawConfig: + config = cast(RawConfig, _replace(config, lambda x: x == _CONFIG_NONE, None)) + return config + + +def pack_config(config: RawConfig) -> RawConfig: + config = cast(RawConfig, _replace(config, lambda x: x is None, _CONFIG_NONE)) + return config + + +def load_config(path: Union[Path, str]) -> Any: + with open(path, 'rb') as f: + return unpack_config(tomli.load(f)) + + +def dump_config(config: Any, path: Union[Path, str]) -> None: + with open(path, 'wb') as f: + tomli_w.dump(pack_config(config), f) + # check that there are no bugs in all these "pack/unpack" things + assert config == load_config(path) + + +def load_json(path: Union[Path, str], **kwargs) -> Any: + return json.loads(Path(path).read_text(), **kwargs) + + +def dump_json(x: Any, path: Union[Path, str], **kwargs) -> None: + kwargs.setdefault('indent', 4) + Path(path).write_text(json.dumps(x, **kwargs) + '\n') + + +def load_pickle(path: Union[Path, str], **kwargs) -> Any: + return pickle.loads(Path(path).read_bytes(), **kwargs) + + +def dump_pickle(x: Any, path: Union[Path, str], **kwargs) -> None: + Path(path).write_bytes(pickle.dumps(x, **kwargs)) + + +def load(path: Union[Path, str], **kwargs) -> Any: + return globals()[f'load_{Path(path).suffix[1:]}'](Path(path), **kwargs) + + +def dump(x: Any, path: Union[Path, str], **kwargs) -> Any: + return globals()[f'dump_{Path(path).suffix[1:]}'](x, Path(path), **kwargs) + + +def _get_output_item_path( + path: Union[str, Path], filename: str, must_exist: bool +) -> Path: + path = env.get_path(path) + if path.suffix == '.toml': + path = path.with_suffix('') + if path.is_dir(): + path = path / filename + else: + assert path.name == filename + assert path.parent.exists() + if must_exist: + assert path.exists() + return path + + +def load_report(path: Path) -> Report: + return load_json(_get_output_item_path(path, 'report.json', True)) + + +def dump_report(report: dict, path: Path) -> None: + dump_json(report, _get_output_item_path(path, 'report.json', False)) + + +def load_predictions(path: Path) -> Dict[str, np.ndarray]: + with np.load(_get_output_item_path(path, 'predictions.npz', True)) as predictions: + return {x: predictions[x] for x in predictions} + + +def dump_predictions(predictions: Dict[str, np.ndarray], path: Path) -> None: + np.savez(_get_output_item_path(path, 'predictions.npz', False), **predictions) + + +def dump_metrics(metrics: Dict[str, Any], path: Path) -> None: + dump_json(metrics, _get_output_item_path(path, 'metrics.json', False)) + + +def load_checkpoint(path: Path, *args, **kwargs) -> Dict[str, np.ndarray]: + return torch.load( + _get_output_item_path(path, 'checkpoint.pt', True), *args, **kwargs + ) + + +def get_device() -> torch.device: + if torch.cuda.is_available(): + assert os.environ.get('CUDA_VISIBLE_DEVICES') is not None + return torch.device('cuda:0') + else: + return torch.device('cpu') + + +def _print_sep(c, size=100): + print(c * size) + + +_LAST_SNAPSHOT_TIME = None + + +def backup_output(output_dir: Path) -> None: + backup_dir = os.environ.get('TMP_OUTPUT_PATH') + snapshot_dir = os.environ.get('SNAPSHOT_PATH') + if backup_dir is None: + assert snapshot_dir is None + return + assert snapshot_dir is not None + + try: + relative_output_dir = output_dir.relative_to(env.PROJ) + except ValueError: + return + + for dir_ in [backup_dir, snapshot_dir]: + new_output_dir = dir_ / relative_output_dir + prev_backup_output_dir = new_output_dir.with_name(new_output_dir.name + '_prev') + new_output_dir.parent.mkdir(exist_ok=True, parents=True) + if new_output_dir.exists(): + new_output_dir.rename(prev_backup_output_dir) + shutil.copytree(output_dir, new_output_dir) + # the case for evaluate.py which automatically creates configs + if output_dir.with_suffix('.toml').exists(): + shutil.copyfile( + output_dir.with_suffix('.toml'), new_output_dir.with_suffix('.toml') + ) + if prev_backup_output_dir.exists(): + shutil.rmtree(prev_backup_output_dir) + + global _LAST_SNAPSHOT_TIME + if _LAST_SNAPSHOT_TIME is None or time.time() - _LAST_SNAPSHOT_TIME > 10 * 60: + import nirvana_dl.snapshot # type: ignore[code] + + nirvana_dl.snapshot.dump_snapshot() + _LAST_SNAPSHOT_TIME = time.time() + print('The snapshot was saved!') + + +def _get_scores(metrics: Dict[str, Dict[str, Any]]) -> Optional[Dict[str, float]]: + return ( + {k: v['score'] for k, v in metrics.items()} + if 'score' in next(iter(metrics.values())) + else None + ) + + +def format_scores(metrics: Dict[str, Dict[str, Any]]) -> str: + return ' '.join( + f"[{x}] {metrics[x]['score']:.3f}" + for x in ['test', 'val', 'train'] + if x in metrics + ) + + +def finish(output_dir: Path, report: dict) -> None: + print() + _print_sep('=') + + metrics = report.get('metrics') + if metrics is not None: + scores = _get_scores(metrics) + if scores is not None: + dump_json(scores, output_dir / 'scores.json') + print(format_scores(metrics)) + _print_sep('-') + + dump_report(report, output_dir) + json_output_path = os.environ.get('JSON_OUTPUT_FILE') + if json_output_path: + try: + key = str(output_dir.relative_to(env.PROJ)) + except ValueError: + pass + else: + json_output_path = Path(json_output_path) + try: + json_data = json.loads(json_output_path.read_text()) + except (FileNotFoundError, json.decoder.JSONDecodeError): + json_data = {} + json_data[key] = load_json(output_dir / 'report.json') + json_output_path.write_text(json.dumps(json_data, indent=4)) + shutil.copyfile( + json_output_path, + os.path.join(os.environ['SNAPSHOT_PATH'], 'json_output.json'), + ) + + output_dir.joinpath('DONE').touch() + backup_output(output_dir) + print(f'Done! | {report.get("time")} | {output_dir}') + _print_sep('=') + print() + + +def from_dict(datacls: Type[T], data: dict) -> T: + assert is_dataclass(datacls) + data = deepcopy(data) + for field in fields(datacls): + if field.name not in data: + continue + if is_dataclass(field.type): + data[field.name] = from_dict(field.type, data[field.name]) + elif ( + get_origin(field.type) is Union + and len(get_args(field.type)) == 2 + and get_args(field.type)[1] is type(None) + and is_dataclass(get_args(field.type)[0]) + ): + if data[field.name] is not None: + data[field.name] = from_dict(get_args(field.type)[0], data[field.name]) + return datacls(**data) + + +def replace_factor_with_value( + config: RawConfig, + key: str, + reference_value: int, + bounds: Tuple[float, float], +) -> None: + factor_key = key + '_factor' + if factor_key not in config: + assert key in config + else: + assert key not in config + factor = config.pop(factor_key) + assert bounds[0] <= factor <= bounds[1] + config[key] = int(factor * reference_value) + + +def get_temporary_copy(path: Union[str, Path]) -> Path: + path = env.get_path(path) + assert not path.is_dir() and not path.is_symlink() + tmp_path = path.with_name( + path.stem + '___' + str(uuid.uuid4()).replace('-', '') + path.suffix + ) + shutil.copyfile(path, tmp_path) + atexit.register(lambda: tmp_path.unlink()) + return tmp_path + + +def get_python(): + python = Path('python3.9') + return str(python) if python.exists() else 'python' + +def get_catboost_config(real_data_path, is_cv=False): + ds_name = Path(real_data_path).name + C = load_json(f'tuned_models/catboost/{ds_name}_cv.json') + return C + +def get_categories(X_train_cat): + return ( + None + if X_train_cat is None + else [ + len(set(X_train_cat[:, i])) + for i in range(X_train_cat.shape[1]) + ] + ) \ No newline at end of file diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/synthetic/pipeline_c19/real.csv b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/synthetic/pipeline_c19/real.csv new file mode 100644 index 0000000000000000000000000000000000000000..0dd04cf8cc5b17cba0a4a176cbd5639b58b972a4 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/synthetic/pipeline_c19/real.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:092346325db7f445db2c00d2f5dd9a8397ecc33eaba7b2b14d9d48d92659fcfc +size 51459027 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/synthetic/pipeline_c19/test.csv b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/synthetic/pipeline_c19/test.csv new file mode 100644 index 0000000000000000000000000000000000000000..cb9afc272bf187c8a1c1827116ca6dc7c4bbe054 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/synthetic/pipeline_c19/test.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd9c98343a92c7b1afe63b402f07b9a55013adbfcc60ec1e17d5e026385eeec8 +size 6304860 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/synthetic/pipeline_c19/val.csv b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/synthetic/pipeline_c19/val.csv new file mode 100644 index 0000000000000000000000000000000000000000..cbb1e83d2c80952e08b23dcc09f8cb5cea219a6a --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/synthetic/pipeline_c19/val.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69c75639e81916d3b4f2a28db38d7e15c78e442748aa5bf9fed2eb3784912a70 +size 6331589 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/conftest.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/conftest.py new file mode 100644 index 0000000000000000000000000000000000000000..f06feabdb2e28287232689c91868cc8e58730387 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/conftest.py @@ -0,0 +1,193 @@ +import pytest +import numpy as np +import torch +import torch.nn.functional as F +from unittest.mock import MagicMock + + +# --------------- dimension configs --------------- + +@pytest.fixture +def dims(): + """Standard mixed-data dimensions.""" + return {"d_numerical": 4, "categories": np.array([3, 5, 2]), "batch_size": 8, "d_token": 16} + + +@pytest.fixture +def dims_numerical_only(): + """Numerical-only scenario (no categorical features).""" + return {"d_numerical": 5, "categories": None, "batch_size": 8, "d_token": 16} + + +@pytest.fixture +def dims_single(): + """Minimal scenario: 1 numerical, 1 categorical with 2 classes.""" + return {"d_numerical": 1, "categories": np.array([2]), "batch_size": 4, "d_token": 8} + + +# --------------- dummy input factory --------------- + +@pytest.fixture +def make_dummy_inputs(): + """Factory: returns (x_num, x_cat_onehot, x_cat_int, timesteps) from any dims.""" + def _make(d_numerical, categories, batch_size): + torch.manual_seed(42) + x_num = torch.randn(batch_size, d_numerical) + if categories is not None and len(categories) > 0: + cat_parts = [] + for k in categories: + indices = torch.randint(0, k, (batch_size,)) + cat_parts.append(F.one_hot(indices, k).float()) + x_cat_onehot = torch.cat(cat_parts, dim=1) + x_cat_int = torch.stack( + [torch.randint(0, k, (batch_size,)) for k in categories], dim=1 + ) + else: + x_cat_onehot = None + x_cat_int = None + timesteps = torch.rand(batch_size) + return x_num, x_cat_onehot, x_cat_int, timesteps + return _make + + +# --------------- model factories --------------- + +@pytest.fixture +def make_tokenizer(): + from ef_vfm.modules.transformer import Tokenizer + def _make(d_numerical, categories, d_token, bias=True): + cats = list(categories) if categories is not None else None + return Tokenizer(d_numerical, cats, d_token, bias) + return _make + + +@pytest.fixture +def make_transformer(): + from ef_vfm.modules.transformer import Transformer + def _make(d_token, n_layers=2, n_heads=1, d_ffn_factor=4, activation='gelu'): + return Transformer(n_layers, d_token, n_heads, d_token, d_ffn_factor, activation=activation) + return _make + + +@pytest.fixture +def make_reconstructor(): + from ef_vfm.modules.transformer import Reconstructor + def _make(d_numerical, categories, d_token): + cats = list(categories) if categories is not None else [] + return Reconstructor(d_numerical, cats, d_token) + return _make + + +@pytest.fixture +def make_mlp(): + from ef_vfm.modules.main_modules import MLP + def _make(d_in, dim_t=128, use_mlp=True): + return MLP(d_in, dim_t=dim_t, use_mlp=use_mlp) + return _make + + +@pytest.fixture +def make_unimodmlp(): + from ef_vfm.modules.main_modules import UniModMLP + def _make(d_numerical, categories, d_token=16, n_layers=1, n_head=1, + factor=4, dim_t=64, activation='gelu'): + cats = list(categories) if categories is not None else [] + return UniModMLP( + d_numerical, cats, n_layers, d_token, + n_head=n_head, factor=factor, dim_t=dim_t, activation=activation, + ) + return _make + + +@pytest.fixture +def make_flow_model(): + from ef_vfm.modules.main_modules import UniModMLP + from ef_vfm.models.flow_model import ExpVFM + def _make(d_numerical, categories, d_token=16, n_layers=1, dim_t=64): + cats_list = list(categories) if categories is not None else [] + cats_np = np.array(cats_list) + model = UniModMLP( + d_numerical, cats_list, n_layers, d_token, + n_head=1, factor=4, dim_t=dim_t, activation='gelu', + ) + flow = ExpVFM( + num_classes=cats_np, + num_numerical_features=d_numerical, + vf_fn=model, + device=torch.device('cpu'), + ) + return flow + return _make + + +@pytest.fixture +def make_trainer(): + """Factory: creates a minimal Trainer with mocked external dependencies.""" + from ef_vfm.modules.main_modules import UniModMLP + from ef_vfm.models.flow_model import ExpVFM + from ef_vfm.trainer import Trainer + + def _make(d_numerical=4, categories=np.array([3, 5, 2]), + lr=0.001, max_grad_norm=1.0, warmup_epochs=0, + lr_scheduler='reduce_lr_on_plateau', steps=10, tmp_path=None): + + cats_list = list(categories) if categories is not None else [] + cats_np = np.array(cats_list) + + model = UniModMLP( + d_numerical, cats_list, 1, 16, + n_head=1, factor=4, dim_t=64, activation='gelu', + ) + flow = ExpVFM( + num_classes=cats_np, + num_numerical_features=d_numerical, + vf_fn=model, + device=torch.device('cpu'), + ) + + # Build a small synthetic dataset: [N, d_num + len(cats)] with int cat indices + n_samples = 32 + x_num = torch.randn(n_samples, d_numerical) + if len(cats_list) > 0: + x_cat = torch.stack( + [torch.randint(0, k, (n_samples,)) for k in cats_list], dim=1 + ).float() + data = torch.cat([x_num, x_cat], dim=1) + else: + data = x_num + + dataset = torch.utils.data.TensorDataset(data) + train_iter = torch.utils.data.DataLoader(dataset, batch_size=8, shuffle=False) + # DataLoader wraps in tuples; Trainer expects raw tensors, so use a wrapper + class _UnwrapLoader: + def __init__(self, loader): + self._loader = loader + def __iter__(self): + for (batch,) in self._loader: + yield batch + def __len__(self): + return len(self._loader) + + save_path = str(tmp_path) if tmp_path else "/tmp" + trainer = Trainer( + flow=flow, + train_iter=_UnwrapLoader(train_iter), + dataset=MagicMock(), + test_dataset=MagicMock(), + metrics=MagicMock(), + logger=MagicMock(), + lr=lr, + weight_decay=0, + steps=steps, + batch_size=8, + check_val_every=steps + 1, # never evaluate during test + sample_batch_size=8, + model_save_path=save_path, + result_save_path=save_path, + lr_scheduler=lr_scheduler, + max_grad_norm=max_grad_norm, + warmup_epochs=warmup_epochs, + device=torch.device('cpu'), + ) + return trainer + return _make diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_attention.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_attention.py new file mode 100644 index 0000000000000000000000000000000000000000..6082db42ad2dff94440f4cc07659c57cf6326de4 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_attention.py @@ -0,0 +1,51 @@ +import pytest +import torch +from ef_vfm.modules.transformer import MultiheadAttention + + +def test_output_shape_single_head(): + attn = MultiheadAttention(d=16, n_heads=1, dropout=0.0) + x = torch.randn(4, 5, 16) + out = attn(x, x) + assert out.shape == (4, 5, 16) + + +def test_output_shape_multi_head(): + attn = MultiheadAttention(d=16, n_heads=4, dropout=0.0) + x = torch.randn(4, 5, 16) + out = attn(x, x) + assert out.shape == (4, 5, 16) + + +def test_no_W_out_single_head(): + attn = MultiheadAttention(d=16, n_heads=1, dropout=0.0) + assert attn.W_out is None + + +def test_W_out_exists_multi_head(): + attn = MultiheadAttention(d=16, n_heads=4, dropout=0.0) + assert attn.W_out is not None + + +def test_cross_attention_diff_seq_len(): + attn = MultiheadAttention(d=16, n_heads=1, dropout=0.0) + x_q = torch.randn(4, 3, 16) + x_kv = torch.randn(4, 7, 16) + out = attn(x_q, x_kv) + assert out.shape == (4, 3, 16) # output seq_len matches query + + +def test_invalid_d_nheads_raises(): + with pytest.raises(AssertionError): + MultiheadAttention(d=15, n_heads=4, dropout=0.0) + + +def test_gradient_flows(): + attn = MultiheadAttention(d=16, n_heads=2, dropout=0.0) + x = torch.randn(4, 5, 16, requires_grad=True) + out = attn(x, x) + out.sum().backward() + assert x.grad is not None and x.grad.abs().sum() > 0 + for name in ['W_q', 'W_k', 'W_v']: + param = getattr(attn, name) + assert param.weight.grad is not None and param.weight.grad.abs().sum() > 0 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_config.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_config.py new file mode 100644 index 0000000000000000000000000000000000000000..95c723f64388fe1259f0ba62f0ad8c6cf1051455 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_config.py @@ -0,0 +1,62 @@ +import os +from pathlib import Path + +from src.util import load_config +from ef_vfm.modules.main_modules import UniModMLP + + +CONFIG_PATH = Path(__file__).resolve().parent.parent / "ef_vfm" / "configs" / "ef_vfm_configs.toml" + + +def test_load_config_returns_dict(): + config = load_config(CONFIG_PATH) + assert isinstance(config, dict) + + +def test_config_has_expected_sections(): + config = load_config(CONFIG_PATH) + for key in ['data', 'unimodmlp_params', 'train', 'sample']: + assert key in config, f"Missing section '{key}'" + + +def test_unimodmlp_params_complete(): + config = load_config(CONFIG_PATH) + params = config['unimodmlp_params'] + required = ['num_layers', 'd_token', 'n_head', 'factor', 'bias', 'dim_t', 'use_mlp', 'activation'] + for key in required: + assert key in params, f"Missing param '{key}' in unimodmlp_params" + + +def test_activation_value_is_valid(): + config = load_config(CONFIG_PATH) + activation = config['unimodmlp_params']['activation'] + assert activation in ('relu', 'gelu', 'silu'), f"Invalid activation '{activation}'" + + +def test_train_main_has_new_params(): + """Verify the recently added config params are present.""" + config = load_config(CONFIG_PATH) + train = config['train']['main'] + assert 'max_grad_norm' in train + assert 'warmup_epochs' in train + assert isinstance(train['max_grad_norm'], (int, float)) + assert isinstance(train['warmup_epochs'], (int, float)) + + +def test_config_values_create_model(): + config = load_config(CONFIG_PATH) + params = config['unimodmlp_params'] + # Use dummy dimensions; the point is that config params are valid for the constructor + model = UniModMLP( + d_numerical=4, + categories=[3, 5, 2], + num_layers=params['num_layers'], + d_token=params['d_token'], + n_head=params['n_head'], + factor=params['factor'], + bias=params['bias'], + dim_t=params['dim_t'], + use_mlp=params['use_mlp'], + activation=params['activation'], + ) + assert model is not None diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_flow_model.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_flow_model.py new file mode 100644 index 0000000000000000000000000000000000000000..2bdc72bf2388cc70b56389463bdfd322b8badced --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_flow_model.py @@ -0,0 +1,219 @@ +import torch +import numpy as np +from unittest.mock import patch + +from ef_vfm.models.flow_model import ExpVFM, Velocity +from ef_vfm.modules.main_modules import UniModMLP + + +# ---- mixed_loss tests ---- + +def test_mixed_loss_returns_two_scalars(make_flow_model, make_dummy_inputs, dims): + d = dims + flow = make_flow_model(d["d_numerical"], d["categories"]) + _, _, x_cat_int, _ = make_dummy_inputs(d["d_numerical"], d["categories"], d["batch_size"]) + x_num = torch.randn(d["batch_size"], d["d_numerical"]) + x = torch.cat([x_num, x_cat_int.float()], dim=1) + d_loss, c_loss = flow.mixed_loss(x) + assert d_loss.dim() == 0 or d_loss.numel() == 1 + assert c_loss.dim() == 0 or c_loss.numel() == 1 + + +def test_mixed_loss_finite(make_flow_model, make_dummy_inputs, dims): + d = dims + flow = make_flow_model(d["d_numerical"], d["categories"]) + _, _, x_cat_int, _ = make_dummy_inputs(d["d_numerical"], d["categories"], d["batch_size"]) + x_num = torch.randn(d["batch_size"], d["d_numerical"]) + x = torch.cat([x_num, x_cat_int.float()], dim=1) + d_loss, c_loss = flow.mixed_loss(x) + assert torch.isfinite(d_loss).all() + assert torch.isfinite(c_loss).all() + + +def test_mixed_loss_gradients_flow(make_flow_model, make_dummy_inputs, dims): + d = dims + flow = make_flow_model(d["d_numerical"], d["categories"]) + _, _, x_cat_int, _ = make_dummy_inputs(d["d_numerical"], d["categories"], d["batch_size"]) + x_num = torch.randn(d["batch_size"], d["d_numerical"]) + x = torch.cat([x_num, x_cat_int.float()], dim=1) + d_loss, c_loss = flow.mixed_loss(x) + total = d_loss + c_loss + total.backward() + grads = [p.grad for p in flow.parameters() if p.grad is not None] + assert len(grads) > 0 + + +def test_mixed_loss_numerical_only(make_flow_model, make_dummy_inputs, dims_numerical_only): + d = dims_numerical_only + flow = make_flow_model(d["d_numerical"], d["categories"]) + x = torch.randn(d["batch_size"], d["d_numerical"]) + d_loss, c_loss = flow.mixed_loss(x) + assert d_loss.item() == 0.0 # no discrete features + assert c_loss.item() > 0.0 + + +# ---- sample tests (with mocked odeint) ---- + +def _make_flow(d_numerical, categories): + cats_list = list(categories) if categories is not None else [] + cats_np = np.array(cats_list) + model = UniModMLP(d_numerical, cats_list, 1, 16, n_head=1, factor=4, dim_t=64, activation='gelu') + return ExpVFM(cats_np, d_numerical, model, device=torch.device('cpu')) + + +def test_sample_output_shape(dims): + d = dims + flow = _make_flow(d["d_numerical"], d["categories"]) + d_in = d["d_numerical"] + sum(d["categories"]) + n = 5 + fake_trajectory = torch.randn(2, n, d_in) + with patch("ef_vfm.models.flow_model.odeint", return_value=fake_trajectory): + result = flow.sample(n) + d_out = d["d_numerical"] + len(d["categories"]) + assert result.shape == (n, d_out) + + +def test_sample_categorical_in_range(dims): + d = dims + flow = _make_flow(d["d_numerical"], d["categories"]) + d_in = d["d_numerical"] + sum(d["categories"]) + n = 16 + fake_trajectory = torch.randn(2, n, d_in) + with patch("ef_vfm.models.flow_model.odeint", return_value=fake_trajectory): + result = flow.sample(n) + for i, k in enumerate(d["categories"]): + col = d["d_numerical"] + i + assert (result[:, col] >= 0).all() + assert (result[:, col] < k).all() + + +def test_sample_returns_cpu(dims): + d = dims + flow = _make_flow(d["d_numerical"], d["categories"]) + d_in = d["d_numerical"] + sum(d["categories"]) + fake_trajectory = torch.randn(2, 4, d_in) + with patch("ef_vfm.models.flow_model.odeint", return_value=fake_trajectory): + result = flow.sample(4) + assert result.device == torch.device('cpu') + + +def test_sample_single_sample(dims): + d = dims + flow = _make_flow(d["d_numerical"], d["categories"]) + d_in = d["d_numerical"] + sum(d["categories"]) + fake_trajectory = torch.randn(2, 1, d_in) + with patch("ef_vfm.models.flow_model.odeint", return_value=fake_trajectory): + result = flow.sample(1) + d_out = d["d_numerical"] + len(d["categories"]) + assert result.shape == (1, d_out) + + +# ---- to_one_hot tests ---- + +def test_to_one_hot_shape(dims): + d = dims + flow = _make_flow(d["d_numerical"], d["categories"]) + cats = d["categories"] + x_cat = torch.stack([torch.randint(0, k, (8,)) for k in cats], dim=1) + oh = flow.to_one_hot(x_cat) + assert oh.shape == (8, sum(cats)) + + +def test_to_one_hot_roundtrip(dims): + d = dims + flow = _make_flow(d["d_numerical"], d["categories"]) + cats = d["categories"] + x_cat = torch.stack([torch.randint(0, k, (8,)) for k in cats], dim=1) + oh = flow.to_one_hot(x_cat) + # Recover indices via argmax per category slice + idx = 0 + for i, k in enumerate(cats): + recovered = oh[:, idx:idx + k].argmax(dim=1) + assert torch.equal(recovered, x_cat[:, i]) + idx += k + + +def test_to_one_hot_binary_values(dims): + d = dims + flow = _make_flow(d["d_numerical"], d["categories"]) + cats = d["categories"] + x_cat = torch.stack([torch.randint(0, k, (8,)) for k in cats], dim=1) + oh = flow.to_one_hot(x_cat) + assert set(oh.unique().tolist()).issubset({0, 1}) + + +# ---- Regression tests ---- + +def test_regression_d_in_no_extra_len(): + """d_in must be num_numerical + sum(num_classes), NOT + len(num_classes).""" + d_numerical = 4 + categories = np.array([3, 5, 2]) + flow = _make_flow(d_numerical, categories) + expected_d_in = d_numerical + sum(categories) # 14, not 17 + assert flow.num_numerical_features + sum(flow.num_classes) == expected_d_in + + +def test_regression_sampling_indices_correct(): + """Categorical argmax must go to columns [d_num, d_num+1, ...], not [0, 1, ...].""" + d_numerical = 4 + categories = np.array([3, 5, 2]) + n = 10 + d_in = d_numerical + sum(categories) + d_out = d_numerical + len(categories) + + # Simulate the post-processing from sample() + out = torch.randn(n, d_in) + sample = torch.zeros(n, d_out) + sample[:, :d_numerical] = out[:, :d_numerical] + + idx = d_numerical # correct starting index + for i, val in enumerate(categories): + col = d_numerical + i # correct column + sample[:, col] = torch.argmax(out[:, idx:idx + val], dim=1) + idx += val + + # Numerical columns must be untouched + assert torch.allclose(sample[:, :d_numerical], out[:, :d_numerical]) + # Categorical columns at correct positions + for i, val in enumerate(categories): + col = d_numerical + i + assert (sample[:, col] >= 0).all() + assert (sample[:, col] < val).all() + + +def test_regression_d_out_correct(): + """d_out must be d_num + len(categories).""" + d_numerical = 4 + categories = np.array([3, 5, 2]) + flow = _make_flow(d_numerical, categories) + expected_d_out = d_numerical + len(categories) # 7 + assert expected_d_out == 7 + + +# ---- Velocity tests ---- + +def test_velocity_output_shape(dims): + d = dims + cats_list = list(d["categories"]) + model = UniModMLP(d["d_numerical"], cats_list, 1, d["d_token"], + n_head=1, factor=4, dim_t=64, activation='gelu') + vel = Velocity(model) + d_in = d["d_numerical"] + sum(d["categories"]) + x = torch.randn(d["batch_size"], d_in) + t = torch.tensor(0.5) + out = vel(t, x) + assert out.shape == (d["batch_size"], d_in) + + +def test_velocity_scalar_t_broadcast(dims): + d = dims + cats_list = list(d["categories"]) + model = UniModMLP(d["d_numerical"], cats_list, 1, d["d_token"], + n_head=1, factor=4, dim_t=64, activation='gelu') + vel = Velocity(model) + d_in = d["d_numerical"] + sum(d["categories"]) + x = torch.randn(d["batch_size"], d_in) + # Scalar t should work (gets broadcast internally) + t = torch.tensor(0.3) + out = vel(t, x) + assert out.shape == x.shape diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_mlp.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_mlp.py new file mode 100644 index 0000000000000000000000000000000000000000..0cf9ad4d6832d792cb65a1bb01bdc784385f9fcd --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_mlp.py @@ -0,0 +1,85 @@ +import torch +import torch.nn as nn +from ef_vfm.modules.main_modules import MLP, PositionalEmbedding + + +# ---- PositionalEmbedding tests ---- + +def test_positional_embedding_shape(): + pe = PositionalEmbedding(num_channels=64) + x = torch.rand(8) + out = pe(x) + assert out.shape == (8, 64) + + +def test_positional_embedding_bounded(): + pe = PositionalEmbedding(num_channels=64) + x = torch.rand(8) + out = pe(x) + assert out.min() >= -1.0 + assert out.max() <= 1.0 + + +def test_positional_embedding_deterministic(): + pe = PositionalEmbedding(num_channels=64) + x = torch.tensor([0.1, 0.5, 0.9]) + out1 = pe(x) + out2 = pe(x) + assert torch.equal(out1, out2) + + +def test_positional_embedding_different_timesteps(): + pe = PositionalEmbedding(num_channels=64) + t1 = torch.tensor([0.1]) + t2 = torch.tensor([0.9]) + assert not torch.allclose(pe(t1), pe(t2)) + + +# ---- MLP tests ---- + +def test_mlp_output_shape(make_mlp): + mlp = make_mlp(d_in=32, dim_t=64) + x = torch.randn(8, 32) + t = torch.rand(8) + out = mlp(x, t) + assert out.shape == (8, 32) + + +def test_mlp_use_mlp_true(make_mlp): + mlp = make_mlp(d_in=32, dim_t=64, use_mlp=True) + assert isinstance(mlp.mlp, nn.Sequential) + + +def test_mlp_use_mlp_false(make_mlp): + mlp = make_mlp(d_in=32, dim_t=64, use_mlp=False) + assert isinstance(mlp.mlp, nn.Linear) + + +def test_mlp_time_conditioning(make_mlp): + mlp = make_mlp(d_in=32, dim_t=64) + mlp.eval() + x = torch.randn(4, 32) + t1 = torch.zeros(4) + t2 = torch.ones(4) + out1 = mlp(x, t1) + out2 = mlp(x, t2) + assert not torch.allclose(out1, out2) + + +def test_mlp_gradient_flows(make_mlp): + mlp = make_mlp(d_in=32, dim_t=64) + x = torch.randn(4, 32) + t = torch.rand(4) + out = mlp(x, t) + out.sum().backward() + assert mlp.proj.weight.grad is not None and mlp.proj.weight.grad.abs().sum() > 0 + assert mlp.map_noise.num_channels == 64 # sanity check on PE config + + +def test_mlp_different_dim_t(make_mlp): + for dim_t in [32, 128, 256]: + mlp = make_mlp(d_in=16, dim_t=dim_t) + x = torch.randn(4, 16) + t = torch.rand(4) + out = mlp(x, t) + assert out.shape == (4, 16) diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_reconstructor.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_reconstructor.py new file mode 100644 index 0000000000000000000000000000000000000000..cdc39880d19f644fb8ac6b457af6a8cb3d83cbfa --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_reconstructor.py @@ -0,0 +1,51 @@ +import torch +import numpy as np +from ef_vfm.modules.transformer import Reconstructor + + +def test_output_shapes_mixed(make_reconstructor, dims): + d = dims + r = make_reconstructor(d["d_numerical"], d["categories"], d["d_token"]) + seq_len = d["d_numerical"] + len(d["categories"]) + h = torch.randn(d["batch_size"], seq_len, d["d_token"]) + x_num, x_cat = r(h) + assert x_num.shape == (d["batch_size"], d["d_numerical"]) + assert len(x_cat) == len(d["categories"]) + for i, k in enumerate(d["categories"]): + assert x_cat[i].shape == (d["batch_size"], k) + + +def test_categorical_count(make_reconstructor, dims): + d = dims + r = make_reconstructor(d["d_numerical"], d["categories"], d["d_token"]) + seq_len = d["d_numerical"] + len(d["categories"]) + h = torch.randn(d["batch_size"], seq_len, d["d_token"]) + _, x_cat = r(h) + assert len(x_cat) == len(d["categories"]) + + +def test_empty_categories(make_reconstructor): + r = make_reconstructor(4, np.array([]), 16) + h = torch.randn(8, 4, 16) + x_num, x_cat = r(h) + assert x_num.shape == (8, 4) + assert len(x_cat) == 0 + + +def test_weight_shape(make_reconstructor, dims): + d = dims + r = make_reconstructor(d["d_numerical"], d["categories"], d["d_token"]) + assert r.weight.shape == (d["d_numerical"], d["d_token"]) + + +def test_gradient_flows(make_reconstructor, dims): + d = dims + r = make_reconstructor(d["d_numerical"], d["categories"], d["d_token"]) + seq_len = d["d_numerical"] + len(d["categories"]) + h = torch.randn(d["batch_size"], seq_len, d["d_token"]) + x_num, x_cat = r(h) + loss = x_num.sum() + sum(c.sum() for c in x_cat) + loss.backward() + assert r.weight.grad is not None and r.weight.grad.abs().sum() > 0 + for recon in r.cat_recons: + assert recon.weight.grad is not None diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_tokenizer.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_tokenizer.py new file mode 100644 index 0000000000000000000000000000000000000000..ea8c55737d473605c2bb1c87f0394fad64baeb18 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_tokenizer.py @@ -0,0 +1,85 @@ +import torch +import numpy as np + + +def test_forward_shape_mixed(make_tokenizer, make_dummy_inputs, dims): + tok = make_tokenizer(dims["d_numerical"], dims["categories"], dims["d_token"]) + x_num, x_cat_oh, _, _ = make_dummy_inputs(dims["d_numerical"], dims["categories"], dims["batch_size"]) + out = tok(x_num, x_cat_oh) + expected_seq = 1 + dims["d_numerical"] + len(dims["categories"]) + assert out.shape == (dims["batch_size"], expected_seq, dims["d_token"]) + + +def test_forward_shape_numerical_only(make_tokenizer, make_dummy_inputs, dims_numerical_only): + d = dims_numerical_only + tok = make_tokenizer(d["d_numerical"], d["categories"], d["d_token"]) + x_num, _, _, _ = make_dummy_inputs(d["d_numerical"], d["categories"], d["batch_size"]) + out = tok(x_num, None) + expected_seq = 1 + d["d_numerical"] + assert out.shape == (d["batch_size"], expected_seq, d["d_token"]) + + +def test_forward_shape_single_feature(make_tokenizer, make_dummy_inputs, dims_single): + d = dims_single + tok = make_tokenizer(d["d_numerical"], d["categories"], d["d_token"]) + x_num, x_cat_oh, _, _ = make_dummy_inputs(d["d_numerical"], d["categories"], d["batch_size"]) + out = tok(x_num, x_cat_oh) + expected_seq = 1 + d["d_numerical"] + len(d["categories"]) + assert out.shape == (d["batch_size"], expected_seq, d["d_token"]) + + +def test_n_tokens_property(make_tokenizer, dims): + tok = make_tokenizer(dims["d_numerical"], dims["categories"], dims["d_token"]) + expected = dims["d_numerical"] + 1 + len(dims["categories"]) + assert tok.n_tokens == expected + + +def test_n_tokens_numerical_only(make_tokenizer, dims_numerical_only): + d = dims_numerical_only + tok = make_tokenizer(d["d_numerical"], d["categories"], d["d_token"]) + assert tok.n_tokens == d["d_numerical"] + 1 + + +def test_cls_token_position(make_tokenizer, make_dummy_inputs, dims): + tok = make_tokenizer(dims["d_numerical"], dims["categories"], dims["d_token"], bias=False) + x_num, x_cat_oh, _, _ = make_dummy_inputs(dims["d_numerical"], dims["categories"], dims["batch_size"]) + out = tok(x_num, x_cat_oh) + # CLS token: ones * weight[0], so all batch rows should have the same CLS token + cls_tokens = out[:, 0, :] + assert torch.allclose(cls_tokens[0], cls_tokens[1]) + assert torch.allclose(cls_tokens[0], tok.weight[0]) + + +def test_bias_vs_no_bias(make_tokenizer, make_dummy_inputs, dims): + d = dims + tok_bias = make_tokenizer(d["d_numerical"], d["categories"], d["d_token"], bias=True) + tok_no_bias = make_tokenizer(d["d_numerical"], d["categories"], d["d_token"], bias=False) + assert tok_bias.bias is not None + assert tok_no_bias.bias is None + + +def test_category_offsets_values(make_tokenizer): + cats = np.array([3, 5, 2]) + tok = make_tokenizer(4, cats, 16) + assert torch.equal(tok.category_offsets, torch.tensor([0, 3, 8])) + assert torch.equal(tok.category_ends, torch.tensor([3, 8, 10])) + + +def test_cat_weight_shape(make_tokenizer, dims): + tok = make_tokenizer(dims["d_numerical"], dims["categories"], dims["d_token"]) + assert tok.cat_weight.shape == (sum(dims["categories"]), dims["d_token"]) + + +def test_weight_shape(make_tokenizer, dims): + tok = make_tokenizer(dims["d_numerical"], dims["categories"], dims["d_token"]) + assert tok.weight.shape == (dims["d_numerical"] + 1, dims["d_token"]) + + +def test_gradient_flows(make_tokenizer, make_dummy_inputs, dims): + tok = make_tokenizer(dims["d_numerical"], dims["categories"], dims["d_token"]) + x_num, x_cat_oh, _, _ = make_dummy_inputs(dims["d_numerical"], dims["categories"], dims["batch_size"]) + out = tok(x_num, x_cat_oh) + out.sum().backward() + assert tok.weight.grad is not None and tok.weight.grad.abs().sum() > 0 + assert tok.cat_weight.grad is not None and tok.cat_weight.grad.abs().sum() > 0 + assert tok.bias.grad is not None and tok.bias.grad.abs().sum() > 0 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_trainer.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_trainer.py new file mode 100644 index 0000000000000000000000000000000000000000..592c538d2aa1f8f34098a0d7c6c4fc0b1f0c5ddf --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_trainer.py @@ -0,0 +1,98 @@ +import torch +import numpy as np + + +# ---- Gradient clipping tests ---- + +def test_grad_clipping_applied(make_trainer, tmp_path): + trainer = make_trainer(max_grad_norm=0.5, tmp_path=tmp_path) + batch = next(iter(trainer.train_iter)) + trainer._run_step(batch, closs_weight=1.0, dloss_weight=1.0) + # After clipping, total gradient norm should be <= max_grad_norm (with tolerance) + total_norm = torch.nn.utils.clip_grad_norm_(trainer.flow.parameters(), float('inf')) + # Gradients were already clipped in _run_step, then optimizer.step() zeroed them. + # So we re-run to check: do a fresh forward-backward without step + trainer.optimizer.zero_grad() + dloss, closs = trainer.flow.mixed_loss(batch.to(trainer.device)) + (dloss + closs).backward() + torch.nn.utils.clip_grad_norm_(trainer.flow.parameters(), 0.5) + total_norm = 0.0 + for p in trainer.flow.parameters(): + if p.grad is not None: + total_norm += p.grad.data.norm(2).item() ** 2 + total_norm = total_norm ** 0.5 + assert total_norm <= 0.5 + 1e-6 + + +def test_grad_clipping_disabled(make_trainer, tmp_path): + trainer = make_trainer(max_grad_norm=0, tmp_path=tmp_path) + assert trainer.max_grad_norm == 0 + + +def test_run_step_returns_losses(make_trainer, tmp_path): + trainer = make_trainer(tmp_path=tmp_path) + batch = next(iter(trainer.train_iter)) + dloss, closs = trainer._run_step(batch, closs_weight=1.0, dloss_weight=1.0) + assert isinstance(dloss, torch.Tensor) + assert isinstance(closs, torch.Tensor) + assert torch.isfinite(dloss) + assert torch.isfinite(closs) + + +# ---- LR warmup tests ---- + +def test_warmup_lr_linear_ramp(make_trainer, tmp_path): + init_lr = 0.01 + warmup = 5 + trainer = make_trainer(lr=init_lr, warmup_epochs=warmup, tmp_path=tmp_path) + # Simulate warmup epochs + for epoch in range(warmup): + expected_lr = init_lr * (epoch + 1) / warmup + if trainer.warmup_epochs > 0 and (epoch + 1) <= trainer.warmup_epochs: + warmup_lr = trainer.init_lr * (epoch + 1) / trainer.warmup_epochs + for pg in trainer.optimizer.param_groups: + pg["lr"] = warmup_lr + actual_lr = trainer.optimizer.param_groups[0]["lr"] + assert abs(actual_lr - expected_lr) < 1e-8, f"Epoch {epoch}: expected {expected_lr}, got {actual_lr}" + + +def test_warmup_overrides_scheduler(make_trainer, tmp_path): + trainer = make_trainer(warmup_epochs=10, lr_scheduler='reduce_lr_on_plateau', tmp_path=tmp_path) + initial_lr = trainer.optimizer.param_groups[0]["lr"] + # During warmup, scheduler.step should NOT be called (we just set LR directly) + # Simulate epoch 1 warmup + warmup_lr = trainer.init_lr * 1 / trainer.warmup_epochs + for pg in trainer.optimizer.param_groups: + pg["lr"] = warmup_lr + assert trainer.optimizer.param_groups[0]["lr"] == warmup_lr + assert warmup_lr < initial_lr # warmup starts lower + + +def test_no_warmup_when_zero(make_trainer, tmp_path): + trainer = make_trainer(warmup_epochs=0, tmp_path=tmp_path) + assert trainer.warmup_epochs == 0 + # LR should be the init_lr from the start + assert trainer.optimizer.param_groups[0]["lr"] == trainer.init_lr + + +# ---- LR scheduler tests ---- + +def test_anneal_lr(make_trainer, tmp_path): + trainer = make_trainer(lr=0.01, steps=100, lr_scheduler='anneal', tmp_path=tmp_path) + trainer._anneal_lr(50) + expected = 0.01 * (1 - 50 / 100) + assert abs(trainer.optimizer.param_groups[0]["lr"] - expected) < 1e-8 + + +# ---- EMA tests ---- + +def test_ema_model_created(make_trainer, tmp_path): + trainer = make_trainer(tmp_path=tmp_path) + # EMA model should exist and have same structure as flow._vf_fn + assert trainer.ema_model is not None + ema_params = list(trainer.ema_model.parameters()) + model_params = list(trainer.flow._vf_fn.parameters()) + assert len(ema_params) == len(model_params) + # EMA params should be detached (requires_grad=False) + for p in ema_params: + assert not p.requires_grad diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_transformer.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_transformer.py new file mode 100644 index 0000000000000000000000000000000000000000..ff56e884615e818841fbb912f8ef4e9961729197 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_transformer.py @@ -0,0 +1,73 @@ +import pytest +import torch +from ef_vfm.modules.transformer import Transformer + + +def test_output_shape_preserved(make_transformer): + t = make_transformer(d_token=16, n_layers=2) + x = torch.randn(4, 5, 16) + out = t(x) + assert out.shape == x.shape + + +def test_activation_gelu(make_transformer): + t = make_transformer(d_token=16, activation='gelu') + x = torch.randn(4, 5, 16) + out = t(x) + assert out.shape == x.shape + + +def test_activation_silu(make_transformer): + t = make_transformer(d_token=16, activation='silu') + x = torch.randn(4, 5, 16) + out = t(x) + assert out.shape == x.shape + + +def test_activation_relu(make_transformer): + t = make_transformer(d_token=16, activation='relu') + x = torch.randn(4, 5, 16) + out = t(x) + assert out.shape == x.shape + + +def test_invalid_activation_raises(): + with pytest.raises(ValueError, match="Unknown activation"): + Transformer(2, 16, 1, 16, 4, activation='bad') + + +def test_prenorm_first_layer_no_norm0(): + t = Transformer(2, 16, 1, 16, 4, prenormalization=True) + assert 'norm0' not in t.layers[0] + # Second layer should have norm0 + assert 'norm0' in t.layers[1] + + +def test_no_prenorm_all_layers_have_norm0(): + t = Transformer(2, 16, 1, 16, 4, prenormalization=False) + for layer in t.layers: + assert 'norm0' in layer + + +def test_single_layer(): + t = Transformer(1, 16, 1, 16, 4) + x = torch.randn(4, 5, 16) + out = t(x) + assert out.shape == x.shape + + +def test_multi_layer(): + t = Transformer(4, 16, 1, 16, 4) + x = torch.randn(4, 5, 16) + out = t(x) + assert out.shape == x.shape + + +def test_gradient_flows(make_transformer): + t = make_transformer(d_token=16, n_layers=2) + x = torch.randn(4, 5, 16, requires_grad=True) + out = t(x) + out.sum().backward() + assert x.grad is not None and x.grad.abs().sum() > 0 + # Check gradients through at least the first layer's linear0 + assert t.layers[0]['linear0'].weight.grad is not None diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_unimodmlp.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_unimodmlp.py new file mode 100644 index 0000000000000000000000000000000000000000..d935e7c48dba78fd7e4821287628aa861aa6d1b4 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_unimodmlp.py @@ -0,0 +1,72 @@ +import torch +import numpy as np + + +def test_forward_shapes_mixed(make_unimodmlp, make_dummy_inputs, dims): + d = dims + model = make_unimodmlp(d["d_numerical"], d["categories"], d_token=d["d_token"]) + x_num, x_cat_oh, _, t = make_dummy_inputs(d["d_numerical"], d["categories"], d["batch_size"]) + x_num_pred, x_cat_pred = model(x_num, x_cat_oh, t) + assert x_num_pred.shape == (d["batch_size"], d["d_numerical"]) + assert x_cat_pred.shape == (d["batch_size"], sum(d["categories"])) + + +def test_forward_shapes_numerical_only(make_unimodmlp, make_dummy_inputs, dims_numerical_only): + d = dims_numerical_only + model = make_unimodmlp(d["d_numerical"], d["categories"], d_token=d["d_token"]) + x_num, _, _, t = make_dummy_inputs(d["d_numerical"], d["categories"], d["batch_size"]) + x_cat = torch.zeros(d["batch_size"], 0) + x_num_pred, x_cat_pred = model(x_num, x_cat, t) + assert x_num_pred.shape == (d["batch_size"], d["d_numerical"]) + # When no categories, cat_pred should be zeros with shape matching x_cat + assert x_cat_pred.shape[0] == d["batch_size"] + assert torch.all(x_cat_pred == 0) + + +def test_forward_shapes_single_feature(make_unimodmlp, make_dummy_inputs, dims_single): + d = dims_single + model = make_unimodmlp(d["d_numerical"], d["categories"], d_token=d["d_token"]) + x_num, x_cat_oh, _, t = make_dummy_inputs(d["d_numerical"], d["categories"], d["batch_size"]) + x_num_pred, x_cat_pred = model(x_num, x_cat_oh, t) + assert x_num_pred.shape == (d["batch_size"], d["d_numerical"]) + assert x_cat_pred.shape == (d["batch_size"], sum(d["categories"])) + + +def test_d_in_computation(make_unimodmlp, dims): + d = dims + model = make_unimodmlp(d["d_numerical"], d["categories"], d_token=d["d_token"]) + expected = d["d_token"] * (d["d_numerical"] + len(d["categories"])) + assert model.mlp.proj.in_features == expected + + +def test_output_dtypes(make_unimodmlp, make_dummy_inputs, dims): + d = dims + model = make_unimodmlp(d["d_numerical"], d["categories"], d_token=d["d_token"]) + x_num, x_cat_oh, _, t = make_dummy_inputs(d["d_numerical"], d["categories"], d["batch_size"]) + x_num_pred, x_cat_pred = model(x_num, x_cat_oh, t) + assert x_num_pred.dtype == torch.float32 + assert x_cat_pred.dtype == torch.float32 + + +def test_gradient_flows_end_to_end(make_unimodmlp, make_dummy_inputs, dims): + d = dims + model = make_unimodmlp(d["d_numerical"], d["categories"], d_token=d["d_token"]) + x_num, x_cat_oh, _, t = make_dummy_inputs(d["d_numerical"], d["categories"], d["batch_size"]) + x_num_pred, x_cat_pred = model(x_num, x_cat_oh, t) + loss = x_num_pred.sum() + x_cat_pred.sum() + loss.backward() + params_with_grad = sum(1 for p in model.parameters() if p.grad is not None and p.grad.abs().sum() > 0) + total_params = sum(1 for _ in model.parameters()) + # Transformer.head is defined but unused in forward(), so not all params get gradients + assert params_with_grad > total_params * 0.8, f"Only {params_with_grad}/{total_params} params got gradients" + + +def test_different_activations(make_unimodmlp, make_dummy_inputs, dims): + d = dims + x_num, x_cat_oh, _, t = make_dummy_inputs(d["d_numerical"], d["categories"], d["batch_size"]) + for act in ['relu', 'gelu', 'silu']: + model = make_unimodmlp(d["d_numerical"], d["categories"], d_token=d["d_token"], activation=act) + x_num_pred, x_cat_pred = model(x_num, x_cat_oh, t) + assert x_num_pred.shape == (d["batch_size"], d["d_numerical"]) + assert torch.isfinite(x_num_pred).all() + assert torch.isfinite(x_cat_pred).all() diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_utils.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..fbce0db0ac74052a4038dee89fd753b9d97717aa --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/tests/test_utils.py @@ -0,0 +1,49 @@ +import torch +import numpy as np + +from utils_train import update_ema, concat_y_to_X + + +# ---- update_ema tests ---- + +def test_update_ema_basic(): + target = [torch.tensor([1.0, 2.0])] + source = [torch.tensor([3.0, 4.0])] + target[0].requires_grad_(False) + rate = 0.9 + update_ema(target, source, rate=rate) + expected = 0.9 * torch.tensor([1.0, 2.0]) + 0.1 * torch.tensor([3.0, 4.0]) + assert torch.allclose(target[0], expected) + + +def test_update_ema_rate_zero(): + target = [torch.tensor([1.0, 2.0])] + source = [torch.tensor([3.0, 4.0])] + target[0].requires_grad_(False) + update_ema(target, source, rate=0.0) + assert torch.allclose(target[0], torch.tensor([3.0, 4.0])) + + +def test_update_ema_rate_one(): + target = [torch.tensor([1.0, 2.0])] + source = [torch.tensor([3.0, 4.0])] + target[0].requires_grad_(False) + update_ema(target, source, rate=1.0) + assert torch.allclose(target[0], torch.tensor([1.0, 2.0])) + + +# ---- concat_y_to_X tests ---- + +def test_concat_y_to_X_with_X(): + X = np.array([[1, 2], [3, 4]]) + y = np.array([10, 20]) + result = concat_y_to_X(X, y) + expected = np.array([[10, 1, 2], [20, 3, 4]]) + np.testing.assert_array_equal(result, expected) + + +def test_concat_y_to_X_without_X(): + y = np.array([10, 20, 30]) + result = concat_y_to_X(None, y) + expected = np.array([[10], [20], [30]]) + np.testing.assert_array_equal(result, expected) diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/utils_train.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/utils_train.py new file mode 100644 index 0000000000000000000000000000000000000000..f00c40d190a763f011526ef4aa11e5e960ce2b7b --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/utils_train.py @@ -0,0 +1,183 @@ +import numpy as np +import os + +import src +from torch.utils.data import Dataset + +import torch + + +class TabularDataset(Dataset): + def __init__(self, X_num, X_cat): + self.X_num = X_num + self.X_cat = X_cat + + def __getitem__(self, index): + this_num = self.X_num[index] + this_cat = self.X_cat[index] + + sample = (this_num, this_cat) + + return sample + + def __len__(self): + return self.X_num.shape[0] + +class EFVFMDataset(Dataset): + def __init__(self, dataname, data_dir, info, isTrain=True, dequant_dist='none', int_dequant_factor=0.0): + self.dataname = dataname + self.data_dir = data_dir + self.info = info + self.isTrain = isTrain + + X_num, X_cat, categories, d_numerical, num_inverse, int_inverse, cat_inverse = preprocess(data_dir, dequant_dist, int_dequant_factor, task_type = info['task_type'], inverse=True) + categories = np.array(categories) + + X_train_num, _ = X_num + X_train_cat, _ = X_cat + + X_train_num, X_test_num = X_num + X_train_cat, X_test_cat = X_cat + + X_train_num, X_test_num = torch.tensor(X_train_num).float(), torch.tensor(X_test_num).float() + X_train_cat, X_test_cat = torch.tensor(X_train_cat), torch.tensor(X_test_cat) + + self.X = torch.cat((X_train_num, X_train_cat), dim=1) if isTrain else torch.cat((X_test_num, X_test_cat), dim=1) + self.num_inverse = num_inverse + self.int_inverse = int_inverse + self.cat_inverse = cat_inverse + self.d_numerical = d_numerical + self.categories = categories + + def __getitem__(self, index): + return self.X[index] + + def __len__(self): + return self.X.shape[0] + +def preprocess(dataset_path, dequant_dist='none', int_dequant_factor=0.0, task_type = 'binclass', inverse = False, cat_encoding = None, concat = True): + + T_dict = {} + + T_dict['normalization'] = "quantile" + T_dict['num_nan_policy'] = 'mean' + T_dict['cat_nan_policy'] = None + T_dict['cat_min_frequency'] = None + T_dict['cat_encoding'] = cat_encoding + T_dict['y_policy'] = "default" + T_dict['dequant_dist'] = dequant_dist + T_dict['int_dequant_factor'] = int_dequant_factor + + T = src.Transformations(**T_dict) + + dataset = make_dataset( + data_path = dataset_path, + T = T, + task_type = task_type, + change_val = False, + concat = concat, + ) + + if cat_encoding is None: + X_num = dataset.X_num + X_cat = dataset.X_cat + + X_train_num, X_test_num = X_num['train'], X_num['test'] + X_train_cat, X_test_cat = X_cat['train'], X_cat['test'] + + categories = src.get_categories(X_train_cat) + d_numerical = X_train_num.shape[1] + + X_num = (X_train_num, X_test_num) + X_cat = (X_train_cat, X_test_cat) + + + if inverse: + num_inverse = dataset.num_transform.inverse_transform if dataset.num_transform is not None else lambda x: x + int_inverse = dataset.int_transform.inverse_transform if dataset.int_transform is not None else lambda x: x + cat_inverse = dataset.cat_transform.inverse_transform if dataset.cat_transform is not None else lambda x: x + + return X_num, X_cat, categories, d_numerical, num_inverse, int_inverse, cat_inverse + else: + return X_num, X_cat, categories, d_numerical + else: + return dataset + + +def update_ema(target_params, source_params, rate=0.999): + """ + Update target parameters to be closer to those of source parameters using + an exponential moving average. + :param target_params: the target parameter sequence. + :param source_params: the source parameter sequence. + :param rate: the EMA rate (closer to 1 means slower). + """ + for target, source in zip(target_params, source_params): + target.detach().mul_(rate).add_(source.detach(), alpha=1 - rate) + + + +def concat_y_to_X(X, y): + if X is None: + return y.reshape(-1, 1) + return np.concatenate([y.reshape(-1, 1), X], axis=1) + + +def make_dataset( + data_path: str, + T: src.Transformations, + task_type, + change_val: bool, + concat = True, +): + + # classification + if task_type == 'binclass' or task_type == 'multiclass': + X_cat = {} if os.path.exists(os.path.join(data_path, 'X_cat_train.npy')) else None + X_num = {} if os.path.exists(os.path.join(data_path, 'X_num_train.npy')) else None + y = {} if os.path.exists(os.path.join(data_path, 'y_train.npy')) else None + + for split in ['train', 'test']: + X_num_t, X_cat_t, y_t = src.read_pure_data(data_path, split) + if X_num is not None: + X_num[split] = X_num_t + if X_cat is not None: + if concat: + X_cat_t = concat_y_to_X(X_cat_t, y_t) + X_cat[split] = X_cat_t + if y is not None: + y[split] = y_t + else: + # regression + X_cat = {} if os.path.exists(os.path.join(data_path, 'X_cat_train.npy')) else None + X_num = {} if os.path.exists(os.path.join(data_path, 'X_num_train.npy')) else None + y = {} if os.path.exists(os.path.join(data_path, 'y_train.npy')) else None + + for split in ['train', 'test']: + X_num_t, X_cat_t, y_t = src.read_pure_data(data_path, split) + if X_num is not None: + if concat: + X_num_t = concat_y_to_X(X_num_t, y_t) + X_num[split] = X_num_t + if X_cat is not None: + X_cat[split] = X_cat_t + if y is not None: + y[split] = y_t + + info = src.load_json(os.path.join(data_path, 'info.json')) + int_col_idx_wrt_num = info['int_col_idx_wrt_num'] + + D = src.Dataset( + X_num, + X_cat, + y, + int_col_idx_wrt_num, + y_info={}, + task_type=src.TaskType(info['task_type']), + n_classes=info.get('n_classes') + ) + + if change_val: + D = src.change_val(D) + + return src.transform_dataset(D, T, None) \ No newline at end of file diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_tabbyflow_gen.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_tabbyflow_gen.py new file mode 100644 index 0000000000000000000000000000000000000000..e8bd70fd1b35fd8da39615ae25c09816a3c34dd1 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_tabbyflow_gen.py @@ -0,0 +1,43 @@ + +import os, shutil, subprocess, sys +root = r"/workspace/ef-vfm" +rt = r"/work/output-Benchmark-trainonly-v1/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime" +name = r"pipeline_c19" +src = r"/work/output-Benchmark-trainonly-v1/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19" + +if not os.path.exists(rt): + def _ignore(_, names): + skip = {"__pycache__", "data", "synthetic", "result", "results", "ckpt"} + return [n for n in names if n in skip or n.endswith(".pyc")] + shutil.copytree(root, rt, ignore=_ignore) + +dst_data = os.path.join(rt, "data", name) +shutil.rmtree(dst_data, ignore_errors=True) +os.makedirs(os.path.dirname(dst_data), exist_ok=True) +shutil.copytree(src, dst_data) +dst_syn = os.path.join(rt, "synthetic", name) +os.makedirs(dst_syn, exist_ok=True) +for fn in ("real.csv", "test.csv", "val.csv"): + shutil.copy(os.path.join(src, fn), os.path.join(dst_syn, fn)) +os.chdir(rt) +os.environ["PYTHONPATH"] = rt + os.pathsep + os.environ.get("PYTHONPATH", "") +os.environ.setdefault("EFVFM_SAMPLE_BATCH_SIZE", "128") +subprocess.check_call([ + sys.executable, os.path.join(rt, "main.py"), + "--dataname", name, "--mode", "test", "--gpu", "0", + "--no_wandb", "--exp_name", r"adapter_efvfm", + "--ckpt_path", r"/work/output-Benchmark-trainonly-v1/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime/ef_vfm/ckpt/pipeline_c19/adapter_efvfm/model_100.pt", + "--num_samples_to_generate", str(int(32759)), +]) +base = os.path.join(rt, "ef_vfm", "result", name, r"adapter_efvfm") +best = None +best_t = -1.0 +for r, _, files in os.walk(base): + if "samples.csv" in files: + p = os.path.join(r, "samples.csv") + t = os.path.getmtime(p) + if t > best_t: + best_t, best = t, p +if not best: + raise SystemExit("tabbyflow: no samples.csv in " + base) +shutil.copy(best, r"/work/output-Benchmark-trainonly-v1/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabbyflow-c19-32759-20260510_210653.csv") diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_tabbyflow_train.py b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_tabbyflow_train.py new file mode 100644 index 0000000000000000000000000000000000000000..68ab4de3335618d90c1320f24c2470b82350649a --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/_tabbyflow_train.py @@ -0,0 +1,33 @@ + +import os, shutil, subprocess, sys +root = r"/workspace/ef-vfm" +rt = r"/work/output-Benchmark-trainonly-v1/c19/tabbyflow/tabbyflow-c19-20260510_210211/_efvfm_runtime" +name = r"pipeline_c19" +src = r"/work/output-Benchmark-trainonly-v1/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19" + +shutil.rmtree(rt, ignore_errors=True) + +def _ignore(_, names): + skip = {"__pycache__", "data", "synthetic", "result", "results", "ckpt"} + return [n for n in names if n in skip or n.endswith(".pyc")] + +shutil.copytree(root, rt, ignore=_ignore) +dst_data = os.path.join(rt, "data", name) +dst_syn = os.path.join(rt, "synthetic", name) +shutil.rmtree(dst_data, ignore_errors=True) +os.makedirs(os.path.dirname(dst_data), exist_ok=True) +shutil.copytree(src, dst_data) +os.makedirs(dst_syn, exist_ok=True) +for fn in ("real.csv", "test.csv", "val.csv"): + shutil.copy(os.path.join(src, fn), os.path.join(dst_syn, fn)) +os.chdir(rt) +os.environ["PYTHONPATH"] = rt + os.pathsep + os.environ.get("PYTHONPATH", "") +os.environ["EFVFM_SMOKE_STEPS"] = "100" +os.environ["EFVFM_ADAPTER_TRAIN"] = "1" +os.environ.setdefault("EFVFM_SAMPLE_BATCH_SIZE", "128") +os.environ.setdefault("EFVFM_EVAL_NUM_SAMPLES", "512") +subprocess.check_call([ + sys.executable, os.path.join(rt, "main.py"), + "--dataname", name, "--mode", "train", "--gpu", "0", + "--no_wandb", "--exp_name", r"adapter_efvfm", +]) diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/gen_20260510_210653.log b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/gen_20260510_210653.log new file mode 100644 index 0000000000000000000000000000000000000000..907a01deeb74c5f7085c7bb26028553c5d1639ee --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/gen_20260510_210653.log @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:31d33869b2d66e790b37e1e95568a8c2fd723b7778f77cadcb9c0d8f01f97a6c +size 11605 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/input_snapshot.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/input_snapshot.json new file mode 100644 index 0000000000000000000000000000000000000000..2d2850302c1d3f9ea567b6863b019da364ee8d9a --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/input_snapshot.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2a6ec1d6050eca471b7e315b6e1853a0caf2f267f24a058ba610ed5ed871159c +size 1367 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/models_tabbyflow/trained.pt b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/models_tabbyflow/trained.pt new file mode 100644 index 0000000000000000000000000000000000000000..f063a878c470d9d40f79db79881596e1e497dffd --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/models_tabbyflow/trained.pt @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:adb734fec12f2251befd371dca69e481b19464aded2a6823105a01b4be6ddbe5 +size 40 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/public_gate/normalized_schema_snapshot.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/public_gate/normalized_schema_snapshot.json new file mode 100644 index 0000000000000000000000000000000000000000..ed2f27e57e828cd83a70cede0727f850a65f5d78 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/public_gate/normalized_schema_snapshot.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:29277905718aadff6392f1a493cc90a009209da285eb3c9cfaa6ed315532ed07 +size 15890 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/public_gate/public_gate_report.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/public_gate/public_gate_report.json new file mode 100644 index 0000000000000000000000000000000000000000..1f66ece22ccef26553e87a13120ec99eb4130e0b --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/public_gate/public_gate_report.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3f3b9879993ec6898672e12c529e80204564945d19d90073329035241094707d +size 925 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/public_gate/staged_input_manifest.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/public_gate/staged_input_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..7894cf90d948890f124c93d00493fda3503ae741 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/public_gate/staged_input_manifest.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18efa052ebf7acfceb2a946281888d96a451259dae53034620c99652b1b65f31 +size 16726 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/run_config.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/run_config.json new file mode 100644 index 0000000000000000000000000000000000000000..4b433bb875d55a4e144ec5d39dd85bb659a119c2 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/run_config.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:56ca79b893451e730321415e85bdeb6b4f925dffdcbe29e481681fb92fcc7980 +size 2130 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/runtime_result.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/runtime_result.json new file mode 100644 index 0000000000000000000000000000000000000000..834765fd0a37d51284ff0db12edf64fd276a5e92 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/runtime_result.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:484b401fb61e1d46d8745b4135055567641e30ba89783be7f29926ee16f3e286 +size 933 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/staged_features.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/staged_features.json new file mode 100644 index 0000000000000000000000000000000000000000..f7a45799d9522e8c70ceeacb01c3e541f566bc0d --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/staged_features.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a57a0c3c2a45c85e74d4496ad733ad7f30b2615f97be5155850895fee1727948 +size 1564 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/test.csv b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/test.csv new file mode 100644 index 0000000000000000000000000000000000000000..cb9afc272bf187c8a1c1827116ca6dc7c4bbe054 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/test.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd9c98343a92c7b1afe63b402f07b9a55013adbfcc60ec1e17d5e026385eeec8 +size 6304860 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/train.csv b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/train.csv new file mode 100644 index 0000000000000000000000000000000000000000..0dd04cf8cc5b17cba0a4a176cbd5639b58b972a4 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/train.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:092346325db7f445db2c00d2f5dd9a8397ecc33eaba7b2b14d9d48d92659fcfc +size 51459027 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/val.csv b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/val.csv new file mode 100644 index 0000000000000000000000000000000000000000..cbb1e83d2c80952e08b23dcc09f8cb5cea219a6a --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/public/val.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69c75639e81916d3b4f2a28db38d7e15c78e442748aa5bf9fed2eb3784912a70 +size 6331589 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/tabbyflow/adapter_report.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/tabbyflow/adapter_report.json new file mode 100644 index 0000000000000000000000000000000000000000..59e53b21db86bd8fe7629a39734d8ade57989656 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/tabbyflow/adapter_report.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ba9507a65d486c834e0e4db94ef9cc0a58be72f5b099138629213c8c93d02fc6 +size 329 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/tabbyflow/adapter_transforms_applied.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/tabbyflow/adapter_transforms_applied.json new file mode 100644 index 0000000000000000000000000000000000000000..6f3aaa01a627a955d2022165805d2786c0da78ba --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/tabbyflow/adapter_transforms_applied.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945 +size 2 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/tabbyflow/model_input_manifest.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/tabbyflow/model_input_manifest.json new file mode 100644 index 0000000000000000000000000000000000000000..ec1495948df8dd2e1290f783a04107785d7235f9 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/staged/tabbyflow/model_input_manifest.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:999e46e2362092f92781dca68a6bf7e22e7bbc0edad665b7150a83154ef17658 +size 16931 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabbyflow-c19-32759-20260510_210653.csv b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabbyflow-c19-32759-20260510_210653.csv new file mode 100644 index 0000000000000000000000000000000000000000..1061d79506d7716f9feaccbe6b43ce6810589b5d --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabbyflow-c19-32759-20260510_210653.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0987e8c8e00cc2fe06cdc59415e2bc32fc5509f3f2de9bc33ca93e3dba2c825 +size 3040256 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabbyflow_train_meta.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabbyflow_train_meta.json new file mode 100644 index 0000000000000000000000000000000000000000..28f2a3a1cdf32fdb4c5e89fe438c33dfe2f00314 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabbyflow_train_meta.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dc462a1d79b96f876d4400ed904699529d43f6df58149443deb01576c2262ddd +size 421 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_cat_test.npy b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_cat_test.npy new file mode 100644 index 0000000000000000000000000000000000000000..cf1d15fb69cd7b6f72af00a38d49711f4bcc9244 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_cat_test.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7e8e273d7cebc9c535de23aac186a248e19f1b9270192e8516df2b3ff4d03b37 +size 360576 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_cat_train.npy b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_cat_train.npy new file mode 100644 index 0000000000000000000000000000000000000000..fca3a3846cebc5898e069bba00d964961f9926ad --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_cat_train.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34a72bf9b360ceafc923a841725257c58f68702db5988848164e6a73030811ca +size 2882920 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_cat_val.npy b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_cat_val.npy new file mode 100644 index 0000000000000000000000000000000000000000..c270bf236a716346950feb1831b13c748f67e8b2 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_cat_val.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d7520984bdd5518919a6429f53fe78669a4c04ec06e58bb0b5388e56628d3080 +size 360400 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_num_test.npy b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_num_test.npy new file mode 100644 index 0000000000000000000000000000000000000000..992e6cc9ecb1f69540b0b2a3726c27ca532f7021 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_num_test.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:30bb71265025b7923a442d2e4818d163e76ace6a48bd5be6e29de20770bc8e15 +size 65664 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_num_train.npy b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_num_train.npy new file mode 100644 index 0000000000000000000000000000000000000000..fede1611458c47aec61bac42b2f1f1d0383ce1e7 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_num_train.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:42ba0171576b4338cee3594e553bc298640933ba7a7c8a127ec106b642ee63e6 +size 524272 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_num_val.npy b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_num_val.npy new file mode 100644 index 0000000000000000000000000000000000000000..b4e2d680e1483c196073ea784ce7add7a3252dbb --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/X_num_val.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:adb8a29c75d7bdc3c8f7e797e555998c90f3b3154ccaeee3dc93d8cbe6c3c2d1 +size 65632 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/info.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/info.json new file mode 100644 index 0000000000000000000000000000000000000000..2bda2ed8d66d951a58f9259faca5696e4f6348f9 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/info.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26b65c13dd436fb96a31e3ea486b261897b74f9a192fe79828dc57be59be2f35 +size 2739 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/real.csv b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/real.csv new file mode 100644 index 0000000000000000000000000000000000000000..0dd04cf8cc5b17cba0a4a176cbd5639b58b972a4 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/real.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:092346325db7f445db2c00d2f5dd9a8397ecc33eaba7b2b14d9d48d92659fcfc +size 51459027 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/staged_features.json b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/staged_features.json new file mode 100644 index 0000000000000000000000000000000000000000..f7a45799d9522e8c70ceeacb01c3e541f566bc0d --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/staged_features.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a57a0c3c2a45c85e74d4496ad733ad7f30b2615f97be5155850895fee1727948 +size 1564 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/test.csv b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/test.csv new file mode 100644 index 0000000000000000000000000000000000000000..cb9afc272bf187c8a1c1827116ca6dc7c4bbe054 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/test.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd9c98343a92c7b1afe63b402f07b9a55013adbfcc60ec1e17d5e026385eeec8 +size 6304860 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/train.csv b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/train.csv new file mode 100644 index 0000000000000000000000000000000000000000..0dd04cf8cc5b17cba0a4a176cbd5639b58b972a4 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/train.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:092346325db7f445db2c00d2f5dd9a8397ecc33eaba7b2b14d9d48d92659fcfc +size 51459027 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/val.csv b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/val.csv new file mode 100644 index 0000000000000000000000000000000000000000..cbb1e83d2c80952e08b23dcc09f8cb5cea219a6a --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/val.csv @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69c75639e81916d3b4f2a28db38d7e15c78e442748aa5bf9fed2eb3784912a70 +size 6331589 diff --git a/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/y_test.npy b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/y_test.npy new file mode 100644 index 0000000000000000000000000000000000000000..b77e2d6fb7a7a8c91668434e24e63b2620d67968 --- /dev/null +++ b/SynthData0523/main/c19/tabbyflow/tabbyflow-c19-20260510_210211/tabular_bundle/pipeline_c19/y_test.npy @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81ee7259842c7941a044da2da22e21e7cfc06ae84f376f61f795079639c0f830 +size 32896