Skip to content

folk85/project_translator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

translator

Используем пакеты transformers , pytorch и другие.

Simple run predict for translator OPUS:

translator import OPUSModel

tr = OPUSModel("Helsinki-NLP/opus-mt-en-ru")

output = tr.predict("My name is Sergey and I live in Stockgolm")
#  '<pad> Меня зовут Сергей и я живу в России.'
print(output)

input_text = "My name is Wolfgang and I live in Berlin"                                                                                                     

target_text = "Меня зовут Вольфганг и я живу в Берлине."                                                                                                    

loss = tr.loss(input_text=input_text, target_text=target_text)                                                                                              

print(f"Loss: {loss}")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%