本模型使用H2O LLM Studio进行训练。访问H2O LLM Studio了解如何训练您自己的大型语言模型。
from openmind import pipeline, is_torch_npu_available
from openmind_hub import snapshot_download
if is_torch_npu_available():
device = "npu:0"
else:
device = "cpu"
pipe = pipeline(
"text-generation",
model="SY_AICC/h2ogpt-gm-7b-mistral-chat-sft-dpo-rag-v1",
torch_dtype=torch.bfloat16,
device=device,
)
messages = [
{"role": "user", "content": "Why is drinking water so healthy?"},
]
prompt = pipe.tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
res = pipe(
prompt,
max_new_tokens=256,
)
print(res[0]["generated_text"])
# <|system|>You are a friendly chatbot</s><|prompt|>Why is drinking water so healthy?</s><|answer|> Drinking water is healthy for several reasons: [...]您可以通过指定 load_in_8bit=True 或 load_in_4bit=True 来使用量化方式加载模型。
MistralForCausalLM(
(model): MistralModel(
(embed_tokens): Embedding(32000, 4096, padding_idx=0)
(layers): ModuleList(
(0-31): 32 x MistralDecoderLayer(
(self_attn): MistralAttention(
(q_proj): Linear(in_features=4096, out_features=4096, bias=False)
(k_proj): Linear(in_features=4096, out_features=1024, bias=False)
(v_proj): Linear(in_features=4096, out_features=1024, bias=False)
(o_proj): Linear(in_features=4096, out_features=4096, bias=False)
(rotary_emb): MistralRotaryEmbedding()
)
(mlp): MistralMLP(
(gate_proj): Linear(in_features=4096, out_features=14336, bias=False)
(up_proj): Linear(in_features=4096, out_features=14336, bias=False)
(down_proj): Linear(in_features=14336, out_features=4096, bias=False)
(act_fn): SiLUActivation()
)
(input_layernorm): MistralRMSNorm()
(post_attention_layernorm): MistralRMSNorm()
)
)
(norm): MistralRMSNorm()
)
(lm_head): Linear(in_features=4096, out_features=32000, bias=False)
)在使用本仓库提供的大型语言模型前,请仔细阅读本免责声明。您对本模型的使用即表示您同意以下条款和条件。
通过使用本仓库提供的大型语言模型,您同意接受并遵守本免责声明中所述的条款和条件。如果您不同意本免责声明的任何部分,您应避免使用本模型及其生成的任何内容。