Skip to content

Commit 602a197

Browse files
committed
fix(ci): reject empty sequences in CausalLM forward and consolidate macOS wheel CI
1 parent 2f10c8f commit 602a197

3 files changed

Lines changed: 26 additions & 13 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ jobs:
5656
- name: Robustness tests (release profile, Ubuntu only)
5757
if: matrix.os == 'ubuntu-latest'
5858
run: cargo test --release --test robustness
59+
# Build and exercise the macOS wheel in the same runner instead of queuing two additional
60+
# hosted arm64 macOS jobs (which hit hosted-runner acquisition timeouts under queue contention).
61+
- name: Wheel build and test (macOS, Python 3.12)
62+
if: matrix.os == 'macos-latest'
63+
run: |
64+
python -m pip install maturin numpy
65+
maturin build --out dist
66+
python -m pip install --no-index --find-links dist oxideon
67+
python tests/test_python_package.py
68+
python tests/test_python_ergonomics.py
5969
6070
# The wheel is built once per OS (the extension is abi3, so one wheel serves every supported Python) and then
6171
# installed and exercised under each supported Python version below.
@@ -65,7 +75,7 @@ jobs:
6575
strategy:
6676
fail-fast: false
6777
matrix:
68-
os: [ubuntu-24.04, windows-latest, macos-latest]
78+
os: [ubuntu-24.04, windows-latest]
6979
defaults:
7080
run:
7181
shell: bash
@@ -89,19 +99,8 @@ jobs:
8999
fail-fast: false
90100
# ubuntu-latest is now 26.04, which setup-python has no Python 3.9 for: the wheel jobs are pinned to 24.04
91101
matrix:
92-
os: [ubuntu-24.04, windows-latest, macos-latest]
102+
os: [ubuntu-24.04, windows-latest]
93103
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
94-
exclude:
95-
# Wheel is abi3-py39 (identical binary across Python 3.9–3.13); Ubuntu and Windows test every version
96-
# while macOS tests 3.12 to avoid competing for limited hosted macOS runner concurrency.
97-
- os: macos-latest
98-
python: "3.9"
99-
- os: macos-latest
100-
python: "3.10"
101-
- os: macos-latest
102-
python: "3.11"
103-
- os: macos-latest
104-
python: "3.13"
105104
defaults:
106105
run:
107106
shell: bash

‎crates/oxideon-core/src/nn/transformer.rs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,11 @@ impl CausalLM {
833833

834834
/// Forward pass using a stateful [`KVCache`] for incremental autoregressive decoding.
835835
pub fn forward_cached(&self, tokens: &Tensor, cache: &mut KVCache) -> Result<Tensor> {
836+
if tokens.numel() == 0 {
837+
return Err(Error::Msg(
838+
"forward_cached: input sequence cannot be empty".into(),
839+
));
840+
}
836841
if cache.layers.len() != self.blocks.len() {
837842
return Err(Error::Msg(format!(
838843
"forward_cached: cache has {} layers but the model has {} (cache built for another model?)",
@@ -1075,6 +1080,11 @@ impl CausalLM {
10751080

10761081
impl Module for CausalLM {
10771082
fn forward(&self, tokens: &Tensor) -> Result<Tensor> {
1083+
if tokens.numel() == 0 {
1084+
return Err(Error::Msg(
1085+
"CausalLM::forward: input sequence cannot be empty".into(),
1086+
));
1087+
}
10781088
let mut h = self.tok_emb.forward(tokens)?;
10791089
for blk in &self.blocks {
10801090
h = blk.forward_rope(&h, &self.rope)?;

‎examples/c_embed/CMakeLists.txt‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,20 @@ find_program(CARGO_EXECUTABLE cargo REQUIRED)
1818
if(WIN32)
1919
set(OXIDEON_LIB_FILE "${OXIDEON_LIB_DIR}/oxideon.dll")
2020
set(OXIDEON_IMPLIB_FILE "${OXIDEON_LIB_DIR}/oxideon.dll.lib")
21+
set(OXIDEON_BYPRODUCTS "${OXIDEON_LIB_FILE}" "${OXIDEON_IMPLIB_FILE}")
2122
elseif(APPLE)
2223
set(OXIDEON_LIB_FILE "${OXIDEON_LIB_DIR}/liboxideon.dylib")
24+
set(OXIDEON_BYPRODUCTS "${OXIDEON_LIB_FILE}")
2325
else()
2426
set(OXIDEON_LIB_FILE "${OXIDEON_LIB_DIR}/liboxideon.so")
27+
set(OXIDEON_BYPRODUCTS "${OXIDEON_LIB_FILE}")
2528
endif()
2629

2730
add_custom_target(oxideon_rust ALL
2831
COMMAND "${CARGO_EXECUTABLE}" build --release -p oxideon
2932
--manifest-path "${OXIDEON_ROOT}/Cargo.toml"
3033
--target-dir "${OXIDEON_CARGO_TARGET_DIR}"
34+
BYPRODUCTS ${OXIDEON_BYPRODUCTS}
3135
COMMENT "Building the Oxideon shared library with cargo"
3236
USES_TERMINAL)
3337

0 commit comments

Comments
 (0)