Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move test, update requirements #76

Merged
merged 28 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
20743fd
move test_dense_connect to correct dir
evelynmitchell Dec 29, 2023
b5d24b7
add numexpr to requirements
evelynmitchell Dec 29, 2023
5ad258f
remove unneeded test
evelynmitchell Dec 29, 2023
bd81992
fix for bug 77
evelynmitchell Dec 29, 2023
bdf2090
video_tensor_to_gif typo fix
evelynmitchell Dec 29, 2023
2c97ca5
raise NotImplemente in base.py
evelynmitchell Dec 29, 2023
da4cf77
base.py pass
evelynmitchell Dec 29, 2023
fb42d87
fixed test _basemodel
evelynmitchell Dec 29, 2023
0a402e8
Merge pull request #1 from kyegomez/master
evelynmitchell Dec 29, 2023
c7e6552
typo
evelynmitchell Dec 30, 2023
b618c39
adjust atol in test
evelynmitchell Dec 30, 2023
4fc6fb9
atol to 4
evelynmitchell Dec 30, 2023
662975d
quantize default bits tolerance
evelynmitchell Dec 30, 2023
be088f0
default bits tolerance
evelynmitchell Dec 30, 2023
f0cbb70
tolerance 1
evelynmitchell Dec 30, 2023
e9f1911
remove broken assert
evelynmitchell Dec 30, 2023
5b60516
removed unneeded test
evelynmitchell Dec 30, 2023
00c21e1
typo
evelynmitchell Dec 30, 2023
01bc825
remove parameterize
evelynmitchell Dec 30, 2023
61c4b18
remove bad test
evelynmitchell Dec 30, 2023
c891cbd
fix test typo
evelynmitchell Dec 30, 2023
0458ae6
try capsys wo deref
evelynmitchell Dec 30, 2023
8a65082
wo out
evelynmitchell Dec 30, 2023
6330be0
not stderr
evelynmitchell Dec 30, 2023
14c55e6
Merge pull request #2 from kyegomez/master
evelynmitchell Dec 30, 2023
b6a821b
refactor test_top_a to have logit values
evelynmitchell Dec 30, 2023
fb97f3a
correct implementation of top_a
evelynmitchell Dec 30, 2023
997c2ec
base model test
evelynmitchell Dec 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions docs/zeta/ops/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,7 @@ Returns:

Let's explore some usage examples of the functions provided by the zeta library.

#### 5.1 Example 1: Matrix Inverse Root using

Eigen Method
#### 5.1 Example 1: Matrix Inverse Root using Eigen Method

In this example, we will compute the matrix inverse root of a symmetric positive definite matrix using the eigen method. We will use the following parameters:

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ mkdocs
mkdocs-material
mkdocs-glightbox
skypilot==0.4.1
argparse
argparse
numexpr
9 changes: 0 additions & 9 deletions tests/tokenizers/test_tokenmonster.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,6 @@ def test_token_monster_new():
assert tokenizer.vocab is not None


def test_token_monster_save():
tokenizer = TokenMonster("englishcode-32000-consistent-v1")
tokenizer.save("/path/to/your/file") # replace with your actual file path

# There's no direct way to assert the effect of this method as it doesn't return anything
# and it doesn't change any accessible state of the TokenMonster object.
# You might need to check manually if the file is saved correctly.


def test_token_monster_export_yaml():
tokenizer = TokenMonster("englishcode-32000-consistent-v1")
yaml = tokenizer.export_yaml()
Expand Down
8 changes: 4 additions & 4 deletions tests/utils/test_absmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
quant, dequant = absmax_quantize(x)
assert quant.dtype == torch.int8
assert dequant.dtype == torch.float32
assert torch.allclose(dequant, x, atol=1 / (2**7))
assert torch.allclose(dequant, x, atol=1e-5)

Check warning

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Warning test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Fixed Show fixed Hide fixed


def test_absmax_quantize_custom_bits():
x = torch.randn(128)
quant, dequant = absmax_quantize(x, bits=16)
assert quant.dtype == torch.int8
assert dequant.dtype == torch.float32
assert torch.allclose(dequant, x, atol=1 / (2**15))
assert torch.allclose(dequant, x, atol=1e-5)

Check warning

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Warning test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Fixed Show fixed Hide fixed


def test_absmax_quantize_zero_tensor():
Expand All @@ -29,11 +29,11 @@
x = torch.ones(128)
quant, dequant = absmax_quantize(x)
assert torch.all(quant == 2**7 - 1)
assert torch.allclose(dequant, x, atol=1 / (2**7))
assert torch.allclose(dequant, x, atol=1e-5)

Check warning

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Warning test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Fixed Show fixed Hide fixed


def test_absmax_quantize_negative_tensor():
x = -torch.ones(128)
quant, dequant = absmax_quantize(x)
assert torch.all(quant == -(2**7 - 1))
assert torch.allclose(dequant, x, atol=1 / (2**7))
assert torch.allclose(dequant, x, atol=1e-5)

Check warning

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Warning test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Fixed Show fixed Hide fixed
9 changes: 0 additions & 9 deletions tests/utils/test_cast_tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,3 @@ def test_cast_tuple_parametrized(value, depth, expected):
def test_cast_tuple_exception():
with pytest.raises(TypeError):
cast_tuple(5, "a")


# Test with mock and monkeypatch
def test_cast_tuple_with_mock_and_monkeypatch(monkeypatch):
def mock_isinstance(val, t):
return False

monkeypatch.setattr("builtins.isinstance", mock_isinstance)
assert cast_tuple((1, 2), 1) == ((1, 2),)
3 changes: 1 addition & 2 deletions zeta/models/base.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from abc import ABC


class BaseModel(ABC):
def __init__(self, *args, **kwargs):
pass

def forward(self):
pass
raise NotImplementedError
2 changes: 1 addition & 1 deletion zeta/utils/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def seek_all_images(img, channels=3):

# tensor of shape (channels, frames, height, width) -> GIF
def video_tensor_to_gift(tensor, path, duration=120, loop=0, optimize=True):
images = map(T.ToPilImage(), tensor.unbind(dim=1))
images = map(T.ToPILImage(), tensor.unbind(dim=1))
first_img, *rest_imgs = images
first_img.save(
path,
Expand Down
Loading