Instructions to use gshbao/MT-explain with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use gshbao/MT-explain with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("../../.models/LexMatcher_8B") model = PeftModel.from_pretrained(base_model, "gshbao/MT-explain") - Notebooks
- Google Colab
- Kaggle
| library_name: peft | |
| base_model: Lemoooon/LexMatcher_8B | |
| language: | |
| - de | |
| - en | |
| tags: | |
| - machine-translation | |
| - lora | |
| - terminology | |
| - glossary | |
| - lexmatcher | |
| - vllm | |
| license: apache-2.0 | |
| # MT-explain: LoRA Adapter for Terminology-Aware Machine Translation | |
| A specialized LoRA adapter that **generates a terminology list (术语表) before producing the final translation** for high-accuracy, consistent machine translation. | |
| ## Model Details | |
| - **Model Type**: LoRA Adapter for LLMs | |
| - **Base Model**: [LexMatcher_8B](https://huggingface.co/Lemoooon/LexMatcher_8B) | |
| - **Current Language Support**: German → English (De-En), Chinese → English (Zh-En) | |
| - **Core Function**: Terminology glossary generation + final translation | |
| - **Inference Engine**: Optimized for vLLM with LoRA enabled | |
| ## Model Description | |
| MT-explain is a fine-tuned LoRA adapter built on top of LexMatcher_8B. It follows a unique two-step generation process: | |
| 1. First, generate a terminology list for the input source text | |
| 2. Then, generate the final translation using the terminology for consistency | |
| This ensures domain-specific terms, proper nouns, and technical vocabulary are translated accurately and consistently. | |
| ## Deployment & Inference Guide | |
| ### 1. Prepare Local Files | |
| Download both the base model and adapter to your local machine: | |
| - Base model path: `./LexMatcher_8B` | |
| - LoRA adapter path: `./MT-explain` | |
| ### 2. Install Dependencies | |
| ```bash | |
| pip install vllm>=0.4.0 transformers peft torch | |
| ``` | |
| ### 3. Start vLLM Server (with LoRA) | |
| Run this exact command: | |
| ``` | |
| vllm serve ./LexMatcher_8B \ | |
| --host 0.0.0.0 \ | |
| --port 8000 \ | |
| --dtype auto \ | |
| --enable-lora \ | |
| --lora-modules my-lora=./MT-explain \ | |
| --gpu-memory-utilization 0.90 \ | |
| --max-model-len 1024 | |
| ``` | |
| ### 4. Test Inference | |
| The model will automatically output:Terminology List → Final Translation | |