Views
No views yet
| Name | Quant method | Size |
|---|---|---|
| XuanYuan-6B.Q2_K.gguf | Q2_K | 2.25GB |
| XuanYuan-6B.IQ3_XS.gguf | IQ3_XS | 2.48GB |
| XuanYuan-6B.IQ3_S.gguf | IQ3_S | 2.62GB |
| XuanYuan-6B.Q3_K_S.gguf | Q3_K_S | 2.62GB |
| XuanYuan-6B.IQ3_M.gguf | IQ3_M | 2.76GB |
| XuanYuan-6B.Q3_K.gguf | Q3_K | 2.92GB |
| XuanYuan-6B.Q3_K_M.gguf | Q3_K_M | 2.92GB |
| XuanYuan-6B.Q3_K_L.gguf | Q3_K_L | 3.19GB |
| XuanYuan-6B.IQ4_XS.gguf | IQ4_XS | 3.23GB |
| XuanYuan-6B.Q4_0.gguf | Q4_0 | 3.39GB |
| XuanYuan-6B.IQ4_NL.gguf | IQ4_NL | 3.41GB |
| XuanYuan-6B.Q4_K_S.gguf | Q4_K_S | 3.41GB |
| XuanYuan-6B.Q4_K.gguf | Q4_K | 3.6GB |
| XuanYuan-6B.Q4_K_M.gguf | Q4_K_M | 3.6GB |
| XuanYuan-6B.Q4_1.gguf | Q4_1 | 3.75GB |
| XuanYuan-6B.Q5_0.gguf | Q5_0 | 4.12GB |
| XuanYuan-6B.Q5_K_S.gguf | Q5_K_S | 4.12GB |
| XuanYuan-6B.Q5_K.gguf | Q5_K | 4.22GB |
| XuanYuan-6B.Q5_K_M.gguf | Q5_K_M | 4.22GB |
| XuanYuan-6B.Q5_1.gguf | Q5_1 | 4.48GB |
| XuanYuan-6B.Q6_K.gguf | Q6_K | 4.89GB |
| XuanYuan-6B.Q8_0.gguf | Q8_0 | 6.33GB |
| 基座模型 | Chat模型 | 8-bit量化Chat模型 | 4-bit量化Chat模型 |
|---|---|---|---|
| 🤗 XuanYuan-6B | 🤗 XuanYuan-6B-Chat | 🤗 XuanYuan-6B-Chat-8bit | 🤗 XuanYuan-6B-Chat-4bit |
1import torch
2from transformers import LlamaForCausalLM, AutoTokenizer
3
4model_name_or_path = "your/model/path/"
5
6tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
7model = LlamaForCausalLM.from_pretrained(model_name_or_path, device_map="auto")
8model.eval()
9
10seps = [" ", "</s>"]
11roles = ["Human", "Assistant"]
12
13content = "介绍下你自己"
14prompt = seps[0] + roles[0] + ": " + content + seps[0] + roles[1] + ":"
15print(f"输入: {content}")
16inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
17outputs = model.generate(**inputs, max_new_tokens=256, do_sample=True, temperature=0.7, top_p=0.95)
18outputs = tokenizer.decode(outputs.cpu()[0][len(inputs.input_ids[0]):], skip_special_tokens=True)
19print(f"输出: {outputs}")