WECHSEL: Effective initialization of subword embeddings for cross-lingual transfer of monolingual language models
Paper โข 2112.06598 โข Published โข 1
How to use benjamin/gpt2-wechsel-uyghur with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="benjamin/gpt2-wechsel-uyghur") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("benjamin/gpt2-wechsel-uyghur")
model = AutoModelForCausalLM.from_pretrained("benjamin/gpt2-wechsel-uyghur")How to use benjamin/gpt2-wechsel-uyghur with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "benjamin/gpt2-wechsel-uyghur"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "benjamin/gpt2-wechsel-uyghur",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/benjamin/gpt2-wechsel-uyghur
How to use benjamin/gpt2-wechsel-uyghur with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "benjamin/gpt2-wechsel-uyghur" \
--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": "benjamin/gpt2-wechsel-uyghur",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "benjamin/gpt2-wechsel-uyghur" \
--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": "benjamin/gpt2-wechsel-uyghur",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use benjamin/gpt2-wechsel-uyghur with Docker Model Runner:
docker model run hf.co/benjamin/gpt2-wechsel-uyghur
Model trained with WECHSEL: Effective initialization of subword embeddings for cross-lingual transfer of monolingual language models.
See the code here: https://github.com/CPJKU/wechsel
And the paper here: https://arxiv.org/abs/2112.06598
| Model | PPL |
|---|---|
gpt2-wechsel-sundanese |
111.72 |
gpt2 (retrained from scratch) |
149.46 |
| Model | PPL |
|---|---|
gpt2-wechsel-scottish-gaelic |
16.43 |
gpt2 (retrained from scratch) |
19.53 |
| Model | PPL |
|---|---|
gpt2-wechsel-uyghur |
34.33 |
gpt2 (retrained from scratch) |
42.82 |
| Model | PPL |
|---|---|
gpt2-wechsel-malagasy |
14.01 |
gpt2 (retrained from scratch) |
15.93 |
See our paper for details.
Please cite WECHSEL as
@misc{minixhofer2021wechsel,
title={WECHSEL: Effective initialization of subword embeddings for cross-lingual transfer of monolingual language models},
author={Benjamin Minixhofer and Fabian Paischer and Navid Rekabsaz},
year={2021},
eprint={2112.06598},
archivePrefix={arXiv},
primaryClass={cs.CL}
}