五军营:由骑兵和步兵组成,分为中军、左军、左掖军、右掖军、右哨军,担任攻击的主力。
三千营:由投降的蒙古骑兵组成,主要是以雇佣兵为主的。下属全部都是骑兵,这支骑兵部队人数虽然不多,却是朱棣手下最为强悍的骑兵力量,他们在战争中主要担任突击的角色。
神机营:使用火炮和火铳等火器为主的部队,是明朝政府的炮兵部队。朱棣同志之所以要组建这样的一支部队,那是有着深刻原因的。
所以,明朝三大营的组成和职责是:五军营负责攻击,三千营负责突击,神机营负责使用火器进行打击。
import transformers
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "UnicomAI/Unichat-llama3-Chinese-8B-28K"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device="cuda",
)
messages = [
{"role": "system", "content": "A chat between a curious user and an artificial intelligence assistant.The assistant gives helpful, detailed, and polite answers to the user's questions."},
{"role": "user", "content": "你是谁"},
]
prompt = pipeline.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
terminators = [
pipeline.tokenizer.eos_token_id,
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = pipeline(
prompt,
max_new_tokens=2048,
eos_token_id=terminators,
do_sample=True,
temperature=0.6,
top_p=1,
repetition_penalty=1.15
)
print(outputs[0]["generated_text"][len(prompt):])
更多模型,数据集和训练相关细节请参考:
pytorch_model-00001-of-00002.bin 9.3 GiBpytorch_model-00002-of-00002.bin 5.7 GiB