Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyberpunk1210 committed Aug 5, 2022
2 parents 5ec0e6c + 5e92454 commit d5fe924
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 41 deletions.
39 changes: 2 additions & 37 deletions python/chronos/dev/test/run-pytests-onnxrt16.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,43 +27,8 @@ fi

ray stop -f

echo "Running chronos tests TF1 and Deprecated API"
python -m pytest -v test/bigdl/chronos/autots/test_autotsestimator.py::TestAutoTrainer::test_fit_lstm_feature \
test/bigdl/chronos/autots/test_autotsestimator.py::TestAutoTrainer::test_fit_tcn_feature \
test/bigdl/chronos/autots/test_autotsestimator.py::TestAutoTrainer::test_fit_seq2seq_feature \
test/bigdl/chronos/autots/test_tspipeline.py::TestTSPipeline::test_seq2seq_tsppl_support_dataloader \
test/bigdl/chronos/autots/test_tspipeline.py::TestTSPipeline::test_tsppl_quantize_data_creator \
test/bigdl/chronos/autots/model/test_auto_lstm.py::TestAutoLSTM::test_onnx_methods \
test/bigdl/chronos/autots/model/test_auto_lstm.py::TestAutoLSTM::test_save_load \
test/bigdl/chronos/autots/model/test_auto_tcn.py::TestAutoTCN::test_onnx_methods \
test/bigdl/chronos/autots/model/test_auto_tcn.py::TestAutoTCN::test_save_load \
test/bigdl/chronos/autots/model/test_auto_seq2seq.py::TestAutoSeq2Seq::test_onnx_methods \
test/bigdl/chronos/autots/model/test_auto_seq2seq.py::TestAutoSeq2Seq::test_save_load \
test/bigdl/chronos/forecaster/test_lstm_forecaster.py::TestChronosModelLSTMForecaster::test_lstm_forecaster_onnx_methods \
test/bigdl/chronos/forecaster/test_lstm_forecaster.py::TestChronosModelLSTMForecaster::test_lstm_forecaster_quantization_onnx \
test/bigdl/chronos/forecaster/test_lstm_forecaster.py::TestChronosModelLSTMForecaster::test_lstm_forecaster_quantization_onnx_tuning \
test/bigdl/chronos/forecaster/test_lstm_forecaster.py::TestChronosModelLSTMForecaster::test_lstm_forecaster_distributed \
test/bigdl/chronos/forecaster/test_lstm_forecaster.py::TestChronosModelLSTMForecaster::test_lstm_forecaster_fit_loader \
test/bigdl/chronos/forecaster/test_lstm_forecaster.py::TestChronosModelLSTMForecaster::test_forecaster_from_tsdataset_data_loader_onnx \
test/bigdl/chronos/forecaster/test_seq2seq_forecaster.py::TestChronosModelSeq2SeqForecaster::test_s2s_forecaster_onnx_methods \
test/bigdl/chronos/forecaster/test_seq2seq_forecaster.py::TestChronosModelSeq2SeqForecaster::test_s2s_forecaster_distributed \
test/bigdl/chronos/forecaster/test_seq2seq_forecaster.py::TestChronosModelSeq2SeqForecaster::test_s2s_forecaster_fit_loader \
test/bigdl/chronos/forecaster/test_seq2seq_forecaster.py::TestChronosModelSeq2SeqForecaster::test_forecaster_from_tsdataset_data_loader_onnx \
test/bigdl/chronos/forecaster/test_tcn_forecaster.py::TestChronosModelTCNForecaster::test_tcn_forecaster_onnx_methods \
test/bigdl/chronos/forecaster/test_tcn_forecaster.py::TestChronosModelTCNForecaster::test_tcn_forecaster_quantization_onnx \
test/bigdl/chronos/forecaster/test_tcn_forecaster.py::TestChronosModelTCNForecaster::test_tcn_forecaster_quantization_onnx_tuning \
test/bigdl/chronos/forecaster/test_tcn_forecaster.py::TestChronosModelTCNForecaster::test_tcn_forecaster_distributed \
test/bigdl/chronos/forecaster/test_tcn_forecaster.py::TestChronosModelTCNForecaster::test_tcn_forecaster_fit_loader \
test/bigdl/chronos/forecaster/test_tcn_forecaster.py::TestChronosModelTCNForecaster::test_forecaster_from_tsdataset_data_loader_onnx \
test/bigdl/chronos/forecaster/test_tcn_forecaster.py::TestChronosModelTCNForecaster::test_tcn_forecaster_multi_objective_tune_acceleration \
test/bigdl/chronos/forecaster/test_tcn_forecaster.py::TestChronosModelTCNForecaster::test_tcn_forecaster_mo_tune_acceleration_fit_input \
test/bigdl/chronos/forecaster/test_tcn_forecaster.py::TestChronosModelTCNForecaster::test_tcn_forecaster_mo_tune_acceleration_fit \
test/bigdl/chronos/forecaster/test_nbeats_forecaster.py::TestChronosNBeatsForecaster::test_nbeats_forecaster_onnx_methods \
test/bigdl/chronos/forecaster/test_nbeats_forecaster.py::TestChronosNBeatsForecaster::test_nbeats_forecaster_quantization_onnx \
test/bigdl/chronos/forecaster/test_nbeats_forecaster.py::TestChronosNBeatsForecaster::test_nbeats_forecaster_quantization_onnx_tuning \
test/bigdl/chronos/forecaster/test_nbeats_forecaster.py::TestChronosNBeatsForecaster::test_nbeats_forecaster_fit_loader \
test/bigdl/chronos/forecaster/test_nbeats_forecaster.py::TestChronosNBeatsForecaster::test_nbeats_forecaster_distributed \
test/bigdl/chronos/forecaster/test_nbeats_forecaster.py::TestChronosNBeatsForecaster::test_forecaster_from_tsdataset_data_loader_onnx
echo "Running chronos tests onnxrt16"
python -m pytest -v -m "skipif and onnxrt16" test/bigdl/chronos/

