Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -126,6 +126,77 @@ If you use this model, please cite the original:
|
|
| 126 |
}
|
| 127 |
```
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
## Acknowledgments
|
| 130 |
|
| 131 |
- Original model by [NAVER Cloud HyperCLOVA X](https://huggingface.co/naver-hyperclovax)
|
|
|
|
| 126 |
}
|
| 127 |
```
|
| 128 |
|
| 129 |
+
## Reproduce This Extraction
|
| 130 |
+
|
| 131 |
+
Want to extract the LLM yourself? Use the included [`extract_llm.py`](extract_llm.py) script.
|
| 132 |
+
|
| 133 |
+
### Prerequisites
|
| 134 |
+
|
| 135 |
+
```bash
|
| 136 |
+
pip install safetensors torch tqdm huggingface_hub
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
### Step 1: Download Original VLM (~66GB)
|
| 140 |
+
|
| 141 |
+
```bash
|
| 142 |
+
huggingface-cli download naver-hyperclovax/HyperCLOVAX-SEED-Think-32B \
|
| 143 |
+
--local-dir ./HyperCLOVAX-SEED-Think-32B
|
| 144 |
+
```
|
| 145 |
+
|
| 146 |
+
### Step 2: Run Extraction Script
|
| 147 |
+
|
| 148 |
+
```bash
|
| 149 |
+
# Download the extraction script
|
| 150 |
+
wget https://huggingface.co/minpeter/HyperCLOVAX-SEED-Text-Think-32B-hf/resolve/main/extract_llm.py
|
| 151 |
+
|
| 152 |
+
# Run extraction
|
| 153 |
+
python extract_llm.py \
|
| 154 |
+
--input ./HyperCLOVAX-SEED-Think-32B \
|
| 155 |
+
--output ./HyperCLOVAX-SEED-Text-Think-32B
|
| 156 |
+
```
|
| 157 |
+
|
| 158 |
+
### What the Script Does
|
| 159 |
+
|
| 160 |
+
1. **Extracts LLM weights**: Filters `model.language_model.*` tensors from the VLM
|
| 161 |
+
2. **Remaps keys**: Converts to standard LLaMA format
|
| 162 |
+
- `model.language_model.model.*` → `model.*`
|
| 163 |
+
- `model.language_model.lm_head.*` → `lm_head.*`
|
| 164 |
+
3. **Creates config**: Generates LLaMA-compatible `config.json` from VLM's `text_config`
|
| 165 |
+
4. **Copies tokenizer**: Preserves all tokenizer files unchanged
|
| 166 |
+
|
| 167 |
+
### Output Structure
|
| 168 |
+
|
| 169 |
+
```
|
| 170 |
+
HyperCLOVAX-SEED-Text-Think-32B/
|
| 171 |
+
├── config.json # LLaMA config
|
| 172 |
+
├── generation_config.json
|
| 173 |
+
├── model-00001-of-00013.safetensors # ~5GB shards
|
| 174 |
+
├── ...
|
| 175 |
+
├── model-00013-of-00013.safetensors
|
| 176 |
+
├── model.safetensors.index.json
|
| 177 |
+
├── tokenizer.json
|
| 178 |
+
├── tokenizer_config.json
|
| 179 |
+
├── special_tokens_map.json
|
| 180 |
+
├── added_tokens.json
|
| 181 |
+
├── vocab.json
|
| 182 |
+
├── merges.txt
|
| 183 |
+
└── chat_template.jinja
|
| 184 |
+
```
|
| 185 |
+
|
| 186 |
+
### Verify Extraction
|
| 187 |
+
|
| 188 |
+
```bash
|
| 189 |
+
# Quick test with vLLM
|
| 190 |
+
vllm serve ./HyperCLOVAX-SEED-Text-Think-32B \
|
| 191 |
+
--dtype bfloat16 \
|
| 192 |
+
--tensor-parallel-size 2
|
| 193 |
+
|
| 194 |
+
# In another terminal
|
| 195 |
+
curl http://localhost:8000/v1/chat/completions \
|
| 196 |
+
-H "Content-Type: application/json" \
|
| 197 |
+
-d '{"model": "./HyperCLOVAX-SEED-Text-Think-32B", "messages": [{"role": "user", "content": "Hello!"}]}'
|
| 198 |
+
```
|
| 199 |
+
|
| 200 |
## Acknowledgments
|
| 201 |
|
| 202 |
- Original model by [NAVER Cloud HyperCLOVA X](https://huggingface.co/naver-hyperclovax)
|