Translate text between languages using a GGUF language model.
How it works
Loads a GGUF model via inference.LoadFile
Constructs a translation prompt with source and target languages
Generates the translation
Prints the original text and its translation
Works best with multilingual models such as Qwen 2.5, Gemma 3, or Llama 3.
Usage
go build -o translation ./examples/translation/
# English to French (default)
./translation --model path/to/model.gguf --text "Hello, world!"
# French to English
./translation --model path/to/model.gguf --text "Bonjour le monde" --source French --target English
# English to Spanish with GPU
./translation --model path/to/model.gguf --device cuda --text "Good morning" --target Spanish
Command translation demonstrates text translation using a GGUF language model.
It translates text between languages by prompting the model with a translation
instruction. Works best with multilingual models (Qwen, Gemma, Llama 3).
Usage:
go build -o translation ./examples/translation/
./translation --model path/to/model.gguf --text "Hello, world!" --target French
./translation --model path/to/model.gguf --text "Bonjour le monde" --source French --target English