Skip to content

Commit

Permalink
Update src/transformers/models/textnet/modeling_textnet.py
Browse files Browse the repository at this point in the history
Co-authored-by: Pavel Iakubovskii <[email protected]>
  • Loading branch information
jadechoghari and qubvel authored Dec 21, 2024
1 parent 5f29454 commit ed36fef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/transformers/models/textnet/modeling_textnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,10 @@ def forward(
Examples:
```python
>>> from transformers import TextNetForImageClassification,TextNetImageProcessor
>>> from PIL import Image
>>> import torch
>>> import requests
>>> from transformers import TextNetForImageClassification, TextNetImageProcessor
>>> from PIL import Image
>>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
>>> image = Image.open(requests.get(url, stream=True).raw)
Expand All @@ -357,7 +358,8 @@ def forward(
>>> model = TextNetForImageClassification.from_pretrained("Raghavan/textnet-base")
>>> inputs = processor(images=image, return_tensors="pt", size={"height": 640, "width": 640})
>>> outputs = model(**inputs)
>>> with torch.no_grad():
... outputs = model(**inputs)
>>> outputs.logits.shape
torch.Size([1, 2])
```"""
Expand Down

0 comments on commit ed36fef

Please sign in to comment.