huseinzol05 commited on
Commit
9aaa4ba
1 Parent(s): a338232

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +11 -11
README.md CHANGED
@@ -15,6 +15,17 @@ from transformers import AutoTokenizer, AutoProcessor
15
  from PIL import Image
16
  import requests
17
 
 
 
 
 
 
 
 
 
 
 
 
18
  def prepare_dataset(messages, images: List[str] = None):
19
  if images is not None:
20
  images = [Image.open(f).convert('RGB') for f in images]
@@ -34,17 +45,6 @@ def prepare_dataset(messages, images: List[str] = None):
34
  outputs['image_starts'] = torch.tensor([tokenizer.convert_tokens_to_ids('<image>')] * len(outputs['images']))
35
  return outputs
36
 
37
- model = MM_LLMs.from_pretrained(
38
- 'mesolitica/malaysian-tinyllama-1.1b-siglip-base-384-vision',
39
- flash_attention = True,
40
- dtype = torch.bfloat16,
41
- torch_dtype = torch.bfloat16
42
- )
43
- _ = model.cuda()
44
-
45
- image_processor = AutoProcessor.from_pretrained('google/siglip-base-patch16-384')
46
- tokenizer = AutoTokenizer.from_pretrained('mesolitica/malaysian-tinyllama-1.1b-siglip-base-384-vision')
47
-
48
  with open('Persian-cat-breed.jpg', 'wb') as fopen:
49
  fopen.write(requests.get('https://cdn.beautifulnara.net/wp-content/uploads/2017/12/10201620/Persian-cat-breed.jpg').content)
50
 
 
15
  from PIL import Image
16
  import requests
17
 
18
+ model = MM_LLMs.from_pretrained(
19
+ 'mesolitica/malaysian-tinyllama-1.1b-siglip-base-384-vision',
20
+ flash_attention = True,
21
+ dtype = torch.bfloat16,
22
+ torch_dtype = torch.bfloat16
23
+ )
24
+ _ = model.cuda()
25
+
26
+ image_processor = AutoProcessor.from_pretrained('google/siglip-base-patch16-384')
27
+ tokenizer = AutoTokenizer.from_pretrained('mesolitica/malaysian-tinyllama-1.1b-siglip-base-384-vision')
28
+
29
  def prepare_dataset(messages, images: List[str] = None):
30
  if images is not None:
31
  images = [Image.open(f).convert('RGB') for f in images]
 
45
  outputs['image_starts'] = torch.tensor([tokenizer.convert_tokens_to_ids('<image>')] * len(outputs['images']))
46
  return outputs
47
 
 
 
 
 
 
 
 
 
 
 
 
48
  with open('Persian-cat-breed.jpg', 'wb') as fopen:
49
  fopen.write(requests.get('https://cdn.beautifulnara.net/wp-content/uploads/2017/12/10201620/Persian-cat-breed.jpg').content)
50