CoolFace
Apppublic

CalebKoster/Translation_Note_Alignment

sourceHugging Faceupdated 3y agoView on Hugging Face
0likes
english_note_to_hindi.py35 linesDownload Raw Back to tests
1import guidance2from guidance import models, select, gen, system, user, assistant, one_or_more3from openai import OpenAI4 5 6model_path = 'models/neural-chat-7b-v3-3.Q2_K.gguf'7llm = models.LlamaCpp(model_path, n_gpu_layers=1)8# llm = models.OpenAI("gpt-4")9 10 11verse = 'Blessed be the God and Father of our Lord Jesus Christ, who has blessed us in Christ with every spiritual blessing in the heavenly places,'12hin_verse = 'हमारे प्रभु यीशु मसीह का पिता और परमेश्वर धन्य हो। उसने हमें मसीह के रूप में स्वर्ग के क्षेत्र में हर तरह के आशीर्वाद दिये हैं।'13greek_term = 'ἐν Χριστῷ'14translation_note = 'illustrates the intimate union between believers and Christ. The preposition ἐν (in) goes beyond physical location, indicating a profound spiritual reality. Translators need to convey the concept of being "in Christ" as being part of a new creation, identity, and living within the sphere of Christ\'s influence and lordship.'15note = 'hey'16 17# OpenAI implementation18 19# with system():20#     lm = llm + "You are an expert at translating into Hindi."21 22# with user():23#     lm += "Translate the following translation note into Hindi: \n" + translation_note24 25# with assistant():26#     lm += gen(max_tokens=1000)27 28# print(lm)29 30# Neural Chat implementation31 32lm = llm + f"Translate the following into Hindi:\n {translation_note}" 33lm += gen('hin_note', max_tokens=400)34print(lm)35print(f"Translation note: {lm['hin_note']}")