Rifat Mamayusupov
commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
---
|
| 4 |
+
|
| 5 |
+
# Model discription and Inference
|
| 6 |
+
|
| 7 |
+
**Image to Text** modeli bu asosan pre-trained qilingan model ustiga fine-tuned qilindi juda kam dataset bilan.
|
| 8 |
+
|
| 9 |
+
epoch soni : 50 ta
|
| 10 |
+
loss: 0.03....
|
| 11 |
+
train_time: o'rtacha 45 minute.
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
*Dataset* image and uning dscription holatidan bo'ladi.
|
| 15 |
+
|
| 16 |
+
misol uchun :
|
| 17 |
+
|
| 18 |
+
``` from datasets import load_dataset
|
| 19 |
+
dataset = load_dataset("ybelkada/football-dataset", split="train")```
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
### Usage model
|
| 23 |
+
|
| 24 |
+
``` from transformers import AutoProcessor, BlipForConditionalGeneration
|
| 25 |
+
|
| 26 |
+
processor = AutoProcessor.from_pretrained("ai-nightcoder/Image2text")
|
| 27 |
+
model = BlipForConditionalGeneration.from_pretrained("ai-nightcoder/Image2text") ```
|
| 28 |
+
|
| 29 |
+
#### image olamiz
|
| 30 |
+
``` example = dataset[0]
|
| 31 |
+
image = example["image"]
|
| 32 |
+
image ```
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
#### generate qismi.
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
```inputs = processor(images=image, return_tensors="pt").to(device)
|
| 39 |
+
pixel_values = inputs.pixel_values
|
| 40 |
+
|
| 41 |
+
generated_ids = model.generate(pixel_values=pixel_values, max_length=50)
|
| 42 |
+
generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 43 |
+
print(generated_caption) ```
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
**Yuqorida ko'rsatgan tartibda modeldan foydalanishni tavsiya qilaman.**
|