airesearch/scb_mt_enth_2020
Updated • 189 • 10
How to use ping98k/gemma-7b-translator-0.4 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="ping98k/gemma-7b-translator-0.4") # pip install -U transformers accelerate
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("ping98k/gemma-7b-translator-0.4")
model = AutoModelForCausalLM.from_pretrained("ping98k/gemma-7b-translator-0.4", device_map="auto")How to use ping98k/gemma-7b-translator-0.4 with llama.cpp:
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf ping98k/gemma-7b-translator-0.4:Q4_K_M # Run inference directly in the terminal: llama cli -hf ping98k/gemma-7b-translator-0.4:Q4_K_M
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf ping98k/gemma-7b-translator-0.4:Q4_K_M # Run inference directly in the terminal: llama cli -hf ping98k/gemma-7b-translator-0.4:Q4_K_M
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf ping98k/gemma-7b-translator-0.4:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf ping98k/gemma-7b-translator-0.4:Q4_K_M
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf ping98k/gemma-7b-translator-0.4:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf ping98k/gemma-7b-translator-0.4:Q4_K_M
docker model run hf.co/ping98k/gemma-7b-translator-0.4:Q4_K_M
How to use ping98k/gemma-7b-translator-0.4 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "ping98k/gemma-7b-translator-0.4"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ping98k/gemma-7b-translator-0.4",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/ping98k/gemma-7b-translator-0.4:Q4_K_M
How to use ping98k/gemma-7b-translator-0.4 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "ping98k/gemma-7b-translator-0.4" \
--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": "ping98k/gemma-7b-translator-0.4",
"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 "ping98k/gemma-7b-translator-0.4" \
--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": "ping98k/gemma-7b-translator-0.4",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use ping98k/gemma-7b-translator-0.4 with Ollama:
ollama run hf.co/ping98k/gemma-7b-translator-0.4:Q4_K_M
How to use ping98k/gemma-7b-translator-0.4 with Docker Model Runner:
docker model run hf.co/ping98k/gemma-7b-translator-0.4:Q4_K_M
How to use ping98k/gemma-7b-translator-0.4 with Lemonade:
# Download Lemonade from https://lemonade-server.ai/ lemonade pull ping98k/gemma-7b-translator-0.4:Q4_K_M
lemonade run user.gemma-7b-translator-0.4-Q4_K_M
lemonade list
fix model generate html code by remove html tag from version 0.3
prompt
<bos>[| start_original |]
ถ้าข้างนอกอุณหภูมิ 15 องศาเซลเซียส ควรใส่เสื้อกันหนาวหรือไม่[| end_original |]
[| start_translate to=en |]
Should I wear a jacket if the temperature is 15 degrees Celsius outside?[| end_translate |]<eos>
<bos>[| start_original |]
You will learn conversation, reading and writing at each level.[| end_original |]
[| start_translate to=th |]
คุณจะเรียนการสนทนา การอ่านและการเขียนในแต่ละระดับ[| end_translate |]<eos>
translate is usable when have short sentence
<bos>[| start_original |]
ตำราเรียน (อังกฤษ: Textbook) คือหนังสือที่ใช้ในการศึกษาหาความรู้จากวิชาต่าง ๆ
ผู้คนมักใช้ตำราเรียนในการเรียนรู้ข้อเท็จจริงและวิธีการที่เกี่ยวข้องกับรายวิชานั้น ๆ
ในบางครั้งตำราเรียนมักมีคำถามเพื่อทดสอบความรู้และความเข้าใจของผู้อ่าน
ตำราเรียนจะถูกผลิตจากความต้องการของสถาบันการศึกษา
ตำราเรียนส่วนมากมักมีลักษณะเป็นสิ่งพิมพ์
แต่ในปัจจุบันพบว่าหลาย ๆ ตำราเรียนสามารถเข้าถึงได้โดยการออนไลน์ ในรูปแบบของหนังสืออิเล็กทรอนิกส์[| end_original |]
[| start_translate to=en |]
Textbooks are used to learn facts and how to apply them in a particular subject.
In some cases textbooks contain questions to test the reader's knowledge and understanding of the subject matter.
Textbooks are produced to meet the needs of educational institutions.
Most textbooks are in print form.
However, many textbooks are now available online in e-book form.[| end_translate |]<eos>
but when use with long sentence it will drop some of it
<bos>[| start_original |]
ตำราเรียน (อังกฤษ: Textbook) คือหนังสือที่ใช้ในการศึกษาหาความรู้จากวิชาต่าง ๆ ผู้คนมักใช้ตำราเรียนในการเรียนรู้ข้อเท็จจริงและวิธีการที่เกี่ยวข้องกับรายวิชานั้น ๆ ในบางครั้งตำราเรียนมักมีคำถามเพื่อทดสอบความรู้และความเข้าใจของผู้อ่าน ตำราเรียนจะถูกผลิตจากความต้องการของสถาบันการศึกษา ตำราเรียนส่วนมากมักมีลักษณะเป็นสิ่งพิมพ์ แต่ในปัจจุบันพบว่าหลาย ๆ ตำราเรียนสามารถเข้าถึงได้โดยการออนไลน์ ในรูปแบบของหนังสืออิเล็กทรอนิกส์[| end_original |]
[| start_translate to=en |]
A textbook is a book used to study a particular subject. People use textbooks to learn facts and methods related to a particular subject. Textbooks often contain questions to test a reader's knowledge and understanding of the subject. Textbooks are produced to meet the needs of a particular educational institution.[| end_translate |]<eos>