123
Browse files
README.md
CHANGED
|
@@ -4,7 +4,7 @@ license: apache-2.0
|
|
| 4 |
# Diagram Formalizer
|
| 5 |
Model Structure:
|
| 6 |
|
| 7 |
-
<img src="sample/diagram_formalizer.png" alt="Alt text" width="
|
| 8 |
|
| 9 |
- **Diagram Encoder**: [siglip-so400m-patch14-384](https://huggingface.co/google/siglip-so400m-patch14-384)
|
| 10 |
|
|
@@ -47,7 +47,7 @@ tokenizer = AutoTokenizer.from_pretrained(
|
|
| 47 |
# text prompt
|
| 48 |
img_path = 'sample/4927.png'
|
| 49 |
prompt = 'Based on the image, first describe what you see in the figure, then predict the construction_cdl and image_cdl and calibrate it.'
|
| 50 |
-
text = f
|
| 51 |
|
| 52 |
def tokenizer_image_token(prompt, tokenizer, image_token_index, return_tensors=None):
|
| 53 |
prompt_chunks = [tokenizer(chunk).input_ids for chunk in prompt.split('<image>')]
|
|
|
|
| 4 |
# Diagram Formalizer
|
| 5 |
Model Structure:
|
| 6 |
|
| 7 |
+
<img src="sample/diagram_formalizer.png" alt="Alt text" width="50%" height="auto">
|
| 8 |
|
| 9 |
- **Diagram Encoder**: [siglip-so400m-patch14-384](https://huggingface.co/google/siglip-so400m-patch14-384)
|
| 10 |
|
|
|
|
| 47 |
# text prompt
|
| 48 |
img_path = 'sample/4927.png'
|
| 49 |
prompt = 'Based on the image, first describe what you see in the figure, then predict the construction_cdl and image_cdl and calibrate it.'
|
| 50 |
+
text = f'<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n<|im_start|>user\n<image>\n{prompt}<|im_end|>\n<|im_start|>assistant\n'
|
| 51 |
|
| 52 |
def tokenizer_image_token(prompt, tokenizer, image_token_index, return_tensors=None):
|
| 53 |
prompt_chunks = [tokenizer(chunk).input_ids for chunk in prompt.split('<image>')]
|