Image-Text-to-Text
PEFT
Safetensors
English
æLtorio commited on
Commit
5231487
1 Parent(s): 0bd0594

update sample

Browse files
Files changed (1) hide show
  1. ROCO-idefics3-test.ipynb +20 -4
ROCO-idefics3-test.ipynb CHANGED
@@ -2,7 +2,7 @@
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
- "execution_count": 1,
6
  "metadata": {},
7
  "outputs": [
8
  {
@@ -36,6 +36,7 @@
36
  }
37
  ],
38
  "source": [
 
39
  "from transformers import AutoProcessor, Idefics3ForConditionalGeneration, image_utils\n",
40
  "import torch\n",
41
  "device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')\n",
@@ -47,7 +48,7 @@
47
  " base_model_path, torch_dtype=torch.bfloat16\n",
48
  " ).to(device)\n",
49
  "\n",
50
- "model.load_adapter(model_id)\n"
51
  ]
52
  },
53
  {
@@ -82,9 +83,17 @@
82
  },
83
  {
84
  "cell_type": "code",
85
- "execution_count": null,
86
  "metadata": {},
87
- "outputs": [],
 
 
 
 
 
 
 
 
88
  "source": [
89
  "# Generate\n",
90
  "generated_ids = model.generate(**inputs, max_new_tokens=500)\n",
@@ -92,6 +101,13 @@
92
  "\n",
93
  "print(generated_texts)"
94
  ]
 
 
 
 
 
 
 
95
  }
96
  ],
97
  "metadata": {
 
2
  "cells": [
3
  {
4
  "cell_type": "code",
5
+ "execution_count": null,
6
  "metadata": {},
7
  "outputs": [
8
  {
 
36
  }
37
  ],
38
  "source": [
39
+ "\n",
40
  "from transformers import AutoProcessor, Idefics3ForConditionalGeneration, image_utils\n",
41
  "import torch\n",
42
  "device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')\n",
 
48
  " base_model_path, torch_dtype=torch.bfloat16\n",
49
  " ).to(device)\n",
50
  "\n",
51
+ "model.load_adapter(model_id)"
52
  ]
53
  },
54
  {
 
83
  },
84
  {
85
  "cell_type": "code",
86
+ "execution_count": 4,
87
  "metadata": {},
88
+ "outputs": [
89
+ {
90
+ "name": "stdout",
91
+ "output_type": "stream",
92
+ "text": [
93
+ "['User:<image>What do we see in this image?\\nAssistant: Buccal and palatal cortical bone thickness measurements.\\n']\n"
94
+ ]
95
+ }
96
+ ],
97
  "source": [
98
  "# Generate\n",
99
  "generated_ids = model.generate(**inputs, max_new_tokens=500)\n",
 
101
  "\n",
102
  "print(generated_texts)"
103
  ]
104
+ },
105
+ {
106
+ "cell_type": "code",
107
+ "execution_count": null,
108
+ "metadata": {},
109
+ "outputs": [],
110
+ "source": []
111
  }
112
  ],
113
  "metadata": {