FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

docs: fix documentation for pydantic v2 by samsja · Pull Request #1815 · docarray/docarray · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .md  (1) .py  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
9 changes: 5 additions & 4 deletions README.md
This file contains hidden or 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
Expand Up @@ -111,8 +111,8 @@ class MyDocument(BaseDoc):
image_url: ImageUrl # could also be VideoUrl, AudioUrl, etc.
image_tensor: Optional[
TorchTensor[1704, 2272, 3]
] # could also be NdArray or TensorflowTensor
embedding: Optional[TorchTensor]
] = None # could also be NdArray or TensorflowTensor
embedding: Optional[TorchTensor] = None
```

So not only can you define the types of your data, you can even **specify the shape of your tensors!**
Expand Down Expand Up @@ -643,8 +643,8 @@ import tensorflow as tf


class Podcast(BaseDoc):
audio_tensor: Optional[AudioTensorFlowTensor]
embedding: Optional[AudioTensorFlowTensor]
audio_tensor: Optional[AudioTensorFlowTensor] = None
embedding: Optional[AudioTensorFlowTensor] = None


class MyPodcastModel(tf.keras.Model):
Expand Down Expand Up @@ -713,6 +713,7 @@ async def create_item(doc: InputDoc) -> OutputDoc:
)
return doc


input_doc = InputDoc(text='', img=ImageDoc(tensor=np.random.random((3, 224, 224))))

async with AsyncClient(app=app, base_url="http://test") as ac:
Expand Down
1 change: 0 additions & 1 deletion tests/documentation/test_docs.py
This file contains hidden or 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
Expand Up @@ -70,7 +70,6 @@ def test_files_good(fpath):
check_md_file(fpath=fpath, memory=True, keyword_ignore=['pickle', 'jac'])


@pytest.mark.skipif(is_pydantic_v2, reason="Not working with pydantic v2 for now")
def test_readme():
check_md_file(
fpath='README.md',
Expand Down

Back | FazBrowse Home | New Git URL