Add contribution and issue templates #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: smoke | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| jobs: | |
| cpu-smoke: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install package | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e .[viz] | |
| - name: Synthetic train smoke | |
| run: | | |
| python -m qlib_gpu_model.train \ | |
| --data-source synthetic \ | |
| --device cpu \ | |
| --seq-len 16 \ | |
| --num-features 8 \ | |
| --model-dim 32 \ | |
| --num-heads 4 \ | |
| --num-layers 1 \ | |
| --ff-dim 64 \ | |
| --batch-size 32 \ | |
| --epochs 1 \ | |
| --num-workers 0 \ | |
| --amp-dtype fp32 \ | |
| --use-compile false \ | |
| --out-dir outputs/ci_synth | |
| - name: Inference smoke | |
| run: | | |
| python -m qlib_gpu_model.infer \ | |
| --checkpoint outputs/ci_synth/best.pt \ | |
| --device cpu \ | |
| --batch-size 16 \ | |
| --iters 10 \ | |
| --warmup 2 | |
| - name: Build local parquet fixture | |
| run: | | |
| python - <<'PY' | |
| from pathlib import Path | |
| import numpy as np | |
| import pandas as pd | |
| out = Path("data/ci_fixture.parquet") | |
| out.parent.mkdir(parents=True, exist_ok=True) | |
| dates = pd.date_range("2022-01-03", periods=40, freq="B") | |
| symbols = ["AAA", "BBB", "CCC"] | |
| rows = [] | |
| for sym_idx, symbol in enumerate(symbols): | |
| for t, dt in enumerate(dates): | |
| f1 = np.sin(t / 3.0 + sym_idx) | |
| f2 = np.cos(t / 5.0 + sym_idx * 0.7) | |
| f3 = 0.02 * t + sym_idx * 0.1 | |
| label = 0.25 * f1 - 0.15 * f2 + 0.03 * f3 | |
| rows.append( | |
| { | |
| "datetime": dt, | |
| "instrument": symbol, | |
| "f1": f1, | |
| "f2": f2, | |
| "f3": f3, | |
| "label": label, | |
| } | |
| ) | |
| pd.DataFrame(rows).to_parquet(out, index=False) | |
| print(f"wrote {out}") | |
| PY | |
| - name: Parquet train smoke | |
| run: | | |
| python -m qlib_gpu_model.train \ | |
| --data-source parquet \ | |
| --parquet-path data/ci_fixture.parquet \ | |
| --target-col label \ | |
| --device cpu \ | |
| --seq-len 8 \ | |
| --model-dim 32 \ | |
| --num-heads 4 \ | |
| --num-layers 1 \ | |
| --ff-dim 64 \ | |
| --batch-size 16 \ | |
| --epochs 1 \ | |
| --num-workers 0 \ | |
| --amp-dtype fp32 \ | |
| --use-compile false \ | |
| --out-dir outputs/ci_parquet | |
| - name: Backtest smoke | |
| run: | | |
| python -m qlib_gpu_model.backtest \ | |
| --checkpoint outputs/ci_parquet/best.pt \ | |
| --parquet-path data/ci_fixture.parquet \ | |
| --target-col label \ | |
| --device cpu \ | |
| --split valid \ | |
| --top-quantile 0.34 \ | |
| --transaction-cost-bps 5 |