Instructions to use NiuTrans/LMT-60-4B-Base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NiuTrans/LMT-60-4B-Base with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # pip install "transformers<5.0.0" from transformers import pipeline pipe = pipeline("translation", model="NiuTrans/LMT-60-4B-Base")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("NiuTrans/LMT-60-4B-Base") model = AutoModelForCausalLM.from_pretrained("NiuTrans/LMT-60-4B-Base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -103,7 +103,7 @@ model = AutoModelForCausalLM.from_pretrained(model_name)
|
|
| 103 |
|
| 104 |
prompt = "Translate the following text from English into Chinese.
|
| 105 |
English: The concept came from China where plum blossoms were the flower of choice.
|
| 106 |
-
Chinese:
|
| 107 |
messages = [{"role": "user", "content": prompt}]
|
| 108 |
text = tokenizer.apply_chat_template(
|
| 109 |
messages,
|
|
|
|
| 103 |
|
| 104 |
prompt = "Translate the following text from English into Chinese.
|
| 105 |
English: The concept came from China where plum blossoms were the flower of choice.
|
| 106 |
+
Chinese:"
|
| 107 |
messages = [{"role": "user", "content": prompt}]
|
| 108 |
text = tokenizer.apply_chat_template(
|
| 109 |
messages,
|