gpt2_tiny_zh-hk-shikoto

作者 jed351 · 下载 0 · 点赞 0 · 更新 2023-11-01

generated_from_trainer

gpt2-shikoto

This model was trained on a dataset I obtained from an online novel site. Please be aware that the stories (training data) might contain inappropriate content. This model is intended for research purposes only.

The base model can be found here, which was obtained by patching a GPT2 Chinese model and its tokenizer with Cantonese characters. Refer to the base model for info on the patching process.

Training procedure

Please refer to the script provided by Huggingface.

The model was trained for 400,000 steps on 2 NVIDIA Quadro RTX6000 for around 15 hours at the Research Computing Services of Imperial College London.

Training hyperparameters

The following hyperparameters were used during training:

Training results

How to use it?

from transformers import AutoTokenizer
from transformers import TextGenerationPipeline, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("jed351/gpt2-tiny-zh-hk")
model = AutoModelForCausalLM.from_pretrained("jed351/gpt2_tiny_zh-hk-shikoto")

# try messing around with the parameters
generator = TextGenerationPipeline(model, tokenizer, 
                                   max_new_tokens=200, 
                                   no_repeat_ngram_size=3) #, device=0) #if you have a GPU

input_string = "your input" 

output = generator(input_string)
string = output[0]['generated_text'].replace(' ', '')
print(string)

Framework versions