NilanE/ParallelFiction-Ja_En-100k
Viewer • Updated • 106k • 122 • 82
How to use mpasila/JP-EN-Translator-2K-steps-7B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="mpasila/JP-EN-Translator-2K-steps-7B") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("mpasila/JP-EN-Translator-2K-steps-7B")
model = AutoModelForCausalLM.from_pretrained("mpasila/JP-EN-Translator-2K-steps-7B", device_map="auto")How to use mpasila/JP-EN-Translator-2K-steps-7B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "mpasila/JP-EN-Translator-2K-steps-7B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "mpasila/JP-EN-Translator-2K-steps-7B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/mpasila/JP-EN-Translator-2K-steps-7B
How to use mpasila/JP-EN-Translator-2K-steps-7B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "mpasila/JP-EN-Translator-2K-steps-7B" \
--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": "mpasila/JP-EN-Translator-2K-steps-7B",
"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 "mpasila/JP-EN-Translator-2K-steps-7B" \
--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": "mpasila/JP-EN-Translator-2K-steps-7B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use mpasila/JP-EN-Translator-2K-steps-7B with Docker Model Runner:
docker model run hf.co/mpasila/JP-EN-Translator-2K-steps-7B
Experimental model, may not perform that well. Dataset used is a modified version of NilanE/ParallelFiction-Ja_En-100k.
After training with an 8k context length it didn't appear to improve performance much at all. Not sure if I should keep training it (which is costly) or if I should fix some issues with the dataset (like it starting with Ch or Chapter) or I go back to finetuning Finnish models.
Below is a translation task, paired with an input that provides further context. Write a response that appropriately completes the request.
### Instruction:
{}
### Input:
{}
### Response:
{}
This mistral model was trained 2x faster with Unsloth and Huggingface's TRL library.