EdvardOlsen / Horoscope_generator

This is a horoscope generating code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Horoscope generator

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

Installation

To install clone this repo and run chmod 777 setup.sh && ./setup.sh

Training

To train the model run chmod 777 train.sh && ./train.sh
Make sure to clone the transformers repo

Inference

Demo

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

About

This is a horoscope generating code

License:MIT License


Languages

Language:Python 74.9%Language:Shell 25.1%