Text Generation
Transformers
Safetensors
English
qwen2
chat
conversational
text-generation-inference
Instructions to use LL-Square/LLSquare-7B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LL-Square/LLSquare-7B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LL-Square/LLSquare-7B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LL-Square/LLSquare-7B-Instruct") model = AutoModelForCausalLM.from_pretrained("LL-Square/LLSquare-7B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LL-Square/LLSquare-7B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LL-Square/LLSquare-7B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LL-Square/LLSquare-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LL-Square/LLSquare-7B-Instruct
- SGLang
How to use LL-Square/LLSquare-7B-Instruct with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "LL-Square/LLSquare-7B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LL-Square/LLSquare-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "LL-Square/LLSquare-7B-Instruct" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LL-Square/LLSquare-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LL-Square/LLSquare-7B-Instruct with Docker Model Runner:
docker model run hf.co/LL-Square/LLSquare-7B-Instruct
lazarusrolando commited on
Update README.md
Browse files
README.md
CHANGED
|
@@ -4,7 +4,7 @@ license_link: https://huggingface.co/LL-Square/LLSquare-7B-Instruct
|
|
| 4 |
language:
|
| 5 |
- en
|
| 6 |
pipeline_tag: text-generation
|
| 7 |
-
base_model:
|
| 8 |
tags:
|
| 9 |
- chat
|
| 10 |
library_name: transformers
|
|
@@ -17,14 +17,14 @@ library_name: transformers
|
|
| 17 |
|
| 18 |
## Introduction
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
- Significantly **more knowledge** and has greatly improved capabilities in **coding** and **mathematics**, thanks to our specialized expert models in these domains.
|
| 23 |
- Significant improvements in **instruction following**, **generating long texts** (over 8K tokens), **understanding structured data** (e.g, tables), and **generating structured outputs** especially JSON. **More resilient to the diversity of system prompts**, enhancing role-play implementation and condition-setting for chatbots.
|
| 24 |
- **Long-context Support** up to 128K tokens and can generate up to 8K tokens.
|
| 25 |
- **Multilingual support** for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
|
| 26 |
|
| 27 |
-
**This repo contains the instruction-tuned 7B
|
| 28 |
- Type: Causal Language Models
|
| 29 |
- Training Stage: Pretraining & Post-training
|
| 30 |
- Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
|
|
@@ -33,17 +33,16 @@ Qwen2.5 is the latest series of Qwen large language models. For Qwen2.5, we rele
|
|
| 33 |
- Number of Layers: 28
|
| 34 |
- Number of Attention Heads (GQA): 28 for Q and 4 for KV
|
| 35 |
- Context Length: Full 131,072 tokens and generation 8192 tokens
|
| 36 |
-
- Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy
|
| 37 |
|
| 38 |
-
For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2.5/), [GitHub](https://github.com/QwenLM/Qwen2.5), and [Documentation](https://qwen.readthedocs.io/en/latest/).
|
| 39 |
|
| 40 |
## Requirements
|
| 41 |
|
| 42 |
-
The code of
|
| 43 |
|
| 44 |
With `transformers<4.37.0`, you will encounter the following error:
|
| 45 |
```
|
| 46 |
-
KeyError: '
|
| 47 |
```
|
| 48 |
|
| 49 |
## Quickstart
|
|
@@ -53,7 +52,7 @@ Here provides a code snippet with `apply_chat_template` to show you how to load
|
|
| 53 |
```python
|
| 54 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 55 |
|
| 56 |
-
model_name = "
|
| 57 |
|
| 58 |
model = AutoModelForCausalLM.from_pretrained(
|
| 59 |
model_name,
|
|
@@ -64,7 +63,7 @@ tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
| 64 |
|
| 65 |
prompt = "Give me a short introduction to large language model."
|
| 66 |
messages = [
|
| 67 |
-
{"role": "system", "content": "You are
|
| 68 |
{"role": "user", "content": prompt}
|
| 69 |
]
|
| 70 |
text = tokenizer.apply_chat_template(
|
|
@@ -103,31 +102,31 @@ For supported frameworks, you could add the following to `config.json` to enable
|
|
| 103 |
```
|
| 104 |
|
| 105 |
For deployment, we recommend using vLLM.
|
| 106 |
-
Please refer to our [Documentation](https://
|
| 107 |
Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts**.
|
| 108 |
We advise adding the `rope_scaling` configuration only when processing long contexts is required.
|
| 109 |
|
| 110 |
## Evaluation & Performance
|
| 111 |
|
| 112 |
-
Detailed evaluation results are reported in this [📑 blog](https://
|
| 113 |
|
| 114 |
-
For requirements on GPU memory and the respective throughput, see results [here](https://
|
| 115 |
|
| 116 |
## Citation
|
| 117 |
|
| 118 |
If you find our work helpful, feel free to give us a cite.
|
| 119 |
|
| 120 |
```
|
| 121 |
-
@misc{
|
| 122 |
-
title = {
|
| 123 |
-
url = {https://
|
| 124 |
-
author = {
|
| 125 |
month = {September},
|
| 126 |
year = {2024}
|
| 127 |
}
|
| 128 |
|
| 129 |
-
@article{
|
| 130 |
-
title={
|
| 131 |
author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
|
| 132 |
journal={arXiv preprint arXiv:2407.10671},
|
| 133 |
year={2024}
|
|
|
|
| 4 |
language:
|
| 5 |
- en
|
| 6 |
pipeline_tag: text-generation
|
| 7 |
+
base_model: LL-Square/LLSquare-7B-Instruct-7B
|
| 8 |
tags:
|
| 9 |
- chat
|
| 10 |
library_name: transformers
|
|
|
|
| 17 |
|
| 18 |
## Introduction
|
| 19 |
|
| 20 |
+
LLSquare-7B-Instruct is the base model of LL-Square large language models. For LLSquare-7B-Instruct, we release a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters. LLSquare-7B-Instruct brings the following improvements upon LL-Square2:
|
| 21 |
|
| 22 |
- Significantly **more knowledge** and has greatly improved capabilities in **coding** and **mathematics**, thanks to our specialized expert models in these domains.
|
| 23 |
- Significant improvements in **instruction following**, **generating long texts** (over 8K tokens), **understanding structured data** (e.g, tables), and **generating structured outputs** especially JSON. **More resilient to the diversity of system prompts**, enhancing role-play implementation and condition-setting for chatbots.
|
| 24 |
- **Long-context Support** up to 128K tokens and can generate up to 8K tokens.
|
| 25 |
- **Multilingual support** for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
|
| 26 |
|
| 27 |
+
**This repo contains the instruction-tuned 7B LLSquare-7B-Instruct model**, which has the following features:
|
| 28 |
- Type: Causal Language Models
|
| 29 |
- Training Stage: Pretraining & Post-training
|
| 30 |
- Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
|
|
|
|
| 33 |
- Number of Layers: 28
|
| 34 |
- Number of Attention Heads (GQA): 28 for Q and 4 for KV
|
| 35 |
- Context Length: Full 131,072 tokens and generation 8192 tokens
|
| 36 |
+
- Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy LLSquare-7B-Instruct for handling long texts.
|
| 37 |
|
|
|
|
| 38 |
|
| 39 |
## Requirements
|
| 40 |
|
| 41 |
+
The code of LLSquare-7B-Instruct has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
|
| 42 |
|
| 43 |
With `transformers<4.37.0`, you will encounter the following error:
|
| 44 |
```
|
| 45 |
+
KeyError: 'LL-Square2'
|
| 46 |
```
|
| 47 |
|
| 48 |
## Quickstart
|
|
|
|
| 52 |
```python
|
| 53 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 54 |
|
| 55 |
+
model_name = "LL-Square/LLSquare-7B-Instruct-7B-Instruct"
|
| 56 |
|
| 57 |
model = AutoModelForCausalLM.from_pretrained(
|
| 58 |
model_name,
|
|
|
|
| 63 |
|
| 64 |
prompt = "Give me a short introduction to large language model."
|
| 65 |
messages = [
|
| 66 |
+
{"role": "system", "content": "You are LL-Square, created by Alibaba Cloud. You are a helpful assistant."},
|
| 67 |
{"role": "user", "content": prompt}
|
| 68 |
]
|
| 69 |
text = tokenizer.apply_chat_template(
|
|
|
|
| 102 |
```
|
| 103 |
|
| 104 |
For deployment, we recommend using vLLM.
|
| 105 |
+
Please refer to our [Documentation](https://LL-Square.readthedocs.io/en/latest/deployment/vllm.html) for usage if you are not familar with vLLM.
|
| 106 |
Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts**.
|
| 107 |
We advise adding the `rope_scaling` configuration only when processing long contexts is required.
|
| 108 |
|
| 109 |
## Evaluation & Performance
|
| 110 |
|
| 111 |
+
Detailed evaluation results are reported in this [📑 blog](https://LL-Squarelm.github.io/blog/LLSquare-7B-Instruct/).
|
| 112 |
|
| 113 |
+
For requirements on GPU memory and the respective throughput, see results [here](https://LL-Square.readthedocs.io/en/latest/benchmark/speed_benchmark.html).
|
| 114 |
|
| 115 |
## Citation
|
| 116 |
|
| 117 |
If you find our work helpful, feel free to give us a cite.
|
| 118 |
|
| 119 |
```
|
| 120 |
+
@misc{LLSquare-7B-Instruct,
|
| 121 |
+
title = {LLSquare-7B-Instruct: A Party of Foundation Models},
|
| 122 |
+
url = {https://LL-Squarelm.github.io/blog/LLSquare-7B-Instruct/},
|
| 123 |
+
author = {LL-Square Team},
|
| 124 |
month = {September},
|
| 125 |
year = {2024}
|
| 126 |
}
|
| 127 |
|
| 128 |
+
@article{LL-Square2,
|
| 129 |
+
title={LL-Square2 Technical Report},
|
| 130 |
author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
|
| 131 |
journal={arXiv preprint arXiv:2407.10671},
|
| 132 |
year={2024}
|