Instructions to use LLaMAX/LLaMAX2-7B-XNLI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LLaMAX/LLaMAX2-7B-XNLI with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LLaMAX/LLaMAX2-7B-XNLI")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("LLaMAX/LLaMAX2-7B-XNLI") model = AutoModelForCausalLM.from_pretrained("LLaMAX/LLaMAX2-7B-XNLI", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LLaMAX/LLaMAX2-7B-XNLI with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LLaMAX/LLaMAX2-7B-XNLI" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LLaMAX/LLaMAX2-7B-XNLI", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/LLaMAX/LLaMAX2-7B-XNLI
- SGLang
How to use LLaMAX/LLaMAX2-7B-XNLI 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 "LLaMAX/LLaMAX2-7B-XNLI" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LLaMAX/LLaMAX2-7B-XNLI", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "LLaMAX/LLaMAX2-7B-XNLI" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LLaMAX/LLaMAX2-7B-XNLI", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use LLaMAX/LLaMAX2-7B-XNLI with Docker Model Runner:
docker model run hf.co/LLaMAX/LLaMAX2-7B-XNLI
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,53 +1,57 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
-
|
| 4 |
-
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
}
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- Multilingual
|
| 4 |
+
---
|
| 5 |
+
|
| 6 |
+
### Model Sources
|
| 7 |
+
- **Paper**: LLaMAX: Scaling Linguistic Horizons of LLM by Enhancing Translation Capabilities Beyond 100 Languages
|
| 8 |
+
- **Link**: https://arxiv.org/pdf/2407.05975
|
| 9 |
+
- **Repository**: https://github.com/CONE-MT/LLaMAX/
|
| 10 |
+
|
| 11 |
+
### Model Description
|
| 12 |
+
|
| 13 |
+
🔥 LLaMAX-7B-X-NLI is a NLI model with multilingual capability, which is fully fine-tuned the powerful multilingual model [LLaMAX-7B](https://huggingface.co/LLaMAX/LLaMAX-7B) on MultiNLI dataset.
|
| 14 |
+
|
| 15 |
+
🔥 Compared with fine-tuning Llama-2 on the same setting, LLaMAX-7B-X-CSQA improves the average accuracy up to 5.6% on the XNLI dataset.
|
| 16 |
+
|
| 17 |
+
### Experiments
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
| XNLI | Avg. | Sw | Ur | Hi | Th | Ar | Tr | El | Vi | Zh | Ru | Bg | De | Fr | Es | En |
|
| 21 |
+
|-------------------|-------|------|------|------|------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------|------|------|------|------|------|------|------|------|------|
|
| 22 |
+
| Llama2-7B-X-XNLI | 70.6 | 44.6 | 55.1 | 62.2 | 58.4 | 64.7 | 64.9 | 65.6 | 75.4 | 75.9 | 78.9 | 78.6 | 80.7 | 81.7 | 83.1 | 89.5 |
|
| 23 |
+
| LLaMAX-7B-X-XNLI | 76.2 | 66.7 | 65.3 | 69.1 | 66.2 | 73.6 | 71.8| 74.3 | 77.4 | 78.3 | 80.3 | 81.6 | 82.2 | 83.0 | 84.1 | 89.7 |
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
### Model Usage
|
| 28 |
+
|
| 29 |
+
Code Example:
|
| 30 |
+
```angular2html
|
| 31 |
+
from transformers import AutoTokenizer, LlamaForCausalLM
|
| 32 |
+
|
| 33 |
+
model = LlamaForCausalLM.from_pretrained(PATH_TO_CONVERTED_WEIGHTS)
|
| 34 |
+
tokenizer = AutoTokenizer.from_pretrained(PATH_TO_CONVERTED_TOKENIZER)
|
| 35 |
+
|
| 36 |
+
query = "Premise: She doesn’t really understand. Hypothesis: Actually, she doesn’t get it. Label:"
|
| 37 |
+
inputs = tokenizer(query, return_tensors="pt")
|
| 38 |
+
|
| 39 |
+
generate_ids = model.generate(inputs.input_ids, max_length=30)
|
| 40 |
+
tokenizer.batch_decode(generate_ids, skip_special_tokens=True, clean_up_tokenization_spaces=False)[0]
|
| 41 |
+
# => Entailment
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
### Citation
|
| 45 |
+
if our model helps your work, please cite this paper:
|
| 46 |
+
|
| 47 |
+
```
|
| 48 |
+
@misc{lu2024llamaxscalinglinguistichorizons,
|
| 49 |
+
title={LLaMAX: Scaling Linguistic Horizons of LLM by Enhancing Translation Capabilities Beyond 100 Languages},
|
| 50 |
+
author={Yinquan Lu and Wenhao Zhu and Lei Li and Yu Qiao and Fei Yuan},
|
| 51 |
+
year={2024},
|
| 52 |
+
eprint={2407.05975},
|
| 53 |
+
archivePrefix={arXiv},
|
| 54 |
+
primaryClass={cs.CL},
|
| 55 |
+
url={https://arxiv.org/abs/2407.05975},
|
| 56 |
+
}
|
| 57 |
+
```
|