huseinzol05 commited on
Commit
2330f89
1 Parent(s): a141052

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -12
README.md CHANGED
@@ -15,6 +15,18 @@ 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,18 +46,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-Qwen1.5-0.5B-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-Qwen1.5-0.5B-siglip-base-384-vision')
47
- model.llm.generation_config.eos_token_id = tokenizer.eos_token_id
48
-
49
  with open('Persian-cat-breed.jpg', 'wb') as fopen:
50
  fopen.write(requests.get('https://cdn.beautifulnara.net/wp-content/uploads/2017/12/10201620/Persian-cat-breed.jpg').content)
51
 
 
15
  from PIL import Image
16
  import requests
17
 
18
+ model = MM_LLMs.from_pretrained(
19
+ 'mesolitica/malaysian-Qwen1.5-0.5B-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-Qwen1.5-0.5B-siglip-base-384-vision')
28
+ model.llm.generation_config.eos_token_id = tokenizer.eos_token_id
29
+
30
  def prepare_dataset(messages, images: List[str] = None):
31
  if images is not None:
32
  images = [Image.open(f).convert('RGB') for f in images]
 
46
  outputs['image_starts'] = torch.tensor([tokenizer.convert_tokens_to_ids('<image>')] * len(outputs['images']))
47
  return outputs
48
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  with open('Persian-cat-breed.jpg', 'wb') as fopen:
50
  fopen.write(requests.get('https://cdn.beautifulnara.net/wp-content/uploads/2017/12/10201620/Persian-cat-breed.jpg').content)
51