
<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

# QuantumQuill-GPT2-Medium-Scifi-Webnovel-300M

This model is a fine-tuned version of [faizalnf1800/QuantumQuill-GPT2-Medium-Raw-300M](https://huggingface.co/faizalnf1800/QuantumQuill-GPT2-Medium-Raw-300M)

## Intended uses & limitations

This model is not so smart to understand complex context so it can only suitable for story writing assisting not whole story generation.
And i found out in some paper that decoder only model arhitecture is not suitable for whole story generation because its can't high level plan.
check this paper [Hierarchical Neural Story Generation](https://paperswithcode.com/paper/hierarchical-neural-story-generation)
<br><br>

I recommed use maximum 200 length generated word. if model become greedy try finetune again to insert more knowledge or temporary solution is,
use creative generate parameter such as top_k,top_p,temperature,num_beam,and activate do sample. <br><br>

Alternatively you can use this simple code to run inference : <br>

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

repo = "faizalnf1800/QuantumQuill-GPT2-Medium-Scifi-Webnovel-300M"
# model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.float16).to(0)
model = AutoModelForCausalLM.from_pretrained(repo).to(0)
tokenizer = AutoTokenizer.from_pretrained(repo)

prompt = """
Chapter 1 : 
Pirate spaceship
"""

inputs = tokenizer(prompt, return_tensors="pt").to(0)
output = model.generate(
                        inputs["input_ids"],
                        max_length=200,
                        min_length=200,
                        num_return_sequences=1,
                        top_k=70,
                        top_p=1.2,
                        temperature=0.7,
                        repetition_penalty=2.0,
                        num_beams=5,
                        length_penalty=0.8,
                        penalty_alpha=0.5,
                        do_sample=True,
                        use_cache=True
                        )

generated_text = tokenizer.decode(output[0].tolist(), skip_special_tokens=True)
print(generated_text)
torch.cuda.empty_cache()

file_path = "generated_text.txt"

with open(file_path, 'w') as file:
    file.write(generated_text)

print("generate txt file success.")
```

## Training and evaluation data

More information needed

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 3e-05
- train_batch_size: 1
- eval_batch_size: 8
- seed: 42
- gradient_accumulation_steps: 2
- total_train_batch_size: 2
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: cosine
- lr_scheduler_warmup_ratio: 0.3
- training_steps: 250

### Training results



### Framework versions

- Transformers 4.35.2
- Pytorch 2.1.0+cu118
- Datasets 2.15.0
- Tokenizers 0.15.0
{"license": "mit", "tags": ["generated_from_trainer"], "datasets": ["faizalnf1800/scifi_webnovel_preprocessed"], "base_model": "faizalnf1800/QuantumQuill-GPT2-Medium-Raw-300M", "widget": [{"text": "My Name is Huda. I am a", "example_title": "The I Am"}, {"text": "Once upon a time", "example_title": "A tale"}, {"text": "In the year 3023, aboard", "example_title": "Interstellar Adventures"}, {"text": "One day in futuristic city", "example_title": "Sci-Fi Odyssey"}, {"text": "On a foggy night in the small town of", "example_title": "Whodunit Chronicles"}, {"text": "Once upon a time, a detective", "example_title": "Mysterious Puzzles"}, {"text": "Deep in the heart of the untamed wilderness,", "example_title": "Epic Expeditions"}, {"text": "Once upon a time, a fearless explorer", "example_title": "Daring Journeys"}, {"text": "In the pages of history, I am", "example_title": "Epic Conqueror"}], "model-index": [{"name": "QuantumQuill-GPT2-Medium-Scifi-Webnovel-300M", "results": []}]}
transformers tensorboard safetensors gpt2 text-generation generated_from_trainer dataset:faizalnf1800/scifi_webnovel_preprocessed base_model:faizalnf1800/QuantumQuill-GPT2-Medium-Raw-300M license:mit autotrain_compatible endpoints_compatible text-generation-inference region:us