Inoichan commited on
Commit
e7f4f52
1 Parent(s): 1e75e6f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +107 -0
README.md CHANGED
@@ -1,3 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
 
1
+
2
+ # Heron GIT Japanese StableLM Base 7B
3
+
4
+ ![heron](./heron.png)
5
+
6
+ ## Model Details
7
+ Heron GIT Japanese StableLM Base 7B is a vision-language model that can converse about input images.<br>
8
+ This model was trained using [the heron library](https://github.com/turingmotors/heron). Please refer to the code for details.
9
+
10
+
11
+ ## Usage
12
+
13
+ Follow [the installation guide](https://github.com/turingmotors/heron/tree/dev-0.0.1#1-clone-this-repository).
14
+
15
+ ```python
16
+ import requests
17
+ from PIL import Image
18
+
19
+ import torch
20
+ from transformers import AutoProcessor
21
+ from heron.models.git_llm.git_llama import GitLlamaForCausalLM
22
+
23
+ device_id = 0
24
+
25
+ # prepare a pretrained model
26
+ model = GitLlamaForCausalLM.from_pretrained('turing-motors/heron-chat-git-ja-stablelm-base-7b-v0')
27
+ model.eval()
28
+ model.to(f"cuda:{device_id}")
29
+
30
+ # prepare a processor
31
+ processor = AutoProcessor.from_pretrained('turing-motors/heron-chat-git-ja-stablelm-base-7b-v0', additional_special_tokens=["▁▁"])
32
+
33
+ # prepare inputs
34
+ url = "https://www.barnorama.com/wp-content/uploads/2016/12/03-Confusing-Pictures.jpg"
35
+ image = Image.open(requests.get(url, stream=True).raw)
36
+
37
+ text = f"##Instruction: Please answer the following question concletely. ##Question: What is unusual about this image? Explain precisely and concletely what he is doing? ##Answer: "
38
+
39
+ # do preprocessing
40
+ inputs = processor(
41
+ text,
42
+ image,
43
+ return_tensors="pt",
44
+ truncation=True,
45
+ )
46
+ inputs = {k: v.to(f"cuda:{device_id}") for k, v in inputs.items()}
47
+
48
+ # set eos token
49
+ eos_token_id_list = [
50
+ processor.tokenizer.pad_token_id,
51
+ processor.tokenizer.eos_token_id,
52
+ ]
53
+
54
+ # do inference
55
+ with torch.no_grad():
56
+ out = model.generate(**inputs, max_length=256, do_sample=False, temperature=0., eos_token_id=eos_token_id_list)
57
+
58
+ # print result
59
+ print(processor.tokenizer.batch_decode(out))
60
+ ```
61
+
62
+
63
+ ## Model Details
64
+ * **Developed by**: [Turing Inc.](https://www.turing-motors.com/)
65
+ * **Adaptor type**: [GIT](https://arxiv.org/abs/2205.14100)
66
+ * **Lamguage Model**: [Japanese StableLM Base Alpha](https://huggingface.co/stabilityai/japanese-stablelm-base-alpha-7b)
67
+ * **Language(s)**: Japanese
68
+ * **License**: This model is licensed under [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).
69
+
70
+ ### Training
71
+ This model was initially trained with the Adaptor using STAIR Captions. In the second phase, it was fine-tuned with LLaVA-Instruct-150K-JA and Japanese Visual Genome using LoRA.
72
+
73
+ ### Training Dataset
74
+
75
+ - [LLaVA-Instruct-150K-JA](https://huggingface.co/datasets/turing-motors/LLaVA-Instruct-150K-JA)
76
+ - [Japanese STAIR Captions](http://captions.stair.center/)
77
+ - [Japanese Visual Genome VQA dataset](https://github.com/yahoojapan/ja-vg-vqa)
78
+
79
+ ## Use and Limitations
80
+
81
+ ### Intended Use
82
+
83
+ This model is intended for use in chat-like applications and for research purposes.
84
+
85
+ ### Limitations
86
+
87
+ The model may produce inaccurate or false information, and its accuracy is not guaranteed. It is still in the research and development stage.
88
+
89
+ ## How to cite
90
+ ```bibtex
91
+ @misc{GitJapaneseStableLM,
92
+ url = {[https://huggingface.co/turing-motors/heron-chat-git-ja-stablelm-base-7b-v0](https://huggingface.co/turing-motors/heron-chat-git-ja-stablelm-base-7b-v0)},
93
+ title = {Heron GIT Japanese StableLM Base 7B},
94
+ author = {Yuichi Inoue, Kotaro Tanahashi, and Yu Yamaguchi}
95
+ }
96
+ ```
97
+
98
+ ## Citations
99
+
100
+ ```bibtex
101
+ @misc{JapaneseInstructBLIPAlpha,
102
+ url = {[https://huggingface.co/stabilityai/japanese-instructblip-alpha](https://huggingface.co/stabilityai/japanese-instructblip-alpha)},
103
+ title = {Japanese InstructBLIP Alpha},
104
+ author = {Shing, Makoto and Akiba, Takuya}
105
+ }
106
+ ```
107
+
108
  ---
109
  license: apache-2.0
110
  ---