Instructions to use webbigdata/ALMA-7B-Ja-V2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use webbigdata/ALMA-7B-Ja-V2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="webbigdata/ALMA-7B-Ja-V2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("webbigdata/ALMA-7B-Ja-V2") model = AutoModelForCausalLM.from_pretrained("webbigdata/ALMA-7B-Ja-V2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use webbigdata/ALMA-7B-Ja-V2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "webbigdata/ALMA-7B-Ja-V2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "webbigdata/ALMA-7B-Ja-V2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/webbigdata/ALMA-7B-Ja-V2
- SGLang
How to use webbigdata/ALMA-7B-Ja-V2 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 "webbigdata/ALMA-7B-Ja-V2" \ --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": "webbigdata/ALMA-7B-Ja-V2", "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 "webbigdata/ALMA-7B-Ja-V2" \ --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": "webbigdata/ALMA-7B-Ja-V2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use webbigdata/ALMA-7B-Ja-V2 with Docker Model Runner:
docker model run hf.co/webbigdata/ALMA-7B-Ja-V2
New Translation model released.
C3TR-Adapter is the QLoRA adapter for google/gemma-7b.
Despite the 4-bit quantization, the memory GPU requirement has increased to 8.1 GB.
However, it is possible to run it with the free version of Colab and the performance is much improved!
webbigdata/ALMA-7B-Ja-V2
ALMA-7B-Ja-V2ใฏๆฅๆฌ่ชใใ่ฑ่ชใ่ฑ่ชใใๆฅๆฌ่ชใฎ็ฟป่จณใๅฏ่ฝใชๆฉๆขฐ็ฟป่จณใขใใซใงใใ
The ALMA-7B-Ja-V2 is a machine translation model capable of translating from Japanese to English and English to Japanese.
ALMA-7B-Ja-V2ใฏไปฅๅใฎใขใใซ(ALMA-7B-Ja)ใซๆดใซๅญฆ็ฟใ่ฟฝๅ ใใๆง่ฝใๅไธใใฆใใพใใ
The ALMA-7B-Ja-V2 adds further learning to the previous model (ALMA-7B-Ja) and improves performance.
ๆฅๆฌ่ชใจ่ฑ่ช้ใซๅ ใใฆใใใฎใขใใซใฏไปฅไธใฎ่จ่ช้ใฎ็ฟป่จณ่ฝๅใๆใฃใฆใใพใใใๆฅ่ฑใ่ฑๆฅ็ฟป่จณใไธป็ฎ็ใซใใฆใใพใใ
In addition to translation between Japanese and English, this model also has the ability to translate between the following languages, but is primarily intended for Japanese-English and English-Japanese translation.
- ใใคใ่ช German(de) and ่ฑ่ช English(en)
- ไธญๅฝ่ช Chinese(zh) and ่ฑ่ช English(en)
- ใขใคในใฉใณใ่ช Icelandic(is) and ่ฑ่ช English(en)
- ใใงใณ่ช Czech(cs) and ่ฑ่ช English(en)
ใใณใใใผใฏ็ตๆ
ไปฅไธใฎไธ็จฎใฎๆๆจใไฝฟใฃใฆ็ฟป่จณๆง่ฝใ็ขบ่ชใใพใใใ
The following three metrics were used to check translation performance.
ๆฐๅญใๅคงใใใปใฉๆง่ฝใ่ฏใไบใๆๅณใใพใใ
The higher the number, the better the performance.
BLEU
็ฟป่จณใใญในใใๅ
ใฎใใญในใใซใฉใใ ใไผผใฆใใใใ่ฉไพกใใๆๆจใงใใใใใใๅ่ชใฎๅบ็พ้ ปๅบฆใ ใใ่ฆใฆใใใใใ่ช้ ใฎๆญฃ็ขบใใๆใฎๆตๆขใใๅๅใซ่ฉไพกใงใใชใใจใใๅผฑ็นใใใใพใ
A metric that evaluates how similar the translated text is to the original text. However, since it mainly looks at the frequency of word appearances, it may not effectively evaluate the accuracy of word order or the fluency of sentences.
chrF++
ๆๅญใฎ็ตใฟๅใใใฎไธ่ดๅบฆใจ่ช้ ใซๅบใฅใใฆใ็ฟป่จณใฎๆญฃ็ขบใใ่ฉไพกใใๆๆจใงใใๅผฑ็นใจใใฆใฏใ้ทใๆ็ซ ใฎ่ฉไพกใซใฏไธๅใใงใใใใจใๆใใใใพใใ
A method to evaluate translation accuracy based on how well character combinations match and the order of words. A drawback is that it might not be suitable for evaluating longer sentences.
comet
ๆฉๆขฐๅญฆ็ฟใขใใซใไฝฟใฃใฆ็ฟป่จณใฎๅ่ณชใ่ชๅ็ใซ่ฉไพกใใใใใฎใใผใซใไบบ้ใฎไธป่ฆณ็่ฉไพกใซ่ฟใใจ่จใใใฆใใพใใใๆฉๆขฐๅญฆ็ฟใใผในใงใใใใใๅ
ใ
ใฎใขใใซใๅญฆ็ฟใซไฝฟใฃใใใผใฟใซๅคงใใไพๅญใใใจใใๅผฑ็นใใใใพใใ
A tool that uses machine learning models to automatically evaluate the quality of translations, although it is said to be similar to the evaluation ratings performed by humans. Because it is machine learning based, it has the weakness that the original model is highly dependent on the data used for training.
vs. NLLB-200
Meta็คพใฎ200่จ่ชไปฅไธใฎ็ฟป่จณใซๅฏพๅฟใใ่ถ
ๅค่จ่ชๅฏพๅฟๆฉๆขฐ็ฟป่จณใขใใซNLLB-200ใทใชใผใบใจๆฏ่ผใใใใณใใใผใฏ็ตๆใฏไปฅไธใงใใ
Benchmark results compared to Meta's NLLB-200 series of super multilingual machine translation models, which support translations in over 200 languages, are shown below.
| Model Name | file size | E->J chrf++/F2 | E->J comet | J->E chrf++/F2 | J->E comet |
|---|---|---|---|---|---|
| NLLB-200-Distilled | 2.46GB | 23.6/- | - | 50.2/- | - |
| NLLB-200-Distilled | 5.48GB | 25.4/- | - | 54.2/- | - |
| NLLB-200 | 5.48GB | 24.2/- | - | 53.6/- | - |
| NLLB-200 | 17.58GB | 25.2/- | - | 55.1/- | - |
| NLLB-200 | 220.18GB | 27.9/33.2 | 0.8908 | 55.8/59.8 | 0.8792 |
previous our model(ALMA-7B-Ja)
| Model Name | file size | E->J chrf++/F2 | E->J comet | J->E chrf++/F2 | J->E comet |
|---|---|---|---|---|---|
| webbigdata-ALMA-7B-Ja-q4_K_S | 3.6GB | -/24.2 | 0.8210 | -/54.2 | 0.8559 |
| ALMA-7B-Ja-GPTQ-Ja-En | 3.9GB | -/30.8 | 0.8743 | -/60.9 | 0.8743 |
| ALMA-Ja(Ours) | 13.48GB | -/31.8 | 0.8811 | -/61.6 | 0.8773 |
ALMA-7B-Ja-V2
| Model Name | file size | E->J chrf++/F2 | E->J comet | J->E chrf++/F2 | J->E comet |
|---|---|---|---|---|---|
| ALMA-7B-Ja-V2-GPTQ-Ja-En | 3.9GB | -/33.0 | 0.8818 | -/62.0 | 0.8774 |
| ALMA-Ja-V2(Ours) | 13.48GB | -/33.9 | 0.8820 | -/63.1 | 0.8873 |
| ALMA-Ja-V2-Lora(Ours) | 13.48GB | -/33.7 | 0.8843 | -/61.1 | 0.8775 |
ALMA-7B-Ja-V2ใๆงใ
ใชใธใฃใณใซใฎๆ็ซ ใ็พๅฎไธ็ใฎใขใใชใฑใผใทใงใณใจๆฏ่ผใใ็ตๆใฏไปฅไธใงใใ
Here are the results of a comparison of various genres of writing with the actual application.
ๆฟๅบใฎๅ ฌๅผๆ็ซ Government Official Announcements
| e->j chrF2++ | e->j BLEU | e->j comet | j->e chrF2++ | j->e BLEU | j->e comet | |
|---|---|---|---|---|---|---|
| ALMA-7B-Ja-V2-GPTQ-Ja-En | 25.3 | 15.00 | 0.8848 | 60.3 | 26.82 | 0.6189 |
| ALMA-Ja-V2 | 27.2 | 15.60 | 0.8868 | 58.5 | 29.27 | 0.6155 |
| ALMA-7B-Ja-V2-Lora | 24.5 | 13.58 | 0.8670 | 50.7 | 21.85 | 0.6196 |
| SeamlessM4T | 27.3 | 16.76 | 0.9070 | 54.2 | 25.76 | 0.5656 |
| gpt-3.5 | 34.6 | 28.33 | 0.8895 | 74.5 | 49.20 | 0.6382 |
| gpt-4.0 | 36.5 | 28.07 | 0.9255 | 62.5 | 33.63 | 0.6320 |
| google-translate | 43.5 | 35.37 | 0.9181 | 62.7 | 29.22 | 0.6446 |
| deepl | 43.5 | 35.74 | 0.9301 | 60.1 | 27.40 | 0.6389 |
ๅคๅ ธๆๅญฆ Classical Literature
| e->j chrF2++ | e->j BLEU | e->j comet | j->e chrF2++ | j->e BLEU | j->e comet | |
|---|---|---|---|---|---|---|
| ALMA-7B-Ja-V2-GPTQ-Ja-En | 11.8 | 7.24 | 0.6943 | 31.9 | 9.71 | 0.5617 |
| ALMA-Ja-V2 | 10.7 | 4.93 | 0.7202 | 32.9 | 10.52 | 0.5638 |
| ALMA-7B-Ja-V2-Lora | 12.3 | 7.25 | 0.7076 | 32.5 | 11.14 | 0.5441 |
| gpt-3.5 | - | - | 0.6367 | 69.3 | 46.34 | 0.4922 |
| gpt-4.0 | 13.3 | 8.33 | 0.7074 | 44.3 | 23.75 | 0.5518 |
| deepl | 14.4 | 9.18 | 0.7149 | 34.6 | 10.68 | 0.5787 |
| google-translate | 13.5 | 8.57 | 0.7432 | 31.7 | 7.94 | 0.5856 |
ไบๆฌกๅตไฝ Fanfiction
| e->j chrF2++ | e->j BLEU | e->j comet | j->e chrF2++ | j->e BLEU | j->e comet | |
|---|---|---|---|---|---|---|
| ALMA-7B-Ja-V2-GPTQ-Ja-En | 27.6 | 18.28 | 0.8643 | 52.1 | 24.58 | 0.6106 |
| ALMA-Ja-V2 | 20.4 | 8.45 | 0.7870 | 48.7 | 23.06 | 0.6050 |
| ALMA-7B-Ja-V2-Lora | 23.9 | 18.55 | 0.8634 | 55.6 | 29.91 | 0.6093 |
| SeamlessM4T | 25.5 | 19.97 | 0.8657 | 42.2 | 14.39 | 0.5554 |
| gpt-3.5 | 31.2 | 23.37 | 0.9001 | - | - | 0.5948 |
| gpt-4.0 | 30.7 | 24.31 | 0.8848 | 53.9 | 24.89 | 0.6163 |
| google-translate | 32.4 | 25.36 | 0.8968 | 58.5 | 29.88 | 0.6022 |
| deepl | 33.5 | 28.38 | 0.9094 | 60.0 | 31.14 | 0.6124 |
ใตใณใใซใณใผใ sample code
Googleใฎ็กๆWebใใผใซใงใใColabใไฝฟใใจALMA_7B_Ja_V2ใฎๆง่ฝใ็ฐกๅใซ็ขบใใใไบใใงใใพใใ
Using Colab, Google's free web tool, you can easily verify the performance of ALMA_7B_Ja_V2.
ใใฎไปใฎ็ Other Version
llama.cpp
llama.cppใฎไธปใช็ฎ็ใฏMacBookไธใง4ใใใๆดๆฐ้ๅญๅใไฝฟ็จใใฆ LLaMA ใขใใซใๅฎ่กใใไบใงใใ
The main purpose of llama.cpp is to run the LLaMA model using 4-bit integer quantization on a MacBook.
4ใใใ้ๅญๅใซไผดใใๆง่ฝใฏใใไฝไธใใพใใใmmngaใใใไฝๆใใฆใใใwebbigdata-ALMA-7B-Ja-V2-ggufใไฝฟใใจMacใGPUใๆญ่ผใใฆใใชใWindowsใLinuxใงๆฌใขใใซใๅใใไบใใงใใพใใ
Although performance is somewhat reduced with 4-bit quantization, webbigdata-ALMA-7B-Ja-V2-gguf, created by mmnga, can be used to run this model on Mac, Windows and Linux without a GPU.
GPU็ก็ใฎColabใงๅใใใตใณใใซใฏใใกใใงใใ Here is Colab(without GPU) sample code.
GPTQ
GPTQใฏใขใใซใตใคใบใๅฐใใใใๆๆณ(้ๅญๅใจใใใพใ)ใงใใ
GPTQ is a technique (called quantization) that reduces model size.ใใ
ALMA-7B-Ja-V2-GPTQ-Ja-EnใฏGPTQ้ๅญๅ็ใงใใขใใซใตใคใบ(3.9GB)ใจใกใขใชไฝฟ็จ้ใๅๆธใใ้ๅบฆใๅไธใใฆใใพใใ
ALMA-7B-Ja-V2-GPTQ-Ja-En is a quantized GPTQ version, which reduces model size (3.9 GB) and memory usage and increases speed.
ใใ ใใๆง่ฝใฏๅฐใ่ฝใกใฆใใพใใพใใใพใใๆฅๆฌ่ชใจ่ฑ่ชไปฅๅคใฎ่จ่ชใธใฎ็ฟป่จณ่ฝๅใฏ่ใใไฝไธใใฆใใใฏใใงใใ
However, performance is slightly reduced. Also, the ability to translate into languages other than Japanese and English should be significantly reduced.
Sample Code For Free Colab webbigdata/ALMA-7B-Ja-V2-GPTQ-Ja-En
ใใกใคใซๅ จไฝใไธๅบฆใซ็ฟป่จณใใใๅ ดๅใฏใไปฅไธใฎColabใใ่ฉฆใใใ ใใใ If you want to translate the entire txt file at once, try Colab below.
ALMA_7B_Ja_GPTQ_Ja_En_batch_translation_sample
ALMA (Advanced Language Model-based trAnslator) is an LLM-based translation model, which adopts a new translation model paradigm: it begins with fine-tuning on monolingual data and is further optimized using high-quality parallel data. This two-step fine-tuning process ensures strong translation performance. Please find more details in their paper.
@misc{xu2023paradigm,
title={A Paradigm Shift in Machine Translation: Boosting Translation Performance of Large Language Models},
author={Haoran Xu and Young Jin Kim and Amr Sharaf and Hany Hassan Awadalla},
year={2023},
eprint={2309.11674},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
Original Model ALMA-7B. (26.95GB)
Prevous Model ALMA-7B-Ja. (13.3 GB)
about this work
- This work was done by : webbigdata.
- Downloads last month
- 99
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "webbigdata/ALMA-7B-Ja-V2"# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "webbigdata/ALMA-7B-Ja-V2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'