aashish1904 commited on
Commit
368b6e1
•
1 Parent(s): 30c60a0

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +70 -0
README.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+
4
+ language:
5
+ - en
6
+ - zh
7
+ library_name: transformers
8
+ tags:
9
+ - Long Context
10
+ - chatglm
11
+ - llama
12
+ datasets:
13
+ - THUDM/LongWriter-6k
14
+ pipeline_tag: text-generation
15
+
16
+ ---
17
+
18
+ ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)
19
+
20
+ # QuantFactory/LongWriter-glm4-9b-GGUF
21
+ This is quantized version of [THUDM/LongWriter-glm4-9b](https://huggingface.co/THUDM/LongWriter-glm4-9b) created using llama.cpp
22
+
23
+ # Original Model Card
24
+
25
+ # LongWriter-glm4-9b
26
+
27
+ <p align="center">
28
+ 🤗 <a href="https://huggingface.co/datasets/THUDM/LongWriter-6k" target="_blank">[LongWriter Dataset] </a> • 💻 <a href="https://github.com/THUDM/LongWriter" target="_blank">[Github Repo]</a> • 📃 <a href="https://arxiv.org/abs/2408.07055" target="_blank">[LongWriter Paper]</a>
29
+ </p>
30
+
31
+ LongWriter-glm4-9b is trained based on [glm-4-9b](https://huggingface.co/THUDM/glm-4-9b), and is capable of generating 10,000+ words at once.
32
+
33
+
34
+ A simple demo for deployment of the model:
35
+ ```python
36
+ from transformers import AutoTokenizer, AutoModelForCausalLM
37
+ import torch
38
+ tokenizer = AutoTokenizer.from_pretrained("THUDM/LongWriter-glm4-9b", trust_remote_code=True)
39
+ model = AutoModelForCausalLM.from_pretrained("THUDM/LongWriter-glm4-9b", torch_dtype=torch.bfloat16, trust_remote_code=True, device_map="auto")
40
+ model = model.eval()
41
+ query = "Write a 10000-word China travel guide"
42
+ prompt = f"[INST]{query}[/INST]"
43
+ input = tokenizer(prompt, truncation=False, return_tensors="pt").to(device)
44
+ context_length = input.input_ids.shape[-1]
45
+ output = model.generate(
46
+ **input,
47
+ max_new_tokens=32768,
48
+ num_beams=1,
49
+ do_sample=True,
50
+ temperature=0.5,
51
+ )[0]
52
+ response = tokenizer.decode(output[context_length:], skip_special_tokens=True)
53
+ print(response)
54
+ ```
55
+ Environment: `transformers==4.43.0`
56
+
57
+ License: [glm-4-9b License](https://huggingface.co/THUDM/glm-4-9b-chat/blob/main/LICENSE)
58
+
59
+ ## Citation
60
+
61
+ If you find our work useful, please consider citing LongWriter:
62
+
63
+ ```
64
+ @article{bai2024longwriter,
65
+ title={LongWriter: Unleashing 10,000+ Word Generation from Long Context LLMs},
66
+ author={Yushi Bai and Jiajie Zhang and Xin Lv and Linzhi Zheng and Siqi Zhu and Lei Hou and Yuxiao Dong and Jie Tang and Juanzi Li},
67
+ journal={arXiv preprint arXiv:2408.07055},
68
+ year={2024}
69
+ }
70
+ ```