Spaces:
Build error
Build error
Create utils.py
Browse files
utils.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import torch
|
| 3 |
+
from typing import List, Dict, Union
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
error_title_markdown = ("""
|
| 8 |
+
<div style="display: flex; justify-content: center; align-items: center; text-align: center;">
|
| 9 |
+
#<a href="https://github.com/PKU-YuanGroup/MoE-LLaVA" style="margin-right: 20px; text-decoration: none; display: flex; align-items: center;">
|
| 10 |
+
#<img src="https://s11.ax1x.com/2023/12/28/piqvDMV.png" alt="MoE-LLaVA🚀" style="max-width: 120px; height: auto;">
|
| 11 |
+
</a>
|
| 12 |
+
<div>
|
| 13 |
+
<h1 >MoE-LLaVA: Mixture of Experts for Large Vision-Language Models</h1>
|
| 14 |
+
<h4 style="margin: 0;">If you like our project, please give us a star ✨ on Github for the latest update.</h4>
|
| 15 |
+
#<h2 style="margin: 0.5;"><a href='https://github.com/PKU-YuanGroup/MoE-LLaVA'>https://github.com/PKU-YuanGroup/MoE-LLaVA</a></h2>
|
| 16 |
+
</div>
|
| 17 |
+
</div>
|
| 18 |
+
<div align="center">
|
| 19 |
+
<div style="display:flex; gap: 0.25rem;" align="center">
|
| 20 |
+
#<a href='https://github.com/PKU-YuanGroup/MoE-LLaVA'><img src='https://img.shields.io/badge/Github-Code-blue'></a>
|
| 21 |
+
#<a href="https://arxiv.org/pdf/2401.15947.pdf"><img src="https://img.shields.io/badge/Arxiv-2401.15947-red"></a>
|
| 22 |
+
#<a href='https://github.com/PKU-YuanGroup/MoE-LLaVA/stargazers'><img src='https://img.shields.io/github/stars/PKU-YuanGroup/MoE-LLaVA.svg?style=social'></a>
|
| 23 |
+
|
| 24 |
+
</div>
|
| 25 |
+
""")
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
title_markdown = ("""
|
| 29 |
+
<div style="display: flex; justify-content: center; align-items: center; text-align: center;"> </div>
|
| 30 |
+
<div>
|
| 31 |
+
<h1 >MoE-LLaVA: Mixture of Experts for Large Vision-Language Models</h1>a
|
| 32 |
+
</div>
|
| 33 |
+
<div align="center">
|
| 34 |
+
<div style="display:flex; gap: 0.25rem;" align="center"></div>
|
| 35 |
+
</div>
|
| 36 |
+
""")
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
block_css = """
|
| 41 |
+
#buttons button {
|
| 42 |
+
min-width: min(120px,100%);
|
| 43 |
+
}
|
| 44 |
+
"""
|
| 45 |
+
|
| 46 |
+
tos_markdown = ("""
|
| 47 |
+
### TOS MARKDOWN
|
| 48 |
+
""")
|
| 49 |
+
|
| 50 |
+
learn_more_markdown = ("""
|
| 51 |
+
### Smart Solutions Contact
|
| 52 |
+
""")
|