Skip to content

Commit 24d21c9

Browse files
authored
Reorganize unit tests and update CICD (#37)
* Reorganize unit tests and update CICD * Fix pylint
1 parent 59ad210 commit 24d21c9

13 files changed

+51
-13
lines changed

.github/workflows/release.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ jobs:
3131
release:
3232
name: Create Release with tag
3333
runs-on: ${{ matrix.os }}
34-
needs: release
3534
strategy:
3635
matrix:
3736
os: [ubuntu-20.04]

.github/workflows/unit_tests.yaml

+4-10
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,9 @@ jobs:
7474
- name: Install Dependencies
7575
run: |
7676
pip install -r requirements.txt
77-
- name: Test mock JetStream token utils
77+
- name: Run all unit tests in JetStream (jetstream/tests)
7878
run: |
79-
python -m jetstream.engine.utils_test
80-
- name: Test mock JetStream engine implementation
79+
coverage run -m unittest -v
80+
- name: Create test coverage report
8181
run: |
82-
python -m jetstream.engine.mock_engine_test
83-
- name: Test JetStream core orchestrator
84-
run: |
85-
python -m jetstream.core.orchestrator_test
86-
- name: Test JetStream core server library
87-
run: |
88-
python -m jetstream.core.server_test
82+
coverage report -m

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ __pycache__
33
build/
44
dist/
55
google_jetstream.egg-info/
6+
.coverage
67

78
# local folders
89
data/

jetstream/tests/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.

jetstream/tests/core/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
File renamed without changes.
File renamed without changes.

jetstream/tests/engine/__init__.py

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.

jetstream/tests/engine/test_token_utils.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
"""Tests functionality of the tokenizer with supported models."""
16+
1517
import os
1618
import unittest
1719
from typing import List
@@ -24,7 +26,8 @@ class SPTokenizer:
2426
"""Tokenier used in original llama2 git"""
2527

2628
def __init__(self, tokenizer_path: str):
27-
self.tokenizer = SentencePieceProcessor(model_file=tokenizer_path)
29+
self.tokenizer = SentencePieceProcessor()
30+
self.tokenizer.Load(model_file=tokenizer_path)
2831
assert self.tokenizer.vocab_size() == self.tokenizer.get_piece_size()
2932

3033
def decode(self, t: List[int]) -> str:
File renamed without changes.

requirements.in

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
absl-py
2+
coverage
23
flax
34
grpcio
45
jax

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ clu==0.0.10
3737
# via seqio
3838
contextlib2==21.6.0
3939
# via ml-collections
40+
coverage==7.4.4
41+
# via -r requirements.in
4042
dm-tree==0.1.8
4143
# via
4244
# chex
@@ -49,7 +51,6 @@ etils[array-types,enp,epath,epy,etqdm,etree]==1.6.0
4951
# via
5052
# array-record
5153
# clu
52-
# etils
5354
# orbax-checkpoint
5455
# tfds-nightly
5556
flatbuffers==23.5.26

0 commit comments

Comments
 (0)