Update README.md
Browse files
README.md
CHANGED
|
@@ -18,23 +18,34 @@ With MiniCPM-Visual-Embedding, it is possible to directly build knowledge base w
|
|
| 18 |
|
| 19 |
# News
|
| 20 |
|
| 21 |
-
- 2024-06-27: We released our first visual embedding model minicpm-visual-embedding-v0.1 on [huggingface](https://huggingface.co/RhapsodyAI/minicpm-visual-embedding-v0
|
| 22 |
|
| 23 |
- 2024-05-08: We [committed](https://github.com/bokesyo/minicpm-visual-embedding) our training code (full-parameter tuning with GradCache and DeepSpeed, supports large batch size across multiple GPUs with zero-stage1) and eval code.
|
| 24 |
|
| 25 |
# Get started
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
First you are suggested to git clone this huggingface repo or download repo with `huggingface_cli`.
|
| 28 |
|
| 29 |
```bash
|
| 30 |
git lfs install
|
| 31 |
-
git clone https://huggingface.co/RhapsodyAI/minicpm-visual-embedding-v0
|
| 32 |
```
|
| 33 |
|
| 34 |
or
|
| 35 |
|
| 36 |
```bash
|
| 37 |
-
huggingface-cli download RhapsodyAI/minicpm-visual-embedding-v0
|
| 38 |
```
|
| 39 |
|
| 40 |
```python
|
|
@@ -56,8 +67,8 @@ def last_token_pool(last_hidden_states: Tensor,
|
|
| 56 |
return last_hidden_states[torch.arange(batch_size, device=last_hidden_states.device), sequence_lengths]
|
| 57 |
|
| 58 |
|
| 59 |
-
tokenizer = AutoTokenizer.from_pretrained('/local/path/to/minicpm-visual-embedding-v0
|
| 60 |
-
model = AutoModel.from_pretrained('/local/path/to/minicpm-visual-embedding-v0
|
| 61 |
|
| 62 |
image_1 = Image.open('/local/path/to/document1.png').convert('RGB')
|
| 63 |
image_2 = Image.open('/local/path/to/document2.png').convert('RGB')
|
|
|
|
| 18 |
|
| 19 |
# News
|
| 20 |
|
| 21 |
+
- 2024-06-27: We released our first visual embedding model minicpm-visual-embedding-v0.1 on [huggingface](https://huggingface.co/RhapsodyAI/minicpm-visual-embedding-v0).
|
| 22 |
|
| 23 |
- 2024-05-08: We [committed](https://github.com/bokesyo/minicpm-visual-embedding) our training code (full-parameter tuning with GradCache and DeepSpeed, supports large batch size across multiple GPUs with zero-stage1) and eval code.
|
| 24 |
|
| 25 |
# Get started
|
| 26 |
|
| 27 |
+
Pip install all dependencies:
|
| 28 |
+
|
| 29 |
+
```
|
| 30 |
+
Pillow==10.1.0
|
| 31 |
+
timm==0.9.10
|
| 32 |
+
torch==2.1.2
|
| 33 |
+
torchvision==0.16.2
|
| 34 |
+
transformers==4.36.0
|
| 35 |
+
sentencepiece==0.1.99
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
First you are suggested to git clone this huggingface repo or download repo with `huggingface_cli`.
|
| 39 |
|
| 40 |
```bash
|
| 41 |
git lfs install
|
| 42 |
+
git clone https://huggingface.co/RhapsodyAI/minicpm-visual-embedding-v0
|
| 43 |
```
|
| 44 |
|
| 45 |
or
|
| 46 |
|
| 47 |
```bash
|
| 48 |
+
huggingface-cli download RhapsodyAI/minicpm-visual-embedding-v0
|
| 49 |
```
|
| 50 |
|
| 51 |
```python
|
|
|
|
| 67 |
return last_hidden_states[torch.arange(batch_size, device=last_hidden_states.device), sequence_lengths]
|
| 68 |
|
| 69 |
|
| 70 |
+
tokenizer = AutoTokenizer.from_pretrained('/local/path/to/minicpm-visual-embedding-v0', trust_remote_code=True)
|
| 71 |
+
model = AutoModel.from_pretrained('/local/path/to/minicpm-visual-embedding-v0', trust_remote_code=True)
|
| 72 |
|
| 73 |
image_1 = Image.open('/local/path/to/document1.png').convert('RGB')
|
| 74 |
image_2 = Image.open('/local/path/to/document2.png').convert('RGB')
|