|
|
---
|
|
|
license: apache-2.0
|
|
|
base_model: openbmb/MiniCPM-o-2_6
|
|
|
tags:
|
|
|
- vision
|
|
|
- text-generation
|
|
|
- multimodal
|
|
|
- minicpm
|
|
|
- tiny-model
|
|
|
- testing
|
|
|
- optimum-intel
|
|
|
pipeline_tag: text-generation
|
|
|
library_name: transformers
|
|
|
---
|
|
|
|
|
|
# tiny-random-MiniCPM-o-2_6
|
|
|
|
|
|
A minimal, randomly initialized version of MiniCPM-o-2_6 designed for testing and development purposes. This model maintains the same architecture as the original MiniCPM-o-2_6 but with drastically reduced dimensions to create a lightweight test model.
|
|
|
|
|
|
## Model Details
|
|
|
|
|
|
### Model Description
|
|
|
|
|
|
This is a tiny, randomly initialized version of the MiniCPM-o-2_6 multimodal model. It was created by scaling down the original model's dimensions while preserving the architecture structure. The model is intended for:
|
|
|
|
|
|
- Testing and development workflows
|
|
|
- Integration testing with Optimum-Intel
|
|
|
- Quick prototyping and experimentation
|
|
|
- CI/CD pipelines requiring lightweight models
|
|
|
|
|
|
**⚠️ Important:** This model is randomly initialized and should NOT be used for production inference. It is designed solely for testing purposes.
|
|
|
|
|
|
### Model Architecture
|
|
|
|
|
|
The model maintains the same architecture as MiniCPM-o-2_6 but with reduced dimensions:
|
|
|
|
|
|
**Language Model (LLM):**
|
|
|
- `hidden_size`: 40
|
|
|
- `num_hidden_layers`: 1
|
|
|
- `num_attention_heads`: 4
|
|
|
- `num_key_value_heads`: 2
|
|
|
- `intermediate_size`: 16
|
|
|
- `max_position_embeddings`: 128
|
|
|
- `vocab_size`: 151,700
|
|
|
|
|
|
**Vision Component:**
|
|
|
- `hidden_size`: 16
|
|
|
- `num_hidden_layers`: 1
|
|
|
- `num_attention_heads`: 4
|
|
|
- `intermediate_size`: 8
|
|
|
- `patch_size`: 14
|
|
|
|
|
|
**Audio/TTS Components:**
|
|
|
- Audio: Disabled (`init_audio: false`)
|
|
|
- TTS: Disabled (`init_tts: false`)
|
|
|
|
|
|
### Model Size
|
|
|
|
|
|
- **Total Parameters**: ~6.17M
|
|
|
- **Model Size**: ~12.4 MB (on disk)
|
|
|
- **Precision**: bfloat16
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
### Basic Usage
|
|
|
|
|
|
```python
|
|
|
from transformers import AutoModel, AutoTokenizer, AutoProcessor
|
|
|
import torch
|
|
|
from PIL import Image
|
|
|
|
|
|
# Load model and tokenizer
|
|
|
model_id = "notlikejoe/tiny-random-MiniCPM-o-2_6"
|
|
|
model = AutoModel.from_pretrained(model_id, trust_remote_code=True, torch_dtype=torch.bfloat16)
|
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
|
|
processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
|
|
|
|
|
|
# Prepare inputs
|
|
|
text = "Hello, how are you?"
|
|
|
image = Image.new('RGB', (224, 224), color='red') # Dummy image
|
|
|
|
|
|
# Process inputs
|
|
|
inputs = processor(text=text, images=image, return_tensors="pt")
|
|
|
|
|
|
# Forward pass
|
|
|
model.eval()
|
|
|
with torch.no_grad():
|
|
|
outputs = model(**inputs)
|
|
|
```
|
|
|
|
|
|
### With Optimum-Intel
|
|
|
|
|
|
This model is compatible with Optimum-Intel for OpenVINO optimization:
|
|
|
|
|
|
```python
|
|
|
from optimum.intel import OVModelForCausalLM
|
|
|
from transformers import AutoTokenizer
|
|
|
|
|
|
model_id = "notlikejoe/tiny-random-MiniCPM-o-2_6"
|
|
|
|
|
|
# Export to OpenVINO format
|
|
|
ov_model = OVModelForCausalLM.from_pretrained(
|
|
|
model_id,
|
|
|
export=True,
|
|
|
trust_remote_code=True
|
|
|
)
|
|
|
|
|
|
# Use for inference
|
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
|
|
|
```
|
|
|
|
|
|
## Model Validation
|
|
|
|
|
|
The model has been validated to ensure:
|
|
|
|
|
|
✅ Model loads successfully from Hugging Face
|
|
|
✅ Config, tokenizer, and processor load correctly
|
|
|
✅ Model structure matches expected architecture
|
|
|
✅ Compatible with Optimum-Intel export
|
|
|
✅ Forward pass completes without errors
|
|
|
✅ **OpenVINO compatibility fix applied**: Resampler `num_heads=0` issue resolved
|
|
|
|
|
|
### OpenVINO Compatibility Fix
|
|
|
|
|
|
This model includes a fix for the OpenVINO loading issue where `num_heads=0` would occur with small `embed_dim` values. The resampler's `num_heads` calculation has been patched to ensure it's always at least 1:
|
|
|
|
|
|
```python
|
|
|
# Original: num_heads = embed_dim // 128 # Would be 0 when embed_dim=40
|
|
|
# Fixed: num_heads = 1 if embed_dim < 128 else max(1, embed_dim // 128)
|
|
|
```
|
|
|
|
|
|
The `modeling_minicpmo.py` file included with this model contains this fix, ensuring compatibility with Optimum-Intel OpenVINO export and loading.
|
|
|
|
|
|
## Limitations
|
|
|
|
|
|
1. **Random Initialization**: This model is randomly initialized and will not produce meaningful outputs
|
|
|
2. **Reduced Dimensions**: The model dimensions are minimal and may not capture complex patterns
|
|
|
3. **Testing Only**: This model is intended for testing and development, not production use
|
|
|
4. **Limited Vocabulary**: The vocabulary has been reduced to 2000 entries for size optimization
|
|
|
|
|
|
## Training Details
|
|
|
|
|
|
This model was not trained. It is a randomly initialized, dimensionally-reduced version of MiniCPM-o-2_6 created for testing purposes.
|
|
|
|
|
|
### Training Data
|
|
|
|
|
|
N/A - Model is randomly initialized.
|
|
|
|
|
|
## Evaluation
|
|
|
|
|
|
This model is not intended for evaluation on standard benchmarks as it is randomly initialized.
|
|
|
|
|
|
## Citation
|
|
|
|
|
|
If you use this model, please cite the original MiniCPM-o-2_6 model:
|
|
|
|
|
|
```bibtex
|
|
|
@misc{minicpm-o-2_6,
|
|
|
title={MiniCPM-o-2_6},
|
|
|
author={OpenBMB},
|
|
|
year={2024},
|
|
|
howpublished={\url{https://huggingface.co/openbmb/MiniCPM-o-2_6}}
|
|
|
}
|
|
|
```
|
|
|
|
|
|
## Model Card Contact
|
|
|
|
|
|
For questions or issues related to this model, please open an issue in the repository.
|
|
|
|
|
|
## License
|
|
|
|
|
|
This model is licensed under the Apache 2.0 License, same as the base model.
|
|
|
|
|
|
|