Instructions to use damerajee/GPT-Vision with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use damerajee/GPT-Vision with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import GPTVision model = GPTVision.from_pretrained("damerajee/GPT-Vision", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update modeling_gpt2vision.py
Browse files- modeling_gpt2vision.py +1 -1
modeling_gpt2vision.py
CHANGED
|
@@ -100,7 +100,7 @@ class GPT2Vision(PreTrainedModel):
|
|
| 100 |
|
| 101 |
|
| 102 |
def generate(self, question, image, max_new_tokens=30, **kwargs):
|
| 103 |
-
prompt = f"
|
| 104 |
print(prompt)
|
| 105 |
batch = {"image": [image], "text": prompt}
|
| 106 |
encoded_batch = self.tokenize_encode(batch, self.device)
|
|
|
|
| 100 |
|
| 101 |
|
| 102 |
def generate(self, question, image, max_new_tokens=30, **kwargs):
|
| 103 |
+
prompt = f"Question: <image>{question} Answer:"
|
| 104 |
print(prompt)
|
| 105 |
batch = {"image": [image], "text": prompt}
|
| 106 |
encoded_batch = self.tokenize_encode(batch, self.device)
|