Adirazgold commited on
Commit
742b2b5
Β·
verified Β·
1 Parent(s): b27f64f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -6
README.md CHANGED
@@ -51,17 +51,17 @@ pip install transformers==4.50
51
  ```
52
  Then run the code:
53
  ```python
54
- from transformers import AutoProcessor, AutoModel
55
- from PIL import Image
56
  from io import BytesIO
 
57
  import requests
58
  import torch
 
 
59
 
60
  device = "cuda" if torch.cuda.is_available() else "cpu"
61
  model_name = "ibm-granite/granite-vision-embedding-3.3-2b"
62
- model = AutoModel.from_pretrained(model_name, trust_remote_code=True,torch_dtype=torch.float16).to(device).eval()
63
- processor = AutoProcessor.from_pretrained(model_name,trust_remote_code=True)
64
-
65
 
66
  # ─────────────────────────────────────────────
67
  # Inputs: Image + Text
@@ -101,7 +101,6 @@ similarity = processor.score(txt_emb, img_emb, batch_size=1, device=device)
101
  print("\n" + "=" * 50)
102
  print(f"πŸ“Š Similarity between image and text: {similarity.item():.4f}")
103
  print("=" * 50)
104
-
105
  ```
106
  ### Use granite-vision-embedding-3.3-2b for MM RAG
107
  For an example of MM-RAG using granite-vision-3.3-2b-embedding refer to [this notebook](......).
 
51
  ```
52
  Then run the code:
53
  ```python
 
 
54
  from io import BytesIO
55
+
56
  import requests
57
  import torch
58
+ from PIL import Image
59
+ from transformers import AutoProcessor, AutoModel
60
 
61
  device = "cuda" if torch.cuda.is_available() else "cpu"
62
  model_name = "ibm-granite/granite-vision-embedding-3.3-2b"
63
+ model = AutoModel.from_pretrained(model_name, trust_remote_code=True, torch_dtype=torch.float16).to(device).eval()
64
+ processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
 
65
 
66
  # ─────────────────────────────────────────────
67
  # Inputs: Image + Text
 
101
  print("\n" + "=" * 50)
102
  print(f"πŸ“Š Similarity between image and text: {similarity.item():.4f}")
103
  print("=" * 50)
 
104
  ```
105
  ### Use granite-vision-embedding-3.3-2b for MM RAG
106
  For an example of MM-RAG using granite-vision-3.3-2b-embedding refer to [this notebook](......).