File size: 1,255 Bytes
30747ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c19cdc1
30747ee
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
language:
- en
- zh
library_name: transformers
tags:
- minicpm
- duplex
- text-generation
base_model: xinrongzhang2022/MiniCPM-duplex
---

# MiniCPM-duplex (safetensors)

Modern safetensors conversion of [xinrongzhang2022/MiniCPM-duplex](https://huggingface.co/xinrongzhang2022/MiniCPM-duplex).

**Weights are identical** — only the serialization format has changed from `pytorch_model.bin`
to `model.safetensors`, enabling memory-mapped loading and compatibility with current
versions of Transformers.

## Usage

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

tokenizer = AutoTokenizer.from_pretrained(
    "enochlev/MiniCPM-duplex", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
    "enochlev/MiniCPM-duplex",
    trust_remote_code=True,
    dtype=torch.float16,
    device_map="auto",
)

prompt = "<用户>Hello, what can you do?<AI>"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=256)
print(tokenizer.decode(out[0], skip_special_tokens=True))
```

## Original model

See [xinrongzhang2022/MiniCPM-duplex](https://huggingface.co/xinrongzhang2022/MiniCPM-duplex)
for the original weights, paper, and full documentation.