初始化项目,由ModelHub XC社区提供模型
Model: enochlev/MiniCPM-duplex Source: Original Platform
This commit is contained in:
45
README.md
Normal file
45
README.md
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
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.
|
||||
Reference in New Issue
Block a user