Add files using upload-large-folder tool
Browse files- r1-a/response_generation/minicpm/MiniCPM-o/.github/ISSUE_TEMPLATE/bug_report.yaml +89 -0
- r1-a/response_generation/minicpm/MiniCPM-o/.github/ISSUE_TEMPLATE/config.yaml +1 -0
- r1-a/response_generation/minicpm/MiniCPM-o/.github/ISSUE_TEMPLATE/feature_request.yaml +78 -0
- r1-a/response_generation/minicpm/MiniCPM-o/.github/ISSUE_TEMPLATE/llamacpp.yaml +78 -0
- r1-a/response_generation/minicpm/MiniCPM-o/.github/ISSUE_TEMPLATE/ollama.yaml +78 -0
- r1-a/response_generation/minicpm/MiniCPM-o/.github/ISSUE_TEMPLATE/vllm.yaml +78 -0
- r1-a/response_generation/minicpm/MiniCPM-o/.vscode/settings.json +5 -0
- r1-a/response_generation/minicpm/MiniCPM-o/assets/discord.png +0 -0
- r1-a/response_generation/minicpm/MiniCPM-o/assets/logo.html +3 -0
- r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpm-llama-v-2-5_languages.md +176 -0
- r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpm-o-group.jpeg +0 -0
- r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpm-v24.png +0 -0
- r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpm-v25.png +0 -0
- r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpm-v26.png +0 -0
- r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpmv-omnilmm.png +0 -0
- r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpmv.png +0 -0
- r1-a/response_generation/minicpm/MiniCPM-o/assets/modelbest.png +0 -0
- r1-a/response_generation/minicpm/MiniCPM-o/chat.py +293 -0
- r1-a/response_generation/minicpm/MiniCPM-o/requirements.txt +35 -0
- r1-a/response_generation/minicpm/MiniCPM-o/requirements_o2.6.txt +22 -0
r1-a/response_generation/minicpm/MiniCPM-o/.github/ISSUE_TEMPLATE/bug_report.yaml
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: 🐞 Bug
|
| 2 |
+
description: 提交错误报告 | File a bug/issue
|
| 3 |
+
title: "[BUG] <title>"
|
| 4 |
+
labels: []
|
| 5 |
+
|
| 6 |
+
body:
|
| 7 |
+
- type: checkboxes
|
| 8 |
+
attributes:
|
| 9 |
+
label: 是否已有关于该错误的issue或讨论? | Is there an existing issue / discussion for this?
|
| 10 |
+
description: |
|
| 11 |
+
请先搜索您遇到的错误是否在已有的issues或讨论中提到过。
|
| 12 |
+
Please search to see if an issue / discussion already exists for the bug you encountered.
|
| 13 |
+
[Issues](https://github.com/OpenBMB/MiniCPM-V/issues)
|
| 14 |
+
[Discussions](https://github.com/OpenBMB/MiniCPM-V/discussions)
|
| 15 |
+
options:
|
| 16 |
+
- label: 我已经搜索过已有的issues和讨论 | I have searched the existing issues / discussions
|
| 17 |
+
required: true
|
| 18 |
+
- type: checkboxes
|
| 19 |
+
attributes:
|
| 20 |
+
label: 该问题是否在FAQ中有解答? | Is there an existing answer for this in FAQ?
|
| 21 |
+
description: |
|
| 22 |
+
请先搜索您遇到的错误是否已在FAQ中有相关解答。
|
| 23 |
+
Please search to see if an answer already exists in FAQ for the bug you encountered.
|
| 24 |
+
[FAQ-en](https://github.com/OpenBMB/MiniCPM-V/blob/main/FAQ.md)
|
| 25 |
+
[FAQ-zh](https://github.com/OpenBMB/MiniCPM-V/blob/main/FAQ_zh.md)
|
| 26 |
+
options:
|
| 27 |
+
- label: 我已经搜索过FAQ | I have searched FAQ
|
| 28 |
+
required: true
|
| 29 |
+
- type: textarea
|
| 30 |
+
attributes:
|
| 31 |
+
label: 当前行为 | Current Behavior
|
| 32 |
+
description: |
|
| 33 |
+
准确描述遇到的行为。
|
| 34 |
+
A concise description of what you're experiencing.
|
| 35 |
+
validations:
|
| 36 |
+
required: false
|
| 37 |
+
- type: textarea
|
| 38 |
+
attributes:
|
| 39 |
+
label: 期望行为 | Expected Behavior
|
| 40 |
+
description: |
|
| 41 |
+
准确描述预期的行为。
|
| 42 |
+
A concise description of what you expected to happen.
|
| 43 |
+
validations:
|
| 44 |
+
required: false
|
| 45 |
+
- type: textarea
|
| 46 |
+
attributes:
|
| 47 |
+
label: 复现方法 | Steps To Reproduce
|
| 48 |
+
description: |
|
| 49 |
+
复现当前行为的详细步骤。
|
| 50 |
+
Steps to reproduce the behavior.
|
| 51 |
+
placeholder: |
|
| 52 |
+
1. In this environment...
|
| 53 |
+
2. With this config...
|
| 54 |
+
3. Run '...'
|
| 55 |
+
4. See error...
|
| 56 |
+
validations:
|
| 57 |
+
required: false
|
| 58 |
+
- type: textarea
|
| 59 |
+
attributes:
|
| 60 |
+
label: 运行环境 | Environment
|
| 61 |
+
description: |
|
| 62 |
+
examples:
|
| 63 |
+
- **OS**: Ubuntu 20.04
|
| 64 |
+
- **Python**: 3.8
|
| 65 |
+
- **Transformers**: 4.31.0
|
| 66 |
+
- **PyTorch**: 2.0.1
|
| 67 |
+
- **CUDA**: 11.4
|
| 68 |
+
value: |
|
| 69 |
+
- OS:
|
| 70 |
+
- Python:
|
| 71 |
+
- Transformers:
|
| 72 |
+
- PyTorch:
|
| 73 |
+
- CUDA (`python -c 'import torch; print(torch.version.cuda)'`):
|
| 74 |
+
render: Markdown
|
| 75 |
+
validations:
|
| 76 |
+
required: false
|
| 77 |
+
- type: textarea
|
| 78 |
+
attributes:
|
| 79 |
+
label: 备注 | Anything else?
|
| 80 |
+
description: |
|
| 81 |
+
您可以在这里补充其他关于该问题背景信息的描述、链接或引用等。
|
| 82 |
+
|
| 83 |
+
您可以通过点击高亮此区域然后拖动文件的方式上传图片或日志文件。
|
| 84 |
+
|
| 85 |
+
Links? References? Anything that will give us more context about the issue you are encountering!
|
| 86 |
+
|
| 87 |
+
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
|
| 88 |
+
validations:
|
| 89 |
+
required: false
|
r1-a/response_generation/minicpm/MiniCPM-o/.github/ISSUE_TEMPLATE/config.yaml
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
blank_issues_enabled: true
|
r1-a/response_generation/minicpm/MiniCPM-o/.github/ISSUE_TEMPLATE/feature_request.yaml
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: "💡 Feature Request"
|
| 2 |
+
description: 创建新功能请求 | Create a new ticket for a new feature request
|
| 3 |
+
title: "💡 [REQUEST] - <title>"
|
| 4 |
+
labels: [
|
| 5 |
+
"question"
|
| 6 |
+
]
|
| 7 |
+
body:
|
| 8 |
+
- type: input
|
| 9 |
+
id: start_date
|
| 10 |
+
attributes:
|
| 11 |
+
label: "起始日期 | Start Date"
|
| 12 |
+
description: |
|
| 13 |
+
起始开发日期
|
| 14 |
+
Start of development
|
| 15 |
+
placeholder: "month/day/year"
|
| 16 |
+
validations:
|
| 17 |
+
required: false
|
| 18 |
+
- type: textarea
|
| 19 |
+
id: implementation_pr
|
| 20 |
+
attributes:
|
| 21 |
+
label: "实现PR | Implementation PR"
|
| 22 |
+
description: |
|
| 23 |
+
实现该功能的Pull request
|
| 24 |
+
Pull request used
|
| 25 |
+
placeholder: "#Pull Request ID"
|
| 26 |
+
validations:
|
| 27 |
+
required: false
|
| 28 |
+
- type: textarea
|
| 29 |
+
id: reference_issues
|
| 30 |
+
attributes:
|
| 31 |
+
label: "相关Issues | Reference Issues"
|
| 32 |
+
description: |
|
| 33 |
+
与该功能相关的issues
|
| 34 |
+
Common issues
|
| 35 |
+
placeholder: "#Issues IDs"
|
| 36 |
+
validations:
|
| 37 |
+
required: false
|
| 38 |
+
- type: textarea
|
| 39 |
+
id: summary
|
| 40 |
+
attributes:
|
| 41 |
+
label: "摘要 | Summary"
|
| 42 |
+
description: |
|
| 43 |
+
简要描述新功能的特点
|
| 44 |
+
Provide a brief explanation of the feature
|
| 45 |
+
placeholder: |
|
| 46 |
+
Describe in a few lines your feature request
|
| 47 |
+
validations:
|
| 48 |
+
required: true
|
| 49 |
+
- type: textarea
|
| 50 |
+
id: basic_example
|
| 51 |
+
attributes:
|
| 52 |
+
label: "基本示例 | Basic Example"
|
| 53 |
+
description: Indicate here some basic examples of your feature.
|
| 54 |
+
placeholder: A few specific words about your feature request.
|
| 55 |
+
validations:
|
| 56 |
+
required: true
|
| 57 |
+
- type: textarea
|
| 58 |
+
id: drawbacks
|
| 59 |
+
attributes:
|
| 60 |
+
label: "缺陷 | Drawbacks"
|
| 61 |
+
description: |
|
| 62 |
+
该新功能有哪些缺陷/可能造成哪些影响?
|
| 63 |
+
What are the drawbacks/impacts of your feature request ?
|
| 64 |
+
placeholder: |
|
| 65 |
+
Identify the drawbacks and impacts while being neutral on your feature request
|
| 66 |
+
validations:
|
| 67 |
+
required: true
|
| 68 |
+
- type: textarea
|
| 69 |
+
id: unresolved_question
|
| 70 |
+
attributes:
|
| 71 |
+
label: "未解决问题 | Unresolved questions"
|
| 72 |
+
description: |
|
| 73 |
+
有哪些尚未解决的问题?
|
| 74 |
+
What questions still remain unresolved ?
|
| 75 |
+
placeholder: |
|
| 76 |
+
Identify any unresolved issues.
|
| 77 |
+
validations:
|
| 78 |
+
required: false
|
r1-a/response_generation/minicpm/MiniCPM-o/.github/ISSUE_TEMPLATE/llamacpp.yaml
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: "llamacpp issue"
|
| 2 |
+
description: 创建新功能请求 | Create a new ticket for a new feature request
|
| 3 |
+
title: "[llamacpp] - <title>"
|
| 4 |
+
labels: [
|
| 5 |
+
"question"
|
| 6 |
+
]
|
| 7 |
+
body:
|
| 8 |
+
- type: input
|
| 9 |
+
id: start_date
|
| 10 |
+
attributes:
|
| 11 |
+
label: "起始日期 | Start Date"
|
| 12 |
+
description: |
|
| 13 |
+
起始开发日期
|
| 14 |
+
Start of development
|
| 15 |
+
placeholder: "month/day/year"
|
| 16 |
+
validations:
|
| 17 |
+
required: false
|
| 18 |
+
- type: textarea
|
| 19 |
+
id: implementation_pr
|
| 20 |
+
attributes:
|
| 21 |
+
label: "实现PR | Implementation PR"
|
| 22 |
+
description: |
|
| 23 |
+
实现该功能的Pull request
|
| 24 |
+
Pull request used
|
| 25 |
+
placeholder: "#Pull Request ID"
|
| 26 |
+
validations:
|
| 27 |
+
required: false
|
| 28 |
+
- type: textarea
|
| 29 |
+
id: reference_issues
|
| 30 |
+
attributes:
|
| 31 |
+
label: "相关Issues | Reference Issues"
|
| 32 |
+
description: |
|
| 33 |
+
与该功能相关的issues
|
| 34 |
+
Common issues
|
| 35 |
+
placeholder: "#Issues IDs"
|
| 36 |
+
validations:
|
| 37 |
+
required: false
|
| 38 |
+
- type: textarea
|
| 39 |
+
id: summary
|
| 40 |
+
attributes:
|
| 41 |
+
label: "摘要 | Summary"
|
| 42 |
+
description: |
|
| 43 |
+
简要描述新功能的特点
|
| 44 |
+
Provide a brief explanation of the feature
|
| 45 |
+
placeholder: |
|
| 46 |
+
Describe in a few lines your feature request
|
| 47 |
+
validations:
|
| 48 |
+
required: true
|
| 49 |
+
- type: textarea
|
| 50 |
+
id: basic_example
|
| 51 |
+
attributes:
|
| 52 |
+
label: "基本示例 | Basic Example"
|
| 53 |
+
description: Indicate here some basic examples of your feature.
|
| 54 |
+
placeholder: A few specific words about your feature request.
|
| 55 |
+
validations:
|
| 56 |
+
required: true
|
| 57 |
+
- type: textarea
|
| 58 |
+
id: drawbacks
|
| 59 |
+
attributes:
|
| 60 |
+
label: "缺陷 | Drawbacks"
|
| 61 |
+
description: |
|
| 62 |
+
该新功能有哪些缺陷/可能造成哪些影响?
|
| 63 |
+
What are the drawbacks/impacts of your feature request ?
|
| 64 |
+
placeholder: |
|
| 65 |
+
Identify the drawbacks and impacts while being neutral on your feature request
|
| 66 |
+
validations:
|
| 67 |
+
required: true
|
| 68 |
+
- type: textarea
|
| 69 |
+
id: unresolved_question
|
| 70 |
+
attributes:
|
| 71 |
+
label: "未解决问题 | Unresolved questions"
|
| 72 |
+
description: |
|
| 73 |
+
有哪些尚未解决的问题?
|
| 74 |
+
What questions still remain unresolved ?
|
| 75 |
+
placeholder: |
|
| 76 |
+
Identify any unresolved issues.
|
| 77 |
+
validations:
|
| 78 |
+
required: false
|
r1-a/response_generation/minicpm/MiniCPM-o/.github/ISSUE_TEMPLATE/ollama.yaml
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: "ollama issue"
|
| 2 |
+
description: 创建新功能请求 | Create a new ticket for a new feature request
|
| 3 |
+
title: "[ollama] - <title>"
|
| 4 |
+
labels: [
|
| 5 |
+
"question"
|
| 6 |
+
]
|
| 7 |
+
body:
|
| 8 |
+
- type: input
|
| 9 |
+
id: start_date
|
| 10 |
+
attributes:
|
| 11 |
+
label: "起始日期 | Start Date"
|
| 12 |
+
description: |
|
| 13 |
+
起始开发日期
|
| 14 |
+
Start of development
|
| 15 |
+
placeholder: "month/day/year"
|
| 16 |
+
validations:
|
| 17 |
+
required: false
|
| 18 |
+
- type: textarea
|
| 19 |
+
id: implementation_pr
|
| 20 |
+
attributes:
|
| 21 |
+
label: "实现PR | Implementation PR"
|
| 22 |
+
description: |
|
| 23 |
+
实现该功能的Pull request
|
| 24 |
+
Pull request used
|
| 25 |
+
placeholder: "#Pull Request ID"
|
| 26 |
+
validations:
|
| 27 |
+
required: false
|
| 28 |
+
- type: textarea
|
| 29 |
+
id: reference_issues
|
| 30 |
+
attributes:
|
| 31 |
+
label: "相关Issues | Reference Issues"
|
| 32 |
+
description: |
|
| 33 |
+
与该功能相关的issues
|
| 34 |
+
Common issues
|
| 35 |
+
placeholder: "#Issues IDs"
|
| 36 |
+
validations:
|
| 37 |
+
required: false
|
| 38 |
+
- type: textarea
|
| 39 |
+
id: summary
|
| 40 |
+
attributes:
|
| 41 |
+
label: "摘要 | Summary"
|
| 42 |
+
description: |
|
| 43 |
+
简要描述新功能的特点
|
| 44 |
+
Provide a brief explanation of the feature
|
| 45 |
+
placeholder: |
|
| 46 |
+
Describe in a few lines your feature request
|
| 47 |
+
validations:
|
| 48 |
+
required: true
|
| 49 |
+
- type: textarea
|
| 50 |
+
id: basic_example
|
| 51 |
+
attributes:
|
| 52 |
+
label: "基本示例 | Basic Example"
|
| 53 |
+
description: Indicate here some basic examples of your feature.
|
| 54 |
+
placeholder: A few specific words about your feature request.
|
| 55 |
+
validations:
|
| 56 |
+
required: true
|
| 57 |
+
- type: textarea
|
| 58 |
+
id: drawbacks
|
| 59 |
+
attributes:
|
| 60 |
+
label: "缺陷 | Drawbacks"
|
| 61 |
+
description: |
|
| 62 |
+
该新功能有哪些缺陷/可能造成哪些影响?
|
| 63 |
+
What are the drawbacks/impacts of your feature request ?
|
| 64 |
+
placeholder: |
|
| 65 |
+
Identify the drawbacks and impacts while being neutral on your feature request
|
| 66 |
+
validations:
|
| 67 |
+
required: true
|
| 68 |
+
- type: textarea
|
| 69 |
+
id: unresolved_question
|
| 70 |
+
attributes:
|
| 71 |
+
label: "未解决问题 | Unresolved questions"
|
| 72 |
+
description: |
|
| 73 |
+
有哪些尚未解决的问题?
|
| 74 |
+
What questions still remain unresolved ?
|
| 75 |
+
placeholder: |
|
| 76 |
+
Identify any unresolved issues.
|
| 77 |
+
validations:
|
| 78 |
+
required: false
|
r1-a/response_generation/minicpm/MiniCPM-o/.github/ISSUE_TEMPLATE/vllm.yaml
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: "vllm issue"
|
| 2 |
+
description: 创建新功能请求 | Create a new ticket for a new feature request
|
| 3 |
+
title: "[vllm] - <title>"
|
| 4 |
+
labels: [
|
| 5 |
+
"question"
|
| 6 |
+
]
|
| 7 |
+
body:
|
| 8 |
+
- type: input
|
| 9 |
+
id: start_date
|
| 10 |
+
attributes:
|
| 11 |
+
label: "起始日期 | Start Date"
|
| 12 |
+
description: |
|
| 13 |
+
起始开发日期
|
| 14 |
+
Start of development
|
| 15 |
+
placeholder: "month/day/year"
|
| 16 |
+
validations:
|
| 17 |
+
required: false
|
| 18 |
+
- type: textarea
|
| 19 |
+
id: implementation_pr
|
| 20 |
+
attributes:
|
| 21 |
+
label: "实现PR | Implementation PR"
|
| 22 |
+
description: |
|
| 23 |
+
实现该功能的Pull request
|
| 24 |
+
Pull request used
|
| 25 |
+
placeholder: "#Pull Request ID"
|
| 26 |
+
validations:
|
| 27 |
+
required: false
|
| 28 |
+
- type: textarea
|
| 29 |
+
id: reference_issues
|
| 30 |
+
attributes:
|
| 31 |
+
label: "相关Issues | Reference Issues"
|
| 32 |
+
description: |
|
| 33 |
+
与该功能相关的issues
|
| 34 |
+
Common issues
|
| 35 |
+
placeholder: "#Issues IDs"
|
| 36 |
+
validations:
|
| 37 |
+
required: false
|
| 38 |
+
- type: textarea
|
| 39 |
+
id: summary
|
| 40 |
+
attributes:
|
| 41 |
+
label: "摘要 | Summary"
|
| 42 |
+
description: |
|
| 43 |
+
简要描述新功能的特点
|
| 44 |
+
Provide a brief explanation of the feature
|
| 45 |
+
placeholder: |
|
| 46 |
+
Describe in a few lines your feature request
|
| 47 |
+
validations:
|
| 48 |
+
required: true
|
| 49 |
+
- type: textarea
|
| 50 |
+
id: basic_example
|
| 51 |
+
attributes:
|
| 52 |
+
label: "基本示例 | Basic Example"
|
| 53 |
+
description: Indicate here some basic examples of your feature.
|
| 54 |
+
placeholder: A few specific words about your feature request.
|
| 55 |
+
validations:
|
| 56 |
+
required: true
|
| 57 |
+
- type: textarea
|
| 58 |
+
id: drawbacks
|
| 59 |
+
attributes:
|
| 60 |
+
label: "缺陷 | Drawbacks"
|
| 61 |
+
description: |
|
| 62 |
+
该新功能有哪些缺陷/可能造成哪些影响?
|
| 63 |
+
What are the drawbacks/impacts of your feature request ?
|
| 64 |
+
placeholder: |
|
| 65 |
+
Identify the drawbacks and impacts while being neutral on your feature request
|
| 66 |
+
validations:
|
| 67 |
+
required: true
|
| 68 |
+
- type: textarea
|
| 69 |
+
id: unresolved_question
|
| 70 |
+
attributes:
|
| 71 |
+
label: "未解决问题 | Unresolved questions"
|
| 72 |
+
description: |
|
| 73 |
+
有哪些尚未解决的问题?
|
| 74 |
+
What questions still remain unresolved ?
|
| 75 |
+
placeholder: |
|
| 76 |
+
Identify any unresolved issues.
|
| 77 |
+
validations:
|
| 78 |
+
required: false
|
r1-a/response_generation/minicpm/MiniCPM-o/.vscode/settings.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"githubPullRequests.ignoredPullRequestBranches": [
|
| 3 |
+
"main"
|
| 4 |
+
]
|
| 5 |
+
}
|
r1-a/response_generation/minicpm/MiniCPM-o/assets/discord.png
ADDED
|
r1-a/response_generation/minicpm/MiniCPM-o/assets/logo.html
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<span style="color:#56A7DA; font-size: 10em; font-weight: bold;">
|
| 2 |
+
MiniCPM-<span>o</span>
|
| 3 |
+
</span>
|
r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpm-llama-v-2-5_languages.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
- English
|
| 2 |
+
- 中文
|
| 3 |
+
- 한국어
|
| 4 |
+
- 日本語
|
| 5 |
+
- Deutsch
|
| 6 |
+
- Français
|
| 7 |
+
- Português
|
| 8 |
+
- Español
|
| 9 |
+
- မြန်မာဘာသာ
|
| 10 |
+
- ไทย
|
| 11 |
+
- Tiếng Việt
|
| 12 |
+
- Türkçe
|
| 13 |
+
- ܣܘܪܝܝܐ
|
| 14 |
+
- العربية
|
| 15 |
+
- हिन्दी
|
| 16 |
+
- বাংলা
|
| 17 |
+
- नेपाली
|
| 18 |
+
- Türkmençe
|
| 19 |
+
- Тоҷикӣ
|
| 20 |
+
- Кыргызча
|
| 21 |
+
- Русский
|
| 22 |
+
- Українська
|
| 23 |
+
- Беларуская
|
| 24 |
+
- ქართული
|
| 25 |
+
- Azərbaycanca
|
| 26 |
+
- Հայերեն
|
| 27 |
+
- Polski
|
| 28 |
+
- Lietuvių
|
| 29 |
+
- Eesti
|
| 30 |
+
- Latviešu
|
| 31 |
+
- Čeština
|
| 32 |
+
- Slovenčina
|
| 33 |
+
- Magyar
|
| 34 |
+
- Slovenščina
|
| 35 |
+
- Hrvatski
|
| 36 |
+
- Bosanski
|
| 37 |
+
- Crnogorski
|
| 38 |
+
- Српски
|
| 39 |
+
- Shqip
|
| 40 |
+
- Română
|
| 41 |
+
- Български
|
| 42 |
+
- Македонски
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
## 支持语言
|
| 46 |
+
|
| 47 |
+
英语
|
| 48 |
+
|
| 49 |
+
中文
|
| 50 |
+
|
| 51 |
+
韩语
|
| 52 |
+
|
| 53 |
+
日语
|
| 54 |
+
|
| 55 |
+
德语
|
| 56 |
+
|
| 57 |
+
法语
|
| 58 |
+
|
| 59 |
+
葡萄牙语
|
| 60 |
+
|
| 61 |
+
西班牙语
|
| 62 |
+
|
| 63 |
+
缅甸语
|
| 64 |
+
|
| 65 |
+
泰语
|
| 66 |
+
|
| 67 |
+
越南语
|
| 68 |
+
|
| 69 |
+
土耳其语
|
| 70 |
+
|
| 71 |
+
叙利亚语
|
| 72 |
+
|
| 73 |
+
阿拉伯语
|
| 74 |
+
|
| 75 |
+
印地语
|
| 76 |
+
|
| 77 |
+
孟加拉语
|
| 78 |
+
|
| 79 |
+
尼泊尔语
|
| 80 |
+
|
| 81 |
+
土库曼语
|
| 82 |
+
|
| 83 |
+
塔吉克语
|
| 84 |
+
|
| 85 |
+
吉尔吉斯语
|
| 86 |
+
|
| 87 |
+
俄语
|
| 88 |
+
|
| 89 |
+
乌克兰语
|
| 90 |
+
|
| 91 |
+
白俄罗斯语
|
| 92 |
+
|
| 93 |
+
格鲁吉亚语
|
| 94 |
+
|
| 95 |
+
阿塞拜疆语
|
| 96 |
+
|
| 97 |
+
亚美尼亚语
|
| 98 |
+
|
| 99 |
+
波兰语
|
| 100 |
+
|
| 101 |
+
立陶宛语
|
| 102 |
+
|
| 103 |
+
爱沙尼亚语
|
| 104 |
+
|
| 105 |
+
拉脱维亚语
|
| 106 |
+
|
| 107 |
+
捷克语
|
| 108 |
+
|
| 109 |
+
斯洛伐克语
|
| 110 |
+
|
| 111 |
+
匈牙利语
|
| 112 |
+
|
| 113 |
+
斯洛文尼亚语
|
| 114 |
+
|
| 115 |
+
克罗地亚语
|
| 116 |
+
|
| 117 |
+
波斯尼亚语
|
| 118 |
+
|
| 119 |
+
黑山语
|
| 120 |
+
|
| 121 |
+
塞尔维亚语
|
| 122 |
+
|
| 123 |
+
阿尔巴尼亚语
|
| 124 |
+
|
| 125 |
+
罗马尼亚语
|
| 126 |
+
|
| 127 |
+
保加利亚
|
| 128 |
+
|
| 129 |
+
马其顿语
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
## Supported Languages
|
| 134 |
+
|
| 135 |
+
English
|
| 136 |
+
Chinese
|
| 137 |
+
Korean
|
| 138 |
+
Japanese
|
| 139 |
+
German
|
| 140 |
+
French
|
| 141 |
+
Portuguese
|
| 142 |
+
Spanish
|
| 143 |
+
Burmese
|
| 144 |
+
Thai
|
| 145 |
+
Vietnamese
|
| 146 |
+
Turkish
|
| 147 |
+
Syriac
|
| 148 |
+
Arabic
|
| 149 |
+
Hindi
|
| 150 |
+
Bengali
|
| 151 |
+
Nepali
|
| 152 |
+
Turkmen
|
| 153 |
+
Tajik
|
| 154 |
+
Kyrgyz
|
| 155 |
+
Russian
|
| 156 |
+
Ukrainian
|
| 157 |
+
Belarusian
|
| 158 |
+
Georgian
|
| 159 |
+
Azerbaijani
|
| 160 |
+
Armenian
|
| 161 |
+
Polish
|
| 162 |
+
Lithuanian
|
| 163 |
+
Estonian
|
| 164 |
+
Latvian
|
| 165 |
+
Czech
|
| 166 |
+
Slovak
|
| 167 |
+
Hungarian
|
| 168 |
+
Slovenian
|
| 169 |
+
Croatian
|
| 170 |
+
Bosnian
|
| 171 |
+
Montenegrin
|
| 172 |
+
Serbian
|
| 173 |
+
Albanian
|
| 174 |
+
Romanian
|
| 175 |
+
Bulgarian
|
| 176 |
+
Macedonian
|
r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpm-o-group.jpeg
ADDED
|
r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpm-v24.png
ADDED
|
r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpm-v25.png
ADDED
|
r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpm-v26.png
ADDED
|
r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpmv-omnilmm.png
ADDED
|
r1-a/response_generation/minicpm/MiniCPM-o/assets/minicpmv.png
ADDED
|
r1-a/response_generation/minicpm/MiniCPM-o/assets/modelbest.png
ADDED
|
r1-a/response_generation/minicpm/MiniCPM-o/chat.py
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import torch
|
| 3 |
+
import json
|
| 4 |
+
from PIL import Image
|
| 5 |
+
import base64
|
| 6 |
+
import io
|
| 7 |
+
from accelerate import load_checkpoint_and_dispatch, init_empty_weights
|
| 8 |
+
from transformers import AutoTokenizer, AutoModel
|
| 9 |
+
|
| 10 |
+
from omnilmm.utils import disable_torch_init
|
| 11 |
+
from omnilmm.model.omnilmm import OmniLMMForCausalLM
|
| 12 |
+
from omnilmm.model.utils import build_transform
|
| 13 |
+
from omnilmm.train.train_utils import omni_preprocess
|
| 14 |
+
|
| 15 |
+
DEFAULT_IMAGE_TOKEN = "<image>"
|
| 16 |
+
DEFAULT_IMAGE_PATCH_TOKEN = "<im_patch>"
|
| 17 |
+
DEFAULT_IM_START_TOKEN = "<im_start>"
|
| 18 |
+
DEFAULT_IM_END_TOKEN = "<im_end>"
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
def init_omni_lmm(model_path):
|
| 23 |
+
torch.backends.cuda.matmul.allow_tf32 = True
|
| 24 |
+
disable_torch_init()
|
| 25 |
+
model_name = os.path.expanduser(model_path)
|
| 26 |
+
print(f'Load omni_lmm model and tokenizer from {model_name}')
|
| 27 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 28 |
+
model_name, model_max_length=2048)
|
| 29 |
+
|
| 30 |
+
if False:
|
| 31 |
+
# model on multiple devices for small size gpu memory (Nvidia 3090 24G x2)
|
| 32 |
+
with init_empty_weights():
|
| 33 |
+
model = OmniLMMForCausalLM.from_pretrained(model_name, tune_clip=True, torch_dtype=torch.bfloat16)
|
| 34 |
+
model = load_checkpoint_and_dispatch(model, model_name, dtype=torch.bfloat16,
|
| 35 |
+
device_map="auto", no_split_module_classes=['Eva','MistralDecoderLayer', 'ModuleList', 'Resampler']
|
| 36 |
+
)
|
| 37 |
+
else:
|
| 38 |
+
model = OmniLMMForCausalLM.from_pretrained(
|
| 39 |
+
model_name, tune_clip=True, torch_dtype=torch.bfloat16
|
| 40 |
+
).to(device='cuda', dtype=torch.bfloat16)
|
| 41 |
+
|
| 42 |
+
image_processor = build_transform(
|
| 43 |
+
is_train=False, input_size=model.model.config.image_size, std_mode='OPENAI_CLIP')
|
| 44 |
+
|
| 45 |
+
mm_use_im_start_end = getattr(model.config, "mm_use_im_start_end", False)
|
| 46 |
+
assert mm_use_im_start_end
|
| 47 |
+
|
| 48 |
+
tokenizer.add_tokens([DEFAULT_IMAGE_PATCH_TOKEN, DEFAULT_IM_START_TOKEN,
|
| 49 |
+
DEFAULT_IM_END_TOKEN], special_tokens=True)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
vision_config = model.model.vision_config
|
| 53 |
+
vision_config.im_patch_token = tokenizer.convert_tokens_to_ids(
|
| 54 |
+
[DEFAULT_IMAGE_PATCH_TOKEN])[0]
|
| 55 |
+
vision_config.use_im_start_end = mm_use_im_start_end
|
| 56 |
+
vision_config.im_start_token, vision_config.im_end_token = tokenizer.convert_tokens_to_ids(
|
| 57 |
+
[DEFAULT_IM_START_TOKEN, DEFAULT_IM_END_TOKEN])
|
| 58 |
+
image_token_len = model.model.config.num_query
|
| 59 |
+
|
| 60 |
+
return model, image_processor, image_token_len, tokenizer
|
| 61 |
+
|
| 62 |
+
def expand_question_into_multimodal(question_text, image_token_len, im_st_token, im_ed_token, im_patch_token):
|
| 63 |
+
if '<image>' in question_text[0]['content']:
|
| 64 |
+
question_text[0]['content'] = question_text[0]['content'].replace(
|
| 65 |
+
'<image>', im_st_token + im_patch_token * image_token_len + im_ed_token)
|
| 66 |
+
else:
|
| 67 |
+
question_text[0]['content'] = im_st_token + im_patch_token * \
|
| 68 |
+
image_token_len + im_ed_token + '\n' + question_text[0]['content']
|
| 69 |
+
return question_text
|
| 70 |
+
|
| 71 |
+
def wrap_question_for_omni_lmm(question, image_token_len, tokenizer):
|
| 72 |
+
question = expand_question_into_multimodal(
|
| 73 |
+
question, image_token_len, DEFAULT_IM_START_TOKEN, DEFAULT_IM_END_TOKEN, DEFAULT_IMAGE_PATCH_TOKEN)
|
| 74 |
+
|
| 75 |
+
conversation = question
|
| 76 |
+
data_dict = omni_preprocess(sources=[conversation],
|
| 77 |
+
tokenizer=tokenizer,
|
| 78 |
+
generation=True)
|
| 79 |
+
|
| 80 |
+
data_dict = dict(input_ids=data_dict["input_ids"][0],
|
| 81 |
+
labels=data_dict["labels"][0])
|
| 82 |
+
return data_dict
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
class OmniLMM12B:
|
| 87 |
+
def __init__(self, model_path) -> None:
|
| 88 |
+
model, img_processor, image_token_len, tokenizer = init_omni_lmm(model_path)
|
| 89 |
+
self.model = model
|
| 90 |
+
self.image_token_len = image_token_len
|
| 91 |
+
self.image_transform = img_processor
|
| 92 |
+
self.tokenizer = tokenizer
|
| 93 |
+
self.model.eval()
|
| 94 |
+
|
| 95 |
+
def decode(self, image, input_ids):
|
| 96 |
+
with torch.inference_mode():
|
| 97 |
+
output = self.model.generate_vllm(
|
| 98 |
+
input_ids=input_ids.unsqueeze(0).cuda(),
|
| 99 |
+
images=image.unsqueeze(0).half().cuda(),
|
| 100 |
+
temperature=0.6,
|
| 101 |
+
max_new_tokens=1024,
|
| 102 |
+
# num_beams=num_beams,
|
| 103 |
+
do_sample=True,
|
| 104 |
+
output_scores=True,
|
| 105 |
+
return_dict_in_generate=True,
|
| 106 |
+
repetition_penalty=1.1,
|
| 107 |
+
top_k=30,
|
| 108 |
+
top_p=0.9,
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
response = self.tokenizer.decode(
|
| 112 |
+
output.sequences[0], skip_special_tokens=True)
|
| 113 |
+
response = response.strip()
|
| 114 |
+
return response
|
| 115 |
+
|
| 116 |
+
def chat(self, input):
|
| 117 |
+
try:
|
| 118 |
+
image = Image.open(io.BytesIO(base64.b64decode(input['image']))).convert('RGB')
|
| 119 |
+
except Exception as e:
|
| 120 |
+
return "Image decode error"
|
| 121 |
+
|
| 122 |
+
msgs = json.loads(input['question'])
|
| 123 |
+
input_ids = wrap_question_for_omni_lmm(
|
| 124 |
+
msgs, self.image_token_len, self.tokenizer)['input_ids']
|
| 125 |
+
input_ids = torch.as_tensor(input_ids)
|
| 126 |
+
#print('input_ids', input_ids)
|
| 127 |
+
image = self.image_transform(image)
|
| 128 |
+
|
| 129 |
+
out = self.decode(image, input_ids)
|
| 130 |
+
|
| 131 |
+
return out
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
def img2base64(file_name):
|
| 135 |
+
with open(file_name, 'rb') as f:
|
| 136 |
+
encoded_string = base64.b64encode(f.read())
|
| 137 |
+
return encoded_string
|
| 138 |
+
|
| 139 |
+
class MiniCPMV:
|
| 140 |
+
def __init__(self, model_path) -> None:
|
| 141 |
+
self.model = AutoModel.from_pretrained(model_path, trust_remote_code=True).to(dtype=torch.bfloat16)
|
| 142 |
+
self.tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 143 |
+
self.model.eval().cuda()
|
| 144 |
+
|
| 145 |
+
def chat(self, input):
|
| 146 |
+
try:
|
| 147 |
+
image = Image.open(io.BytesIO(base64.b64decode(input['image']))).convert('RGB')
|
| 148 |
+
except Exception as e:
|
| 149 |
+
return "Image decode error"
|
| 150 |
+
|
| 151 |
+
msgs = json.loads(input['question'])
|
| 152 |
+
|
| 153 |
+
answer, context, _ = self.model.chat(
|
| 154 |
+
image=image,
|
| 155 |
+
msgs=msgs,
|
| 156 |
+
context=None,
|
| 157 |
+
tokenizer=self.tokenizer,
|
| 158 |
+
sampling=True,
|
| 159 |
+
temperature=0.7
|
| 160 |
+
)
|
| 161 |
+
return answer
|
| 162 |
+
|
| 163 |
+
class MiniCPMV2_5:
|
| 164 |
+
def __init__(self, model_path) -> None:
|
| 165 |
+
self.model = AutoModel.from_pretrained(model_path, trust_remote_code=True).to(dtype=torch.float16)
|
| 166 |
+
self.tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 167 |
+
self.model.eval().cuda()
|
| 168 |
+
|
| 169 |
+
def chat(self, input):
|
| 170 |
+
try:
|
| 171 |
+
image = Image.open(io.BytesIO(base64.b64decode(input['image']))).convert('RGB')
|
| 172 |
+
except Exception as e:
|
| 173 |
+
return "Image decode error"
|
| 174 |
+
|
| 175 |
+
msgs = json.loads(input['question'])
|
| 176 |
+
|
| 177 |
+
answer = self.model.chat(
|
| 178 |
+
image=image,
|
| 179 |
+
msgs=msgs,
|
| 180 |
+
tokenizer=self.tokenizer,
|
| 181 |
+
sampling=True,
|
| 182 |
+
temperature=0.7
|
| 183 |
+
)
|
| 184 |
+
return answer
|
| 185 |
+
|
| 186 |
+
class MiniCPMV2_6:
|
| 187 |
+
def __init__(self, model_path, multi_gpus=False) -> None:
|
| 188 |
+
|
| 189 |
+
print('torch_version:', torch.__version__)
|
| 190 |
+
if multi_gpus: # inference on multi-gpus
|
| 191 |
+
from accelerate import load_checkpoint_and_dispatch, init_empty_weights, infer_auto_device_map
|
| 192 |
+
with init_empty_weights():
|
| 193 |
+
model = AutoModel.from_pretrained(model_path, trust_remote_code=True,
|
| 194 |
+
attn_implementation='sdpa', torch_dtype=torch.bfloat16)
|
| 195 |
+
|
| 196 |
+
device_map = infer_auto_device_map(model, max_memory={0: "10GB", 1: "10GB"},
|
| 197 |
+
no_split_module_classes=['SiglipVisionTransformer', 'Qwen2DecoderLayer'])
|
| 198 |
+
device_id = device_map["llm.model.embed_tokens"]
|
| 199 |
+
device_map["llm.lm_head"] = device_id # first and last layer of llm should be in the same device
|
| 200 |
+
device_map["vpm"] = device_id
|
| 201 |
+
device_map["resampler"] = device_id
|
| 202 |
+
device_id2 = device_map["llm.model.layers.26"]
|
| 203 |
+
device_map["llm.model.layers.8"] = device_id2
|
| 204 |
+
device_map["llm.model.layers.9"] = device_id2
|
| 205 |
+
device_map["llm.model.layers.10"] = device_id2
|
| 206 |
+
device_map["llm.model.layers.11"] = device_id2
|
| 207 |
+
device_map["llm.model.layers.12"] = device_id2
|
| 208 |
+
device_map["llm.model.layers.13"] = device_id2
|
| 209 |
+
device_map["llm.model.layers.14"] = device_id2
|
| 210 |
+
device_map["llm.model.layers.15"] = device_id2
|
| 211 |
+
device_map["llm.model.layers.16"] = device_id2
|
| 212 |
+
print(device_map)
|
| 213 |
+
|
| 214 |
+
self.model = load_checkpoint_and_dispatch(model, model_path, dtype=torch.bfloat16, device_map=device_map)
|
| 215 |
+
self.model.eval()
|
| 216 |
+
else:
|
| 217 |
+
self.model = AutoModel.from_pretrained(model_path, trust_remote_code=True,
|
| 218 |
+
attn_implementation='sdpa', torch_dtype=torch.bfloat16)
|
| 219 |
+
self.model.eval().cuda()
|
| 220 |
+
|
| 221 |
+
self.tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
|
| 222 |
+
|
| 223 |
+
def chat(self, input):
|
| 224 |
+
image = None
|
| 225 |
+
if "image" in input and len(input["image"]) > 10: # legacy API
|
| 226 |
+
try:
|
| 227 |
+
image = Image.open(io.BytesIO(base64.b64decode(input['image']))).convert('RGB')
|
| 228 |
+
except Exception as e:
|
| 229 |
+
return "Image decode error"
|
| 230 |
+
|
| 231 |
+
msgs = json.loads(input["question"])
|
| 232 |
+
|
| 233 |
+
for msg in msgs:
|
| 234 |
+
contents = msg.pop('content') # support str or List[Dict]
|
| 235 |
+
if isinstance(contents, str):
|
| 236 |
+
contents = [contents]
|
| 237 |
+
|
| 238 |
+
new_cnts = []
|
| 239 |
+
for c in contents:
|
| 240 |
+
if isinstance(c, dict):
|
| 241 |
+
if c['type'] == 'text':
|
| 242 |
+
c = c['pairs']
|
| 243 |
+
elif c['type'] == 'image':
|
| 244 |
+
c = Image.open(io.BytesIO(base64.b64decode(c["pairs"]))).convert('RGB')
|
| 245 |
+
else:
|
| 246 |
+
raise ValueError("content type only support text and image.")
|
| 247 |
+
new_cnts.append(c)
|
| 248 |
+
msg['content'] = new_cnts
|
| 249 |
+
print(f'msgs: {str(msgs)}')
|
| 250 |
+
|
| 251 |
+
answer = self.model.chat(
|
| 252 |
+
image=image,
|
| 253 |
+
msgs=msgs,
|
| 254 |
+
tokenizer=self.tokenizer,
|
| 255 |
+
)
|
| 256 |
+
return answer
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
class MiniCPMVChat:
|
| 260 |
+
def __init__(self, model_path, multi_gpus=False) -> None:
|
| 261 |
+
if '12B' in model_path:
|
| 262 |
+
self.model = OmniLMM12B(model_path)
|
| 263 |
+
elif 'MiniCPM-Llama3-V' in model_path:
|
| 264 |
+
self.model = MiniCPMV2_5(model_path)
|
| 265 |
+
elif 'MiniCPM-V-2_6' in model_path:
|
| 266 |
+
self.model = MiniCPMV2_6(model_path, multi_gpus)
|
| 267 |
+
else:
|
| 268 |
+
self.model = MiniCPMV(model_path)
|
| 269 |
+
|
| 270 |
+
def chat(self, input):
|
| 271 |
+
return self.model.chat(input)
|
| 272 |
+
|
| 273 |
+
|
| 274 |
+
if __name__ == '__main__':
|
| 275 |
+
|
| 276 |
+
model_path = 'openbmb/OmniLMM-12B'
|
| 277 |
+
chat_model = MiniCPMVChat(model_path)
|
| 278 |
+
|
| 279 |
+
im_64 = img2base64('./assets/worldmap_ck.jpg')
|
| 280 |
+
|
| 281 |
+
# first round chat
|
| 282 |
+
msgs = [{"role": "user", "content": "What is interesting about this image?"}]
|
| 283 |
+
input = {"image": im_64, "question": json.dumps(msgs, ensure_ascii=True)}
|
| 284 |
+
answer = chat_model.chat(input)
|
| 285 |
+
print(msgs[-1]["content"]+'\n', answer)
|
| 286 |
+
|
| 287 |
+
# second round chat
|
| 288 |
+
msgs.append({"role": "assistant", "content": answer})
|
| 289 |
+
msgs.append({"role": "user", "content": "Where is China in the image"})
|
| 290 |
+
input = {"image": im_64,"question": json.dumps(msgs, ensure_ascii=True)}
|
| 291 |
+
answer = chat_model.chat(input)
|
| 292 |
+
print(msgs[-1]["content"]+'\n', answer)
|
| 293 |
+
|
r1-a/response_generation/minicpm/MiniCPM-o/requirements.txt
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
packaging==23.2
|
| 2 |
+
addict==2.4.0
|
| 3 |
+
editdistance==0.6.2
|
| 4 |
+
einops==0.7.0
|
| 5 |
+
fairscale==0.4.0
|
| 6 |
+
jsonlines==4.0.0
|
| 7 |
+
markdown2==2.4.10
|
| 8 |
+
matplotlib==3.7.4
|
| 9 |
+
more_itertools==10.1.0
|
| 10 |
+
nltk==3.8.1
|
| 11 |
+
numpy==1.24.4
|
| 12 |
+
opencv_python_headless==4.5.5.64
|
| 13 |
+
openpyxl==3.1.2
|
| 14 |
+
Pillow==10.1.0
|
| 15 |
+
sacrebleu==2.3.2
|
| 16 |
+
seaborn==0.13.0
|
| 17 |
+
shortuuid==1.0.11
|
| 18 |
+
#spacy==3.7.2
|
| 19 |
+
timm==0.9.10
|
| 20 |
+
torch==2.1.2
|
| 21 |
+
torchvision==0.16.2
|
| 22 |
+
tqdm==4.66.1
|
| 23 |
+
protobuf==4.25.0
|
| 24 |
+
transformers==4.40.0
|
| 25 |
+
typing_extensions==4.8.0
|
| 26 |
+
uvicorn==0.24.0.post1
|
| 27 |
+
#xformers==0.0.22.post7
|
| 28 |
+
#flash_attn==2.3.4
|
| 29 |
+
sentencepiece==0.1.99
|
| 30 |
+
accelerate==0.30.1
|
| 31 |
+
socksio==1.0.0
|
| 32 |
+
gradio==4.41.0
|
| 33 |
+
gradio_client
|
| 34 |
+
http://thunlp.oss-cn-qingdao.aliyuncs.com/multi_modal/never_delete/modelscope_studio-0.4.0.9-py3-none-any.whl
|
| 35 |
+
decord
|
r1-a/response_generation/minicpm/MiniCPM-o/requirements_o2.6.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Pillow==10.1.0
|
| 2 |
+
torch==2.3.1
|
| 3 |
+
torchaudio==2.3.1
|
| 4 |
+
torchvision==0.18.1
|
| 5 |
+
transformers==4.44.2
|
| 6 |
+
sentencepiece==0.2.0
|
| 7 |
+
vector-quantize-pytorch==1.18.5
|
| 8 |
+
vocos==0.1.0
|
| 9 |
+
accelerate==1.2.1
|
| 10 |
+
timm==0.9.10
|
| 11 |
+
soundfile==0.12.1
|
| 12 |
+
librosa==0.9.0
|
| 13 |
+
decord
|
| 14 |
+
moviepy
|
| 15 |
+
|
| 16 |
+
# for web demo
|
| 17 |
+
aiofiles==23.2.1
|
| 18 |
+
onnxruntime==1.20.1
|
| 19 |
+
fastapi
|
| 20 |
+
uvicorn
|
| 21 |
+
gradio==4.44.1
|
| 22 |
+
http://thunlp.oss-cn-qingdao.aliyuncs.com/multi_modal/never_delete/modelscope_studio-0.4.0.9-py3-none-any.whl
|