Views
No views yet
1# Use a pipeline as a high-level helper
2from transformers import pipeline
3pipe = pipeline("text-generation", model="whynlp/tinyllama-lckv-w2-100b", trust_remote_code=True)
4
5# Load model directly
6from transformers import AutoModelForCausalLM
7model = AutoModelForCausalLM.from_pretrained("whynlp/tinyllama-lckv-w2-100b", trust_remote_code=True)1# This is consistent with the `run_generation.py` script in the github repo: https://github.com/whyNLP/LCKV
2import torch
3from accelerate.utils import set_seed
4
5from transformers import pipeline
6
7
8set_seed(42)
9
10pipe = pipeline(
11 "text-generation",
12 model="whynlp/tinyllama-lckv-w2-100b",
13 torch_dtype=torch.bfloat16,
14 device="cuda",
15 trust_remote_code=True,
16 model_kwargs={"attn_implementation": "flash_attention_2"},
17)
18
19response = pipe(
20 "the meaning of life is",
21 add_special_tokens=False,
22 max_new_tokens=50,
23 temperature=1.0,
24 top_k=0,
25 top_p=0.9,
26 repetition_penalty=1.0,
27 do_sample=True,
28)
29
30print(response[0]["generated_text"])
31# the meaning of life is the magazine, however this time it will take it seems an absolute fantastic. Keeping the key to my appearance. Recently we did cool our liking anyone also up hours, health type process.
32# With kids to of this is and| Model | Paper Section | Dev ppl. | Common-sense Reasoning |
|---|---|---|---|
| whynlp/tinyllama-lckv-w10-ft-250b | -- | 7.939 | 50.86 |
| whynlp/tinyllama-lckv-w2-ft-100b | Appendix C.1, Table 7 (line 5) | 8.514 | 49.55 |
| whynlp/tinyllama-lckv-w10-100b | Section 3.2, Table 2 (line 3) | 9.265 | 46.84 |
| whynlp/tinyllama-lckv-w2-100b | Section 3.2, Table 2 (line 2) | 9.746 | 45.45 |