Views
No views yet
| Name | Quant method | Size |
|---|---|---|
| TDPOM-beta.Q2_K.gguf | Q2_K | 0.2GB |
| TDPOM-beta.IQ3_XS.gguf | IQ3_XS | 0.22GB |
| TDPOM-beta.IQ3_S.gguf | IQ3_S | 0.22GB |
| TDPOM-beta.Q3_K_S.gguf | Q3_K_S | 0.22GB |
| TDPOM-beta.IQ3_M.gguf | IQ3_M | 0.23GB |
| TDPOM-beta.Q3_K.gguf | Q3_K | 0.24GB |
| TDPOM-beta.Q3_K_M.gguf | Q3_K_M | 0.24GB |
| TDPOM-beta.Q3_K_L.gguf | Q3_K_L | 0.26GB |
| TDPOM-beta.IQ4_XS.gguf | IQ4_XS | 0.27GB |
| TDPOM-beta.Q4_0.gguf | Q4_0 | 0.28GB |
| TDPOM-beta.IQ4_NL.gguf | IQ4_NL | 0.28GB |
| TDPOM-beta.Q4_K_S.gguf | Q4_K_S | 0.28GB |
| TDPOM-beta.Q4_K.gguf | Q4_K | 0.3GB |
| TDPOM-beta.Q4_K_M.gguf | Q4_K_M | 0.3GB |
| TDPOM-beta.Q4_1.gguf | Q4_1 | 0.31GB |
| TDPOM-beta.Q5_0.gguf | Q5_0 | 0.34GB |
| TDPOM-beta.Q5_K_S.gguf | Q5_K_S | 0.34GB |
| TDPOM-beta.Q5_K.gguf | Q5_K | 0.34GB |
| TDPOM-beta.Q5_K_M.gguf | Q5_K_M | 0.34GB |
| TDPOM-beta.Q5_1.gguf | Q5_1 | 0.36GB |
| TDPOM-beta.Q6_K.gguf | Q6_K | 0.39GB |
| TDPOM-beta.Q8_0.gguf | Q8_0 | 0.51GB |
transformers library on a machine with GPUs, first make sure you have the transformers library installed.pip install transformers==4.45.0token=True in the pipeline and login to hugginface_hub by running1import huggingface_hub
2huggingface_hub.login(<ACCESS_TOKEN>)token in the pipeline1from transformers import pipeline
2
3generate_text = pipeline(
4 model="zakariarada/TDPOM-beta",
5 torch_dtype="auto",
6 trust_remote_code=True,
7 device_map={"": "cuda:0"},
8 token=True,
9)
10
11# generate configuration can be modified to your needs
12# generate_text.model.generation_config.min_new_tokens = 2
13# generate_text.model.generation_config.max_new_tokens = 256
14# generate_text.model.generation_config.do_sample = False
15# generate_text.model.generation_config.num_beams = 1
16# generate_text.model.generation_config.temperature = float(0.0)
17# generate_text.model.generation_config.repetition_penalty = float(1.0)
18
19messages = [
20 {
21 "role": "system",
22 "content": "You are a friendly and polite chatbot.",
23 },
24 {"role": "user", "content": "Hi, how are you?"},
25 {"role": "assistant", "content": "I'm doing great, how about you?"},
26 {"role": "user", "content": "Why is drinking water so healthy?"},
27]
28
29res = generate_text(
30 messages,
31 renormalize_logits=True
32)
33print(res[0]["generated_text"][-1]['content'])1print(generate_text.tokenizer.apply_chat_template(
2 messages,
3 tokenize=False,
4 add_generation_prompt=True,
5))1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3model_name = "zakariarada/TDPOM-beta" # either local folder or Hugging Face model name
4# Important: The prompt needs to be in the same format the model was trained with.
5# You can find an example prompt in the experiment logs.
6messages = [
7 {
8 "role": "system",
9 "content": "You are a friendly and polite chatbot.",
10 },
11 {"role": "user", "content": "Hi, how are you?"},
12 {"role": "assistant", "content": "I'm doing great, how about you?"},
13 {"role": "user", "content": "Why is drinking water so healthy?"},
14]
15
16tokenizer = AutoTokenizer.from_pretrained(
17 model_name,
18 trust_remote_code=True,
19)
20model = AutoModelForCausalLM.from_pretrained(
21 model_name,
22 torch_dtype="auto",
23 device_map={"": "cuda:0"},
24 trust_remote_code=True,
25)
26model.cuda().eval()
27
28# generate configuration can be modified to your needs
29# model.generation_config.min_new_tokens = 2
30# model.generation_config.max_new_tokens = 256
31# model.generation_config.do_sample = False
32# model.generation_config.num_beams = 1
33# model.generation_config.temperature = float(0.0)
34# model.generation_config.repetition_penalty = float(1.0)
35
36inputs = tokenizer.apply_chat_template(
37 messages,
38 tokenize=True,
39 add_generation_prompt=True,
40 return_tensors="pt",
41 return_dict=True,
42).to("cuda")
43
44tokens = model.generate(
45 input_ids=inputs["input_ids"],
46 attention_mask=inputs["attention_mask"],
47 renormalize_logits=True
48)[0]
49
50tokens = tokens[inputs["input_ids"].shape[1]:]
51answer = tokenizer.decode(tokens, skip_special_tokens=True)
52print(answer)load_in_8bit=True or load_in_4bit=True. Also, sharding on multiple GPUs is possible by setting device_map=auto.LlamaForCausalLM(
(model): LlamaModel(
(embed_tokens): Embedding(32000, 1536, padding_idx=0)
(layers): ModuleList(
(0-15): 16 x LlamaDecoderLayer(
(self_attn): LlamaSdpaAttention(
(q_proj): Linear(in_features=1536, out_features=1536, bias=False)
(k_proj): Linear(in_features=1536, out_features=768, bias=False)
(v_proj): Linear(in_features=1536, out_features=768, bias=False)
(o_proj): Linear(in_features=1536, out_features=1536, bias=False)
(rotary_emb): LlamaRotaryEmbedding()
)
(mlp): LlamaMLP(
(gate_proj): Linear(in_features=1536, out_features=4096, bias=False)
(up_proj): Linear(in_features=1536, out_features=4096, bias=False)
(down_proj): Linear(in_features=4096, out_features=1536, bias=False)
(act_fn): SiLU()
)
(input_layernorm): LlamaRMSNorm((1536,), eps=1e-05)
(post_attention_layernorm): LlamaRMSNorm((1536,), eps=1e-05)
)
)
(norm): LlamaRMSNorm((1536,), eps=1e-05)
(rotary_emb): LlamaRotaryEmbedding()
)
(lm_head): Linear(in_features=1536, out_features=32000, bias=False)
)