hieudinhpro
commited on
Commit
•
c712915
1
Parent(s):
22dfa47
Update README.md
Browse files
README.md
CHANGED
@@ -9,7 +9,7 @@ model-index:
|
|
9 |
language:
|
10 |
- en
|
11 |
library_name: transformers
|
12 |
-
pipeline_tag:
|
13 |
---
|
14 |
|
15 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
@@ -17,21 +17,44 @@ should probably proofread and complete it, then remove this comment. -->
|
|
17 |
|
18 |
# git-base-on-diffuision-dataset2
|
19 |
|
20 |
-
This model is a fine-tuned version of [microsoft/git-base](https://huggingface.co/microsoft/git-base) on
|
21 |
|
22 |
## Model description
|
23 |
|
24 |
-
More information needed
|
25 |
|
26 |
-
## Intended uses & limitations
|
27 |
|
28 |
-
|
29 |
|
30 |
-
## Training and evaluation data
|
31 |
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
## Training procedure
|
35 |
|
36 |
### Training hyperparameters
|
37 |
|
@@ -46,8 +69,6 @@ The following hyperparameters were used during training:
|
|
46 |
- lr_scheduler_type: linear
|
47 |
- num_epochs: 1
|
48 |
|
49 |
-
### Training results
|
50 |
-
|
51 |
|
52 |
|
53 |
### Framework versions
|
|
|
9 |
language:
|
10 |
- en
|
11 |
library_name: transformers
|
12 |
+
pipeline_tag: text-generation
|
13 |
---
|
14 |
|
15 |
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
|
|
|
17 |
|
18 |
# git-base-on-diffuision-dataset2
|
19 |
|
20 |
+
This model is a fine-tuned version of [microsoft/git-base](https://huggingface.co/microsoft/git-base) on hieudinhpro/diffuision-dataset2 dataset.
|
21 |
|
22 |
## Model description
|
23 |
|
|
|
24 |
|
|
|
25 |
|
26 |
+
## How to use mdoel
|
27 |
|
|
|
28 |
|
29 |
+
```
|
30 |
+
# Load model directly
|
31 |
+
from transformers import AutoProcessor, AutoModelForCausalLM
|
32 |
+
|
33 |
+
processor = AutoProcessor.from_pretrained("microsoft/git-base")
|
34 |
+
model = AutoModelForCausalLM.from_pretrained("hieudinhpro/git-base-on-diffuision-dataset2")
|
35 |
+
|
36 |
+
```
|
37 |
+
|
38 |
+
```
|
39 |
+
# load image
|
40 |
+
from PIL import Image
|
41 |
+
|
42 |
+
image = Image.open('/content/image_3.jpg')
|
43 |
+
```
|
44 |
+
```
|
45 |
+
# pre image
|
46 |
+
inputs = processor(images=image, return_tensors="pt")
|
47 |
+
pixel_values = inputs.pixel_values
|
48 |
+
|
49 |
+
# predict
|
50 |
+
generated_ids = model.generate(pixel_values=pixel_values, max_length=50)
|
51 |
+
|
52 |
+
# decode to text
|
53 |
+
generated_caption = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
54 |
+
print(generated_caption)
|
55 |
+
```
|
56 |
+
|
57 |
|
|
|
58 |
|
59 |
### Training hyperparameters
|
60 |
|
|
|
69 |
- lr_scheduler_type: linear
|
70 |
- num_epochs: 1
|
71 |
|
|
|
|
|
72 |
|
73 |
|
74 |
### Framework versions
|