Commit
•
8965660
1
Parent(s):
3f4bd65
Update README.md (#1)
Browse files- Update README.md (1db2e3a5b427e553bab79f6707da43353aaa6f16)
Co-authored-by: HelpingAI <Abhaykoul@users.noreply.huggingface.co>
README.md
CHANGED
@@ -8,6 +8,7 @@ tags:
|
|
8 |
- llava
|
9 |
- phi
|
10 |
license: mit
|
|
|
11 |
---
|
12 |
|
13 |
# LLaVA-3b
|
@@ -40,13 +41,13 @@ You are Dolphin, a helpful AI assistant.<|im_end|>
|
|
40 |
|
41 |
**Install dependencies**
|
42 |
|
43 |
-
```
|
44 |
!pip install -q open_clip_torch timm einops
|
45 |
```
|
46 |
|
47 |
**Download modeling files**
|
48 |
|
49 |
-
```
|
50 |
from huggingface_hub import hf_hub_download
|
51 |
|
52 |
hf_hub_download(repo_id="visheratin/LLaVA-3b", filename="configuration_llava.py", local_dir="./", force_download=True)
|
@@ -58,7 +59,7 @@ hf_hub_download(repo_id="visheratin/LLaVA-3b", filename="processing_llava.py", l
|
|
58 |
|
59 |
**Create a model**
|
60 |
|
61 |
-
```
|
62 |
from modeling_llava import LlavaForConditionalGeneration
|
63 |
import torch
|
64 |
|
@@ -68,7 +69,7 @@ model = model.to("cuda")
|
|
68 |
|
69 |
**Create processors**
|
70 |
|
71 |
-
```
|
72 |
from transformers import AutoTokenizer
|
73 |
from processing_llava import LlavaProcessor, OpenCLIPImageProcessor
|
74 |
|
@@ -79,7 +80,7 @@ processor = LlavaProcessor(image_processor, tokenizer)
|
|
79 |
|
80 |
**Set image and text**
|
81 |
|
82 |
-
```
|
83 |
from PIL import Image
|
84 |
import requests
|
85 |
|
@@ -99,7 +100,7 @@ Describe the image.<|im_end|>
|
|
99 |
|
100 |
**Process inputs**
|
101 |
|
102 |
-
```
|
103 |
inputs = processor(prompt, raw_image, model, return_tensors='pt')
|
104 |
|
105 |
inputs['input_ids'] = inputs['input_ids'].to(model.device)
|
@@ -108,7 +109,7 @@ inputs['attention_mask'] = inputs['attention_mask'].to(model.device)
|
|
108 |
|
109 |
**Generate the data**
|
110 |
|
111 |
-
```
|
112 |
output = model.generate(**inputs, max_new_tokens=200, do_sample=True, top_p=0.5, temperature=1.2, eos_token_id=tokenizer.eos_token_id)
|
113 |
```
|
114 |
|
|
|
8 |
- llava
|
9 |
- phi
|
10 |
license: mit
|
11 |
+
library_name: transformers
|
12 |
---
|
13 |
|
14 |
# LLaVA-3b
|
|
|
41 |
|
42 |
**Install dependencies**
|
43 |
|
44 |
+
```bash
|
45 |
!pip install -q open_clip_torch timm einops
|
46 |
```
|
47 |
|
48 |
**Download modeling files**
|
49 |
|
50 |
+
```python
|
51 |
from huggingface_hub import hf_hub_download
|
52 |
|
53 |
hf_hub_download(repo_id="visheratin/LLaVA-3b", filename="configuration_llava.py", local_dir="./", force_download=True)
|
|
|
59 |
|
60 |
**Create a model**
|
61 |
|
62 |
+
```python
|
63 |
from modeling_llava import LlavaForConditionalGeneration
|
64 |
import torch
|
65 |
|
|
|
69 |
|
70 |
**Create processors**
|
71 |
|
72 |
+
```python
|
73 |
from transformers import AutoTokenizer
|
74 |
from processing_llava import LlavaProcessor, OpenCLIPImageProcessor
|
75 |
|
|
|
80 |
|
81 |
**Set image and text**
|
82 |
|
83 |
+
```python
|
84 |
from PIL import Image
|
85 |
import requests
|
86 |
|
|
|
100 |
|
101 |
**Process inputs**
|
102 |
|
103 |
+
```python
|
104 |
inputs = processor(prompt, raw_image, model, return_tensors='pt')
|
105 |
|
106 |
inputs['input_ids'] = inputs['input_ids'].to(model.device)
|
|
|
109 |
|
110 |
**Generate the data**
|
111 |
|
112 |
+
```python
|
113 |
output = model.generate(**inputs, max_new_tokens=200, do_sample=True, top_p=0.5, temperature=1.2, eos_token_id=tokenizer.eos_token_id)
|
114 |
```
|
115 |
|