Skip to content

Commit a0b9851

Browse files
committed
Prepare repository for public release
1 parent 12d9874 commit a0b9851

5 files changed

Lines changed: 265 additions & 375 deletions

File tree

.github/workflows/smoke.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 LLAA178
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)