LongCite-glm4-9b is trained based on
glm-4-9b
, and is capable of generating fine-grained citations in long-context question answering. The model supports a maximum context window of up to 128K tokens.
Environment: Same environment requirement as
glm-4-9b-chat
(
transforemrs>=4.43.0
).
A simple demo for deployment of the model:
import json
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained('THUDM/LongCite-glm4-9b', trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained('THUDM/LongCite-glm4-9b', torch_dtype=torch.bfloat16, trust_remote_code=True, device_map='auto')
context = '''W. Russell Todd, 94, United States Army general (b. 1928). February 13. Tim Aymar, 59, heavy metal singer (Pharaoh) (b. 1963). Marshall \"Eddie\" Conway, 76, Black Panther Party leader (b. 1946). Roger Bonk, 78, football player (North Dakota Fighting Sioux, Winnipeg Blue Bombers) (b. 1944). Conrad Dobler, 72, football player (St. Louis Cardinals, New Orleans Saints, Buffalo Bills) (b. 1950). Brian DuBois, 55, baseball player (Detroit Tigers) (b. 1967). Robert Geddes, 99, architect, dean of the Princeton University School of Architecture (1965–1982) (b. 1923). Tom Luddy, 79, film producer (Barfly, The Secret Garden), co-founder of the Telluride Film Festival (b. 1943). David Singmaster, 84, mathematician (b. 1938).'''
query = "What was Robert Geddes' profession?"
result = model.query_longcite(context, query, tokenizer=tokenizer, max_input_length=128000, max_new_tokens=1024)
print("Answer:\n{}\n".format(result['answer']))
print("Statement with citations:\n{}\n".format(
json.dumps(result['statements_with_citations'], indent=2, ensure_ascii=False)))
print("Context (divided into sentences):\n{}\n".format(result['splited_context']))
If you find our work useful, please consider citing LongCite:
@article{zhang2024longcite,
title = {LongCite: Enabling LLMs to Generate Fine-grained Citations in Long-context QA}
author={Jiajie Zhang and Yushi Bai and Xin Lv and Wanjun Gu and Danqing Liu and Minhao Zou and Shulin Cao and Lei Hou and Yuxiao Dong and Ling Feng and Juanzi Li},
journal={arXiv preprint arXiv:2409.02897},
year={2024}
}
Runs of zai-org LongCite-glm4-9b on huggingface.co
464
Total runs
0
24-hour runs
8
3-day runs
44
7-day runs
275
30-day runs
More Information About LongCite-glm4-9b huggingface.co Model
LongCite-glm4-9b huggingface.co
LongCite-glm4-9b huggingface.co is an AI model on huggingface.co that provides LongCite-glm4-9b's model effect (), which can be used instantly with this zai-org LongCite-glm4-9b model. huggingface.co supports a free trial of the LongCite-glm4-9b model, and also provides paid use of the LongCite-glm4-9b. Support call LongCite-glm4-9b model through api, including Node.js, Python, http.
LongCite-glm4-9b huggingface.co is an online trial and call api platform, which integrates LongCite-glm4-9b's modeling effects, including api services, and provides a free online trial of LongCite-glm4-9b, you can try LongCite-glm4-9b online for free by clicking the link below.
zai-org LongCite-glm4-9b online free url in huggingface.co:
LongCite-glm4-9b is an open source model from GitHub that offers a free installation service, and any user can find LongCite-glm4-9b on GitHub to install. At the same time, huggingface.co provides the effect of LongCite-glm4-9b install, users can directly use LongCite-glm4-9b installed effect in huggingface.co for debugging and trial. It also supports api for free installation.