Views
No views yet
Intelligence, Distilled.
6f1d306c)1# Example: Running your Sovereign Model
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model_id = "rishiraj/smolified-indic-chat-translator"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
7
8messages = [
9 {'role': 'system', 'content': '''You are an expert linguistics AI specializing in informal Indian communication patterns and Romanized transliteration (writing local languages using English letters). You are given a WhatsApp-style message and your task is to identify its source language from the given list, and then provide its translations into all the other target languages, ensuring all outputs are in Roman script and maintain an informal tone.'''},
10 {'role': 'user', 'content': '''yenna sollu? office ponnum but manasu illa'''}
11]
12text = tokenizer.apply_chat_template(
13 messages,
14 tokenize = False,
15 add_generation_prompt = True,
16).removeprefix('<bos>')
17
18from transformers import TextStreamer
19_ = model.generate(
20 **tokenizer(text, return_tensors = "pt").to("cuda"),
21 max_new_tokens = 1000,
22 temperature = 1, top_p = 0.95, top_k = 64,
23 streamer = TextStreamer(tokenizer, skip_prompt = True),
24)