Downloads · 30 days
0
Hemanth-thunder/indic-machine-translation-Lora-switch
indic-machine-translation-Lora-switch is a translation model from Hemanth-thunder. Use it when you need text moved from one language to another. It is set up for transformers. The card lists the license as apache-2.0.
This technique uses separate LoRA adapters for each language pair, connected to a base language model. Instead of a single, large multilingual model, this approach allows dynamic loading and unloading of specific adap…
Downloads · 30 days
0
Access
Public
Updated Feb 4, 2025
Repo size
748 MB
Likes
4
Trending 1
Click a slice to open those files.
.safetensors748 MB · 100%
From the Hugging Face model README
This technique uses separate LoRA adapters for each language pair, connected to a base language model. Instead of a single, large multilingual model, this approach allows dynamic loading and unloading of specific adapters at runtime.
How it Works:
Separate LoRA Adapters: Train a dedicated LoRA adapter for each language pair (e.g., English-Tamil, English-Hindi). Each adapter specializes in the nuances of that particular translation direction.
Base Model: A pre-trained language model (like Gemma2 2B) serves as the foundation. This model remains unchanged during the adaptation process.
Dynamic Switching: At inference time, based on the target language, the corresponding LoRA adapter's weights are loaded and multiplied with the base model's weights. This effectively "activates" the specific language expertise without modifying the core model.
Unloading: After translation, the LoRA adapter can be unloaded, returning the base model to its original state. This allows seamless switching between different languages without interference.
Advantages:
Example (Conceptual):
# Load base model
base_model = load_model("gemma2_2b")
# Load English-Tamil adapter
en_ta_adapter = load_adapter("en_ta_lora")
# Activate adapter
base_model.set_adapter(en_ta_adapter)
# Translate to Tamil
tamil_translation = base_model.translate("Hello", target_language="ta")
# Unload adapter
base_model.unload_adapter(en_ta_adapter)