|
| 1 | +name: smoke |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + pull_request: |
| 7 | + |
| 8 | +jobs: |
| 9 | + cpu-smoke: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + timeout-minutes: 20 |
| 12 | + |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - uses: actions/setup-python@v5 |
| 17 | + with: |
| 18 | + python-version: "3.11" |
| 19 | + |
| 20 | + - name: Install package |
| 21 | + run: | |
| 22 | + python -m pip install --upgrade pip |
| 23 | + python -m pip install -e .[viz] |
| 24 | +
|
| 25 | + - name: Synthetic train smoke |
| 26 | + run: | |
| 27 | + python -m qlib_gpu_model.train \ |
| 28 | + --data-source synthetic \ |
| 29 | + --device cpu \ |
| 30 | + --seq-len 16 \ |
| 31 | + --num-features 8 \ |
| 32 | + --model-dim 32 \ |
| 33 | + --num-heads 4 \ |
| 34 | + --num-layers 1 \ |
| 35 | + --ff-dim 64 \ |
| 36 | + --batch-size 32 \ |
| 37 | + --epochs 1 \ |
| 38 | + --num-workers 0 \ |
| 39 | + --amp-dtype fp32 \ |
| 40 | + --use-compile false \ |
| 41 | + --out-dir outputs/ci_synth |
| 42 | +
|
| 43 | + - name: Inference smoke |
| 44 | + run: | |
| 45 | + python -m qlib_gpu_model.infer \ |
| 46 | + --checkpoint outputs/ci_synth/best.pt \ |
| 47 | + --device cpu \ |
| 48 | + --batch-size 16 \ |
| 49 | + --iters 10 \ |
| 50 | + --warmup 2 |
| 51 | +
|
| 52 | + - name: Build local parquet fixture |
| 53 | + run: | |
| 54 | + python - <<'PY' |
| 55 | + from pathlib import Path |
| 56 | + import numpy as np |
| 57 | + import pandas as pd |
| 58 | +
|
| 59 | + out = Path("data/ci_fixture.parquet") |
| 60 | + out.parent.mkdir(parents=True, exist_ok=True) |
| 61 | +
|
| 62 | + dates = pd.date_range("2022-01-03", periods=40, freq="B") |
| 63 | + symbols = ["AAA", "BBB", "CCC"] |
| 64 | + rows = [] |
| 65 | + for sym_idx, symbol in enumerate(symbols): |
| 66 | + for t, dt in enumerate(dates): |
| 67 | + f1 = np.sin(t / 3.0 + sym_idx) |
| 68 | + f2 = np.cos(t / 5.0 + sym_idx * 0.7) |
| 69 | + f3 = 0.02 * t + sym_idx * 0.1 |
| 70 | + label = 0.25 * f1 - 0.15 * f2 + 0.03 * f3 |
| 71 | + rows.append( |
| 72 | + { |
| 73 | + "datetime": dt, |
| 74 | + "instrument": symbol, |
| 75 | + "f1": f1, |
| 76 | + "f2": f2, |
| 77 | + "f3": f3, |
| 78 | + "label": label, |
| 79 | + } |
| 80 | + ) |
| 81 | + pd.DataFrame(rows).to_parquet(out, index=False) |
| 82 | + print(f"wrote {out}") |
| 83 | + PY |
| 84 | +
|
| 85 | + - name: Parquet train smoke |
| 86 | + run: | |
| 87 | + python -m qlib_gpu_model.train \ |
| 88 | + --data-source parquet \ |
| 89 | + --parquet-path data/ci_fixture.parquet \ |
| 90 | + --target-col label \ |
| 91 | + --device cpu \ |
| 92 | + --seq-len 8 \ |
| 93 | + --model-dim 32 \ |
| 94 | + --num-heads 4 \ |
| 95 | + --num-layers 1 \ |
| 96 | + --ff-dim 64 \ |
| 97 | + --batch-size 16 \ |
| 98 | + --epochs 1 \ |
| 99 | + --num-workers 0 \ |
| 100 | + --amp-dtype fp32 \ |
| 101 | + --use-compile false \ |
| 102 | + --out-dir outputs/ci_parquet |
| 103 | +
|
| 104 | + - name: Backtest smoke |
| 105 | + run: | |
| 106 | + python -m qlib_gpu_model.backtest \ |
| 107 | + --checkpoint outputs/ci_parquet/best.pt \ |
| 108 | + --parquet-path data/ci_fixture.parquet \ |
| 109 | + --target-col label \ |
| 110 | + --device cpu \ |
| 111 | + --split valid \ |
| 112 | + --top-quantile 0.34 \ |
| 113 | + --transaction-cost-bps 5 |
0 commit comments