Downloads · 30 days
0
moiduy04/homemade_lo_vi
homemade_lo_vi is a text generation model from moiduy04. Use it when you need the model to write or continue text. It is set up for pytorch.
Downloads · 30 days
0
Access
Public
Updated Jan 4, 2024
Repo size
2.3 GB
Likes
1
Public
Click a slice to open those files.
.pt2 GB · 98%
From the Hugging Face model README
Please use python version 3.10
Use load_config to load a .yaml config file.
Then use load_model_tokenizer to load a pretrained model and its tokenizers
from config import load_config
from load_model import load_model_tokenizer
config = load_config(file_name='config/config_final.yaml')
model, src_tokenizer, tgt_tokenizer = load_model_tokenizer(config)
Use the translate function in translate.py.
from translate import translate
from config import load_config
from load_model import load_model_tokenizer
config = load_config(file_name='config/config_final.yaml')
model, src_tokenizer, tgt_tokenizer = load_model_tokenizer(config)
text = " "
translation, attn = translate(
model, src_tokenizer, tgt_tokenizer, text,
decode_method='beam-search',
)
print(translation)
Use the train_model function in train.py to train your model.
from train import train_model
from config import load_config
config = load_config(file_name='config/config_final.yaml')
train_model(config)
If you wish to continue training/ fine-tune our model, you should
modify the num_epochs in your desired config file,
as well as read the following notes (+ is the string concat funtion):
model_foldermodel_basename + preload + .pt"preload as nullmodel_basename + _ + (current epoch) + .pt"train_model will automatically continue training the preloaded model.