exit_status_0=$?
if [ $exit_status_0 -ne 0 ];
Expand Down
2 changes: 1 addition & 1 deletion python/chronos/dev/test/run-pytests-tf1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fi
ray stop -f

echo "Running chronos tests TF1 and Deprecated API"
python -m pytest -v test/bigdl/chronos/model/tf1
python -m pytest -v -m "skipif and tf1" test/bigdl/chronos/model/tf1/

exit_status_0=$?
if [ $exit_status_0 -ne 0 ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def test_predict_evaluation(self):
auto_lstm.evaluate((test_data_x, test_data_y))

@skip_onnxrt
@pytest.mark.onnxrt16
def test_onnx_methods(self):
auto_lstm = get_auto_estimator()
auto_lstm.fit(data=train_dataloader_creator(config={"batch_size": 64}),
Expand All @@ -165,6 +166,7 @@ def test_onnx_methods(self):
pass

@skip_onnxrt
@pytest.mark.onnxrt16
def test_save_load(self):
auto_lstm = get_auto_estimator()
auto_lstm.fit(data=train_dataloader_creator(config={"batch_size": 64}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def test_predict_evaluation(self):
auto_seq2seq.evaluate((test_data_x, test_data_y))

@skip_onnxrt
@pytest.mark.onnxrt16
def test_onnx_methods(self):
auto_seq2seq = get_auto_estimator()
auto_seq2seq.fit(data=train_dataloader_creator(config={"batch_size": 64}),
Expand All @@ -173,6 +174,7 @@ def test_onnx_methods(self):
pass

@skip_onnxrt
@pytest.mark.onnxrt16
def test_save_load(self):
auto_seq2seq = get_auto_estimator()
auto_seq2seq.fit(data=train_dataloader_creator(config={"batch_size": 64}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def test_predict_evaluation(self):
auto_tcn.evaluate((test_data_x, test_data_y))

@skip_onnxrt
@pytest.mark.onnxrt16
def test_onnx_methods(self):
auto_tcn = get_auto_estimator()
auto_tcn.fit(data=train_dataloader_creator(config={"batch_size": 64}),
Expand All @@ -208,6 +209,7 @@ def test_onnx_methods(self):
pass

@skip_onnxrt
@pytest.mark.onnxrt16
def test_save_load(self):
auto_tcn = get_auto_estimator()
auto_tcn.fit(data=train_dataloader_creator(config={"batch_size": 64}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ def customized_metric(y_true, y_pred):
assert 4 <= best_config["past_seq_len"] <= 6

@skip_onnxrt
@pytest.mark.onnxrt16
def test_fit_lstm_feature(self):
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
Expand Down Expand Up @@ -379,6 +380,7 @@ def test_fit_lstm_feature(self):
new_ts_pipeline.fit(tsdata_valid)

@skip_onnxrt
@pytest.mark.onnxrt16
def test_fit_tcn_feature(self):
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
Expand Down Expand Up @@ -447,6 +449,7 @@ def test_fit_tcn_feature(self):
new_ts_pipeline.fit(tsdata_valid)

@skip_onnxrt
@pytest.mark.onnxrt16
def test_fit_seq2seq_feature(self):
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
Expand Down
2 changes: 2 additions & 0 deletions python/chronos/test/bigdl/chronos/autots/test_tspipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def tearDown(self) -> None:
pass

@skip_onnxrt
@pytest.mark.onnxrt16
def test_seq2seq_tsppl_support_dataloader(self):
# load
tsppl_seq2seq = TSPipeline.load(
Expand Down Expand Up @@ -181,6 +182,7 @@ def test_tsppl_mixed_data_type_usage(self):
yhat = tsppl_lstm.predict(data=get_test_tsdataset(), batch_size=16)

@skip_onnxrt
@pytest.mark.onnxrt16
def test_tsppl_quantize_data_creator(self):
# s2s not support quantize
with pytest.raises(RuntimeError):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ def test_lstm_forecaster_fit_eva_pred(self):
assert test_mse[0].shape == test_data[1].shape[1:]

@skip_onnxrt
@pytest.mark.onnxrt16
def test_lstm_forecaster_fit_loader(self):
train_loader, val_loader, test_loader = create_data(loader=True)
forecaster = LSTMForecaster(past_seq_len=24,
Expand All @@ -128,6 +129,7 @@ def test_lstm_forecaster_fit_loader(self):
forecaster.evaluate_with_onnx(test_loader, batch_size=32, quantize=True)

@skip_onnxrt
@pytest.mark.onnxrt16
def test_lstm_forecaster_onnx_methods(self):
train_data, val_data, test_data = create_data()
forecaster = LSTMForecaster(past_seq_len=24,
Expand Down Expand Up @@ -205,6 +207,7 @@ def test_lstm_forecaster_quantization(self):
np.testing.assert_almost_equal(test_pred_save_q, test_pred_load_q)

@skip_onnxrt
@pytest.mark.onnxrt16
def test_lstm_forecaster_quantization_onnx(self):
train_data, val_data, test_data = create_data()
forecaster = LSTMForecaster(past_seq_len=24,
Expand All @@ -219,6 +222,7 @@ def test_lstm_forecaster_quantization_onnx(self):
eval_q = forecaster.evaluate_with_onnx(test_data, quantize=True)

@skip_onnxrt
@pytest.mark.onnxrt16
def test_lstm_forecaster_quantization_onnx_tuning(self):
train_data, val_data, test_data = create_data()
forecaster = LSTMForecaster(past_seq_len=24,
Expand Down Expand Up @@ -308,6 +312,7 @@ def transform_to_dict_x(data):
stop_orca_context()

@skip_onnxrt
@pytest.mark.onnxrt16
def test_lstm_forecaster_distributed(self):
from bigdl.orca import init_orca_context, stop_orca_context
train_data, val_data, test_data = create_data()
Expand Down Expand Up @@ -448,6 +453,7 @@ def test_forecaster_from_tsdataset(self):
assert yhat.shape == y_test.shape

@skip_onnxrt
@pytest.mark.onnxrt16
def test_forecaster_from_tsdataset_data_loader_onnx(self):
train, test = create_tsdataset(roll=False)
train.gen_dt_feature(one_hot_features=['WEEK'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def test_nbeats_forecaster_fit_pred_eva(self):
assert eva[0].shape == test_data[1].shape[1:]

@skip_onnxrt
@pytest.mark.onnxrt16
def test_nbeats_forecaster_fit_loader(self):
train_loader, val_loader, test_loader = create_data(loader=True)
forecaster = NBeatsForecaster(past_seq_len=24,
Expand All @@ -123,6 +124,7 @@ def test_nbeats_forecaster_fit_loader(self):
forecaster.evaluate_with_onnx(test_loader, batch_size=32, quantize=True)

@skip_onnxrt
@pytest.mark.onnxrt16
def test_nbeats_forecaster_onnx_methods(self):
train_data, val_data, test_data = create_data()
forecaster = NBeatsForecaster(past_seq_len=24,
Expand Down Expand Up @@ -199,6 +201,7 @@ def test_nbeats_forecaster_quantization_tuning(self):
np.testing.assert_almost_equal(test_pred_save_q, test_pred_load_q)

@skip_onnxrt
@pytest.mark.onnxrt16
def test_nbeats_forecaster_quantization_onnx(self):
train_data, val_data, test_data = create_data()
forecaster = NBeatsForecaster(past_seq_len=24,
Expand All @@ -212,6 +215,7 @@ def test_nbeats_forecaster_quantization_onnx(self):
eval_q = forecaster.evaluate_with_onnx(test_data, quantize=True)

@skip_onnxrt
@pytest.mark.onnxrt16
def test_nbeats_forecaster_quantization_onnx_tuning(self):
train_data, val_data, test_data = create_data()
forecaster = NBeatsForecaster(past_seq_len=24,
Expand Down Expand Up @@ -289,6 +293,7 @@ def transform_to_dict_x(data):
stop_orca_context()

@skip_onnxrt
@pytest.mark.onnxrt16
def test_nbeats_forecaster_distributed(self):
train_data, val_data, test_data = create_data()
_train_loader, _, _test_loader = create_data(loader=True)
Expand Down Expand Up @@ -434,6 +439,7 @@ def test_forecaster_from_tsdataset(self):
assert yhat.shape == y_test.shape

@skip_onnxrt
@pytest.mark.onnxrt16
def test_forecaster_from_tsdataset_data_loader_onnx(self):
train, test = create_tsdataset(roll=False)
loader = train.to_torch_data_loader(roll=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def test_s2s_forecaster_fit_eva_pred(self):
assert test_mse[0].shape == test_data[1].shape[1:]

@skip_onnxrt
@pytest.mark.onnxrt16
def test_s2s_forecaster_fit_loader(self):
train_loader, val_loader, test_loader = create_data(loader=True)
forecaster = Seq2SeqForecaster(past_seq_len=24,
Expand All @@ -120,6 +121,7 @@ def test_s2s_forecaster_fit_loader(self):


@skip_onnxrt
@pytest.mark.onnxrt16
def test_s2s_forecaster_onnx_methods(self):
train_data, val_data, test_data = create_data()
forecaster = Seq2SeqForecaster(past_seq_len=24,
Expand Down Expand Up @@ -250,6 +252,7 @@ def transform_to_dict_x(data):
stop_orca_context()

@skip_onnxrt
@pytest.mark.onnxrt16
def test_s2s_forecaster_distributed(self):
from bigdl.orca import init_orca_context, stop_orca_context
train_data, val_data, test_data = create_data()
Expand Down Expand Up @@ -391,6 +394,7 @@ def test_forecaster_from_tsdataset(self):
assert yhat.shape == y_test.shape

@skip_onnxrt
@pytest.mark.onnxrt16
def test_forecaster_from_tsdataset_data_loader_onnx(self):
train, test = create_tsdataset(roll=False)
train.gen_dt_feature(one_hot_features=['WEEK'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def test_tcn_forecaster_fit_eva_pred(self):
assert test_mse[0].shape == test_data[1].shape[1:]

@skip_onnxrt
@pytest.mark.onnxrt16
def test_tcn_forecaster_fit_loader(self):
train_loader, val_loader, test_loader = create_data(loader=True)
forecaster = TCNForecaster(past_seq_len=24,
Expand Down Expand Up @@ -227,6 +228,7 @@ def test_tcn_forecaster_mo_tune_acceleration_fit(self):
forecaster.fit(train_data, epochs=2, use_trial_id=0)

@skip_onnxrt
@pytest.mark.onnxrt16
def test_tcn_forecaster_onnx_methods(self):
train_data, val_data, test_data = create_data()
forecaster = TCNForecaster(past_seq_len=24,
Expand Down Expand Up @@ -328,6 +330,7 @@ def test_tcn_forecaster_quantization(self):
np.testing.assert_almost_equal(test_pred_save_q, test_pred_load_q)

@skip_onnxrt
@pytest.mark.onnxrt16
def test_tcn_forecaster_quantization_onnx(self):
train_data, val_data, test_data = create_data()
forecaster = TCNForecaster(past_seq_len=24,
Expand All @@ -344,6 +347,7 @@ def test_tcn_forecaster_quantization_onnx(self):
eval_q = forecaster.evaluate_with_onnx(test_data, quantize=True)

@skip_onnxrt
@pytest.mark.onnxrt16
def test_tcn_forecaster_quantization_onnx_tuning(self):
train_data, val_data, test_data = create_data()
forecaster = TCNForecaster(past_seq_len=24,
Expand Down Expand Up @@ -440,6 +444,7 @@ def transform_to_dict_x(data):
stop_orca_context()

@skip_onnxrt
@pytest.mark.onnxrt16
def test_tcn_forecaster_distributed(self):
from bigdl.orca import init_orca_context, stop_orca_context
train_data, val_data, test_data = create_data()
Expand Down Expand Up @@ -584,6 +589,7 @@ def test_forecaster_from_tsdataset(self):
assert yhat.shape == y_test.shape

@skip_onnxrt
@pytest.mark.onnxrt16
def test_forecaster_from_tsdataset_data_loader_onnx(self):
train, test = create_tsdataset(roll=False)
train.gen_dt_feature(one_hot_features=['WEEK'])
Expand Down
3 changes: 3 additions & 0 deletions python/chronos/test/bigdl/chronos/model/tf1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import pytest
import tensorflow as tf
skip_tf = pytest.mark.skipif(tf.__version__ > '2.0.0', reason="Run only when tf==1.15.0.")
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
from numpy.testing import assert_array_almost_equal
import pandas as pd
import numpy as np
from . import skip_tf


@pytest.mark.skipif(tf.__version__ > '2.0.0', reason="Run only when tf==1.15.0.")
@skip_tf
@pytest.mark.tf1
class TestSeq2Seq(ZooTestCase):

def setup_method(self, method):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import tempfile
import os
import tensorflow as tf
from . import skip_tf


def create_data():
Expand All @@ -41,7 +42,9 @@ def get_x_y(num_samples):
test_data = get_x_y(num_test_samples)
return train_data, val_data, test_data

@pytest.mark.skipif(tf.__version__ > '2.0.0', reason="Run only when tf==1.15.0.")

@skip_tf
@pytest.mark.tf1
class TestVanillaLSTM(TestCase):
train_data, val_data, test_data = create_data()
model = VanillaLSTM()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import numpy as np
import tensorflow as tf
from numpy.testing import assert_array_almost_equal
from . import skip_tf


def create_data():
Expand Down Expand Up @@ -52,7 +53,8 @@ def get_data(num_samples):
return tsdata_train, tsdata_test


@pytest.mark.skipif(tf.__version__ > '2.0.0', reason="Run only when tf==1.15.0.")
@pytest.mark.tf1
@skip_tf
class TestMTNetKeras(TestCase):

def setup_method(self, method):
Expand Down

0 comments on commit d5fe924

Please sign in to comment.