BAAI
/

BoyaWu10 commited on
Commit
74b1456
·
1 Parent(s): dd11e1c

Update readme

Browse files
Files changed (1) hide show
  1. README.md +4 -4
README.md CHANGED
@@ -41,12 +41,12 @@ torch.set_default_device('cpu') # or 'cuda'
41
 
42
  # create model
43
  model = AutoModelForCausalLM.from_pretrained(
44
- 'BAAI/bunny-phi-2-siglip',
45
  torch_dtype=torch.float16,
46
  device_map='auto',
47
  trust_remote_code=True)
48
  tokenizer = AutoTokenizer.from_pretrained(
49
- 'BAAI/bunny-phi-2-siglip',
50
  trust_remote_code=True)
51
 
52
  # text prompt
@@ -55,7 +55,7 @@ text = f"A chat between a curious user and an artificial intelligence assistant.
55
  text_chunks = [tokenizer(chunk).input_ids for chunk in text.split('<image>')]
56
  input_ids = torch.tensor(text_chunks[0] + [-200] + text_chunks[1], dtype=torch.long).unsqueeze(0)
57
 
58
- # image, sample images can be found in https://huggingface.co/BAAI/bunny-phi-2-siglip/tree/main/images
59
  image = Image.open('example_2.png')
60
  image_tensor = model.process_images([image], model.config).to(dtype=model.dtype)
61
 
@@ -72,7 +72,7 @@ print(tokenizer.decode(output_ids[input_ids.shape[1]:], skip_special_tokens=True
72
  Before running the snippet, you need to install the following dependencies:
73
 
74
  ```shell
75
- pip install torch transformers accelerate
76
  ```
77
 
78
  # License
 
41
 
42
  # create model
43
  model = AutoModelForCausalLM.from_pretrained(
44
+ 'BAAI/Bunny-v1_0-3B',
45
  torch_dtype=torch.float16,
46
  device_map='auto',
47
  trust_remote_code=True)
48
  tokenizer = AutoTokenizer.from_pretrained(
49
+ 'BAAI/Bunny-v1_0-3B',
50
  trust_remote_code=True)
51
 
52
  # text prompt
 
55
  text_chunks = [tokenizer(chunk).input_ids for chunk in text.split('<image>')]
56
  input_ids = torch.tensor(text_chunks[0] + [-200] + text_chunks[1], dtype=torch.long).unsqueeze(0)
57
 
58
+ # image, sample images can be found in images folder
59
  image = Image.open('example_2.png')
60
  image_tensor = model.process_images([image], model.config).to(dtype=model.dtype)
61
 
 
72
  Before running the snippet, you need to install the following dependencies:
73
 
74
  ```shell
75
+ pip install torch transformers accelerate pillow
76
  ```
77
 
78
  # License