-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-distributed-test
- Loading branch information
Showing
9 changed files
with
176 additions
and
68 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,34 @@ | ||
from datachain.lib.dc import C, DataChain | ||
from datachain.lib.feature import Feature | ||
from datachain.lib.feature_utils import pydantic_to_feature | ||
from datachain.lib.file import File, FileError, FileFeature, IndexedFile, TarVFile | ||
from datachain.lib.image import ImageFile, convert_images | ||
from datachain.lib.text import convert_text | ||
from datachain.lib.udf import Aggregator, Generator, Mapper | ||
from datachain.lib.utils import AbstractUDF, DataChainError | ||
from datachain.query.dataset import UDF as BaseUDF # noqa: N811 | ||
from datachain.query.schema import Column | ||
from datachain.query.session import Session | ||
|
||
__all__ = [ | ||
"AbstractUDF", | ||
"Aggregator", | ||
"BaseUDF", | ||
"C", | ||
"Column", | ||
"DataChain", | ||
"DataChainError", | ||
"Feature", | ||
"File", | ||
"FileError", | ||
"FileFeature", | ||
"Generator", | ||
"ImageFile", | ||
"IndexedFile", | ||
"Mapper", | ||
"Session", | ||
"TarVFile", | ||
"convert_images", | ||
"convert_text", | ||
"pydantic_to_feature", | ||
] |
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
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
Oops, something went wrong.