This is a horoscope generating code
This code was made by EdvardOlsen
The generator is based on fine-tuning model GPT-2 from OpenAI (HuggingFace realization) library
The dataset was taken from here
To install clone this repo and run chmod 777 setup.sh && ./setup.sh
To train the model run chmod 777 train.sh && ./train.sh
Make sure to clone the transformers repo
if you want to run python script, run generate.py
or use telegram_bot.py
>>> def generateHoro(raw_text):
>>> context_tokens = tokenizer.encode(raw_text, add_special_tokens=False)
>>> out = sample_sequence(
... model=model,
... context=context_tokens,
... num_samples=1,
... length=50,
... device=device)
>>> out = out[:, len(context_tokens):].tolist()[0]
>>> text = raw_text + tokenizer.decode(out, clean_up_tokenization_spaces=True)
>>> text = text.replace('\n', '').replace('\xa0', '')
>>> return text
You can download pretrained weights from here