File size: 4,420 Bytes
1cb2daf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0ea0617
1cb2daf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
license: mit
---
Model Summary

OpenCelestial_1 is a compact and efficient language model fine-tuned on a greeting dataset. It demonstrates that small LLMs can achieve remarkable conversational capabilities, even when trained on consumer-grade hardware.

Based on the GPT-2 architecture, OpenCelestial_1 is optimized for clear, polite, and structured responses, making it ideal for use cases such as:

    Chatbots
    Instruction-following assistants
    Lightweight deployments on limited hardware

Model Training

    Base Model: openai-community/gpt2
    Dataset: Custom greeting dataset with structured "User" and "AI" dialogue pairs.
    Hardware: Fine-tuned on a single NVIDIA RTX 3060.
    Optimization: Fine-tuning utilized LoRA (Low-Rank Adaptation) to improve memory efficiency.

Usage Example

To interact with OpenCelestial_1, use the following Python script:

pip install transformers torch

Copy and paste the following script:



```python3
from transformers import GPT2LMHeadModel, GPT2Tokenizer
import torch

# Load the model and tokenizer
model_path = "theaithinker/OpenCelestial_1"
model = GPT2LMHeadModel.from_pretrained(model_path)
tokenizer = GPT2Tokenizer.from_pretrained(model_path)

# Set the pad token to the EOS token if not already set
tokenizer.pad_token = tokenizer.eos_token

print("Chatbot is ready! Type 'exit' to quit.")

while True:
    user_input = input("You: ")
    if user_input.lower() == "exit":
        print("Chatbot: Goodbye!")
        break

    # Define the system prompt and the full prompt
    system_prompt = "You are an intelligent AI assistant that will answer every question to the best of your ability. Be clear and polite with your answers."
    prompt = f"{system_prompt}\n### Instruction:\n{user_input}\n### Response:"

    # Tokenize the input
    inputs = tokenizer(
        prompt,
        return_tensors="pt",
        padding=True,
        truncation=True,
        max_length=1024,
    )
    input_ids = inputs.input_ids.to(model.device)
    attention_mask = inputs.attention_mask.to(model.device)

    # Generate the response
    with torch.no_grad():
        outputs = model.generate(
            input_ids=input_ids,
            attention_mask=attention_mask,
            max_new_tokens=150,
            pad_token_id=tokenizer.eos_token_id,
            do_sample=True,
            temperature=0.7,
            top_k=50,
            top_p=0.95,
        )

    # Decode the response and clean it up
    response = tokenizer.decode(outputs[0], skip_special_tokens=True)
    clean_response = response.split("### Response:")[-1].strip()
    print(f"Chatbot: {clean_response}")
```

Example Outputs

Prompt: Hello there!
Response: Hello there! I am just an AI assistant, but I’m here to help you with anything you need.

Prompt: Can you tell me a joke?
Response: Sure! Why don’t skeletons fight each other? Because they don’t have the guts!

Prompt: What is the capital of France?
Response: The capital of France is Paris.
Training Details

    LoRA Configuration:
        Rank (r): 4
        Alpha: 16
        Dropout: 0.1
        Target Modules: GPT-2’s attention layers (attn.c_attn)
    Training Arguments:
        Mixed precision: Enabled (fp16)
        Epochs: 3
        Batch size: 2 (to fit GPU memory)
        Learning rate: 5e-5

Performance

OpenCelestial_1 demonstrates:

    Clear conversational ability with polite, structured responses.
    Low resource requirements, suitable for GPUs like the RTX 3060.
    Consistency in instruction-following tasks.

Intended Use

This model is designed for:

    Conversational AI applications.
    Instruction-based assistants that respond politely and clearly.
    Lightweight deployments for hobbyists, small-scale developers, or educational purposes.

Limitations

    Responses may still contain hallucinations or factual inaccuracies.
    Performance is limited to the dataset scope and GPT-2’s inherent capabilities.

Citation

If you use OpenCelestial_1 in your work, please consider citing:

@misc{OpenCelestial_1,
  author = {Your Name or Organization},
  title = {OpenCelestial_1: A Compact GPT-2 Fine-Tuned Model},
  year = {2024},
  howpublished = {\url{https://huggingface.co/your_username/OpenCelestial_1}},
}

Acknowledgments

    Base Model: openai-community/gpt2
    Fine-tuned using the LoRA technique for efficient memory usage.
    Developed on a single NVIDIA RTX 3060 GPU.