dmMaze / BallonsTranslator

深度学习辅助漫画翻译工具, 支持一键机翻和简单的图像/文本编辑 | Yet another computer-aided comic/manga translation tool powered by deeplearning
GNU General Public License v3.0
2.79k stars 183 forks source link

Different Offline Translator Model #39

Open AlexBanana1248 opened 2 years ago

AlexBanana1248 commented 2 years ago

Would it be possible to add support for a pytorch model (in the form of a .pt file) instead of the .model and .bin model that is currently used, as I have another model I would like to use instead of the one provided. The sugoi offline model is being improved and it would be nice to use future improved models with the program.

I am unsure as how to achieve this myself but I would appreciate any tips on how to edit the source code to use the different model format or how to convert my model in to the model format required.

Snowad14 commented 2 years ago

I use V3.0 because this sugoi model has the best manga score (better than Levi model) and I will modify it when a new one comes out. The .bin is the same as the .pt but just faster. You can modify the provided model by replacing the .bin with your CTranslate2 converted model

AlexBanana1248 commented 2 years ago

Okay thank you for the information.

bropines commented 2 years ago

And what is this sugoi translator of yours?

AlexBanana1248 commented 2 years ago

I was just talking about the Levi model because I would like to experiment with the different models, and I was thinking for when we do get a better model how I would replace it. But seeing as they are going to be replacing them I don't need to worry about figuring out how to do it myself but I still might give it a shot.

novaexe commented 2 years ago

would be great to be able to swap models, in testing 3.3 is waay less prone to the AAAAAAAAAAHHHHHH shenanigans, don't have Levi yet so couldn't say

Snowad14 commented 2 years ago

From what I had tested on V3.3 I didn't see any difference so I preferred to take the best score but I will change for this model and I will see for Levi when it will be released in public. (No change, just reinstall via the drive link when I have done it)

novaexe commented 2 years ago

awesome 👍 yea more options the better i say 😄

dmMaze commented 2 years ago

Copy the current implemention of SugoiTranslator and rename it to something like:

@register_translator('Sugoi_pytorch')
class SugoiTranslator_pytorch(TranslatorBase):

And reimplement its _setup_translator, _translate, updateParam Please refer to https://github.com/dmMaze/BallonsTranslator/blob/master/doc/how_to_add_new_translator.md for further details.