-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dave Berenbaum
authored
Jul 12, 2024
1 parent
4190e08
commit ee3d16c
Showing
4 changed files
with
42 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pytest | ||
import torch | ||
from torch import float32 | ||
from torchvision.transforms import v2 | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def fake_clip_model(): | ||
class Model: | ||
def encode_image(self, tensor): | ||
return torch.randn(len(tensor), 512) | ||
|
||
def encode_text(self, tensor): | ||
return torch.randn(len(tensor), 512) | ||
|
||
def tokenizer(tensor, context_length=77): | ||
return torch.randn(len(tensor), context_length) | ||
|
||
model = Model() | ||
preprocess = v2.ToDtype(float32, scale=True) | ||
return model, preprocess, tokenizer |
This file contains 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
This file contains 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