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
|
@@ -108,7 +108,7 @@ class GPT2Vision(PreTrainedModel):
|
|
| 108 |
return outputs
|
| 109 |
|
| 110 |
def generate(self, question, image, max_new_tokens=30, **kwargs):
|
| 111 |
-
prompt = f"
|
| 112 |
batch = {"image": [image], "text": prompt}
|
| 113 |
encoded_batch = self.tokenize_encode(batch, self.device)
|
| 114 |
inputs_embeds, attention_mask = self.preprocess_inputs(encoded_batch)
|
|
|
|
| 108 |
return outputs
|
| 109 |
|
| 110 |
def generate(self, question, image, max_new_tokens=30, **kwargs):
|
| 111 |
+
prompt = f"\n\nQuestion: {question}\n\nAnswer:"
|
| 112 |
batch = {"image": [image], "text": prompt}
|
| 113 |
encoded_batch = self.tokenize_encode(batch, self.device)
|
| 114 |
inputs_embeds, attention_mask = self.preprocess_inputs(encoded_batch)
|