DemonKing1234 commited on
Commit
d4eb3c8
·
verified ·
1 Parent(s): 7354cd7

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +150 -0
README.md ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Tiny From-Scratch AI
2
+
3
+ This is a real neural-network language model trained from random weights.
4
+ It is intentionally tiny so it can run on an old CPU-only laptop.
5
+
6
+ There is also a separate GGUF chat path for a much smarter small pretrained
7
+ model. GGUF is the format used by llama.cpp-compatible models, not this toy
8
+ character model.
9
+
10
+ ## Setup
11
+
12
+ ```powershell
13
+ python -m pip install -r requirements.txt
14
+ ```
15
+
16
+ ## Build A Bigger Corpus
17
+
18
+ ```powershell
19
+ python build_corpus.py
20
+ ```
21
+
22
+ This combines:
23
+
24
+ - `data/input.txt`
25
+ - `data/extra_seed.txt`
26
+ - `data/chat_memory.txt`
27
+ - `README.md`
28
+
29
+ ## Train
30
+
31
+ ```powershell
32
+ python train.py --steps 1200
33
+ ```
34
+
35
+ Use the combined corpus:
36
+
37
+ ```powershell
38
+ python train.py --data data/corpus.txt --steps 1200
39
+ ```
40
+
41
+ Big preset:
42
+
43
+ ```powershell
44
+ python train.py --preset big --out runs/big-char-model.pt
45
+ ```
46
+
47
+ Large preset:
48
+
49
+ ```powershell
50
+ python train.py --preset large --out runs/large-char-model.pt
51
+ ```
52
+
53
+ ## Generate Text
54
+
55
+ ```powershell
56
+ python generate.py --prompt "hello" --tokens 400
57
+ ```
58
+
59
+ ## Self-Learning Chat
60
+
61
+ ```powershell
62
+ python chat_train.py
63
+ ```
64
+
65
+ Use the combined corpus:
66
+
67
+ ```powershell
68
+ python chat_train.py --data data/corpus.txt
69
+ ```
70
+
71
+ Smart mode:
72
+
73
+ ```powershell
74
+ python chat_train.py --preset small --model runs/fast-char-model.pt --no-self-train
75
+ ```
76
+
77
+ Big preset:
78
+
79
+ ```powershell
80
+ python chat_train.py --preset big --model runs/big-chat-model.pt
81
+ ```
82
+
83
+ Large preset:
84
+
85
+ ```powershell
86
+ python chat_train.py --preset large --model runs/large-chat-model.pt
87
+ ```
88
+
89
+ Commands:
90
+
91
+ ```text
92
+ /teach your training sentence here
93
+ /quit
94
+ ```
95
+
96
+ The chat script appends each conversation to `data/chat_memory.txt` and updates
97
+ the model weights after every turn. By default it also learns from its own
98
+ replies. This is real learning, but it is tiny and may learn nonsense if its
99
+ own replies are nonsense.
100
+
101
+ If you want better output quality, use `--no-self-train` so it does not learn
102
+ from its own bad replies. The script will still use retrieved past examples as
103
+ extra context.
104
+
105
+ For stronger self-training per message:
106
+
107
+ ```powershell
108
+ python chat_train.py --steps-per-turn 50 --tokens 80 --temperature 0.5
109
+ ```
110
+
111
+ ## Add Your Own Data
112
+
113
+ Replace `data/input.txt` with a larger text file. More text improves results.
114
+ This model learns characters and style, not real reasoning.
115
+
116
+ ## GGUF Smart Chat
117
+
118
+ If you want a smarter small model, use a llama.cpp-compatible `.gguf` model
119
+ with:
120
+
121
+ ```powershell
122
+ python gguf_chat.py --model "models\small-model.gguf"
123
+ ```
124
+
125
+ Double-click:
126
+
127
+ ```text
128
+ start_gguf_chat.cmd
129
+ ```
130
+
131
+ Important:
132
+
133
+ - The current from-scratch character model cannot be converted directly to GGUF.
134
+ - GGUF is for supported architectures such as LLaMA-style / llama.cpp-compatible models.
135
+ - To make a real small smart model, fine-tune a supported Hugging Face base model and then convert that result to GGUF with llama.cpp tools.
136
+ - If you do not already have a `.gguf` file, you need to download one or export one from a supported model first.
137
+
138
+ ## Export And Upload GGUF
139
+
140
+ If you already have a `.gguf` file and want to put it on Hugging Face:
141
+
142
+ ```powershell
143
+ python hf_upload_gguf.py --file "path\to\model.gguf" --repo-id "your-username/your-model"
144
+ ```
145
+
146
+ For conversion in Colab from a supported Hugging Face model:
147
+
148
+ - [colab_gguf_export.ipynb](colab_gguf_export.ipynb)
149
+
150
+ That notebook downloads a supported HF model, converts it with `llama.cpp`, and uploads the resulting GGUF file to your Hub repo.