Instructions to use sarvamai/sarvam-translate with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sarvamai/sarvam-translate with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="sarvamai/sarvam-translate")# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("sarvamai/sarvam-translate") model = AutoModelForMultimodalLM.from_pretrained("sarvamai/sarvam-translate", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Model parameters and prompt optimization
#11
by AadarshMaheshwari - opened
I have a few specific queries regarding the usage and behavior of Sarvam AI, particularly related to advanced settings and entity handling. Please help clarify the following points:
Advanced Settings Parameters:
Sarvam AI’s dashboard includes options like gender handling and numerical translation.
Are these parameters available and configurable at the API or code level?
If yes, is there any official documentation or resource that explains how to use these settings effectively in code?
Prompt Optimization for Special Entities:
In the Sarvam AI dashboard/playground, when input text includes email IDs or URLs, they are not translated, which is expected behavior.
However, when using the Python SDK or API, these elements sometimes get translated incorrectly.
Is this due to backend handling or preprocessing specific to the dashboard?
Alternatively, can we manually optimize the prompt in our API usage to preserve such entities during translation?
I’m looking for insights on how to manage these settings consistently across both dashboard and code-level usage.