初始化项目,由ModelHub XC社区提供模型
Model: GODELEV/Test-1-4000 Source: Original Platform
This commit is contained in:
35
.gitattributes
vendored
Normal file
35
.gitattributes
vendored
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.arrow filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ftz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.h5 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.joblib filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.model filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npy filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.npz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.onnx filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ot filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.parquet filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pb filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pickle filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pkl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pth filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
|
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tflite filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.wasm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
||||||
176
README.md
Normal file
176
README.md
Normal file
@@ -0,0 +1,176 @@
|
|||||||
|
---
|
||||||
|
license: mit
|
||||||
|
datasets:
|
||||||
|
- roneneldan/TinyStories
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
pipeline_tag: text-generation
|
||||||
|
---
|
||||||
|
# Test-1-4000 — A 190M Parameter Narrative Engine
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Test-1-4000 is the final training checkpoint of a compact decoder-only Transformer model built on the Llama architecture and trained on the TinyStories dataset.
|
||||||
|
|
||||||
|
The project focuses on studying how narrative coherence, logical consistency, and language fluency emerge inside small-scale language models through structured training.
|
||||||
|
|
||||||
|
By Step 4000, the model reaches a significantly higher level of generative stability and narrative fluency compared to earlier checkpoints, achieving a final training loss of **0.573** after nearly two full epochs of training.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Model Highlights
|
||||||
|
|
||||||
|
| Feature | Specification |
|
||||||
|
|---|---|
|
||||||
|
| Architecture | Llama-based Decoder-only Transformer |
|
||||||
|
| Parameters | 190.55 Million |
|
||||||
|
| Context Window | 2048 Tokens |
|
||||||
|
| Final Training Step | 4000 |
|
||||||
|
| Final Training Loss | 0.573 |
|
||||||
|
| Precision | bfloat16 |
|
||||||
|
| Attention Backend | Flash Attention 2 |
|
||||||
|
| Compilation | torch.compile |
|
||||||
|
| Tokenizer | GPT-2 Tokenizer |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
| Component | Value |
|
||||||
|
|---|---|
|
||||||
|
| Hidden Dimension | 768 |
|
||||||
|
| Layers | 12 |
|
||||||
|
| Attention Heads | 12 |
|
||||||
|
| Intermediate Size | 3072 |
|
||||||
|
| Activation Function | SwiGLU |
|
||||||
|
| Normalization | RMSNorm |
|
||||||
|
| Vocabulary Size | 50,257 |
|
||||||
|
|
||||||
|
The model uses Rotary Positional Embeddings (RoPE) for stable long-range token relationships across the 2048-token context window.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Training Progression
|
||||||
|
|
||||||
|
### Phase 1 — Lexical Learning (0 → 250)
|
||||||
|
|
||||||
|
The model learned grammar, sentence formation, and common linguistic patterns.
|
||||||
|
|
||||||
|
### Phase 2 — Relational Understanding (250 → 1000)
|
||||||
|
|
||||||
|
The model began associating entities, actions, and environments into logically connected sequences.
|
||||||
|
|
||||||
|
### Phase 3 — Narrative Coherence (1000 → 2000)
|
||||||
|
|
||||||
|
Narrative continuity emerged. Stories developed stable structure, conflict resolution, and reduced contradiction.
|
||||||
|
|
||||||
|
### Phase 4 — Emergent Narrative Intelligence (2000 → 3000)
|
||||||
|
|
||||||
|
The model improved in emotional consistency, long-range memory, and thematic continuity across generations.
|
||||||
|
|
||||||
|
### Phase 5 — Fluent Generative Stability (3000 → 4000)
|
||||||
|
|
||||||
|
This final phase marked a transition from structured storytelling into fluent narrative generation.
|
||||||
|
|
||||||
|
The model became substantially better at:
|
||||||
|
|
||||||
|
- maintaining tone,
|
||||||
|
- producing natural sentence flow,
|
||||||
|
- avoiding repetitive degeneration,
|
||||||
|
- preserving character consistency,
|
||||||
|
- and generating smoother transitions between events.
|
||||||
|
|
||||||
|
By this stage, generations began feeling less mechanically predicted and more organically written. Dialogue improved noticeably, pacing became more natural, and narrative structure stabilized across longer outputs.
|
||||||
|
|
||||||
|
The reduction in loss to **0.573** indicates a major improvement in predictive confidence and language fluency.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Training Configuration
|
||||||
|
|
||||||
|
| Parameter | Value |
|
||||||
|
|---|---|
|
||||||
|
| Optimizer | AdamW |
|
||||||
|
| Learning Rate | 5e-4 |
|
||||||
|
| Scheduler | OneCycleLR |
|
||||||
|
| Weight Decay | 0.01 |
|
||||||
|
| Precision | bfloat16 |
|
||||||
|
| Effective Batch Size | ~262K tokens/step |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Dataset
|
||||||
|
|
||||||
|
The model was trained on TinyStories, a synthetic storytelling dataset designed to teach language models reasoning and narrative structure using simplified vocabulary and clean writing patterns.
|
||||||
|
|
||||||
|
This allows the model to focus on:
|
||||||
|
|
||||||
|
- causal reasoning,
|
||||||
|
- narrative flow,
|
||||||
|
- emotional continuity,
|
||||||
|
- and long-range coherence.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```python
|
||||||
|
import torch
|
||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
|
||||||
|
model_path = "GODELEV/Test-1-4000"
|
||||||
|
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
||||||
|
|
||||||
|
model = AutoModelForCausalLM.from_pretrained(
|
||||||
|
model_path,
|
||||||
|
torch_dtype=torch.bfloat16,
|
||||||
|
device_map="auto"
|
||||||
|
)
|
||||||
|
|
||||||
|
prompt = "Once upon a time, a boy found a silver key."
|
||||||
|
|
||||||
|
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
||||||
|
|
||||||
|
output = model.generate(
|
||||||
|
**inputs,
|
||||||
|
max_new_tokens=200,
|
||||||
|
temperature=0.7,
|
||||||
|
top_p=0.9,
|
||||||
|
repetition_penalty=1.1,
|
||||||
|
do_sample=True,
|
||||||
|
eos_token_id=tokenizer.eos_token_id,
|
||||||
|
pad_token_id=tokenizer.pad_token_id
|
||||||
|
)
|
||||||
|
|
||||||
|
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Final Notes
|
||||||
|
|
||||||
|
Test-1-4000 demonstrates that coherent and fluent narrative behavior can emerge in compact Transformer models when training is focused on clean, structured data and long-form consistency.
|
||||||
|
|
||||||
|
Despite its relatively small size, the model exhibits:
|
||||||
|
|
||||||
|
- strong narrative fluency,
|
||||||
|
- stable story progression,
|
||||||
|
- coherent emotional structure,
|
||||||
|
- and reliable long-context generation.
|
||||||
|
|
||||||
|
The project serves as an exploration into how efficient language models can develop increasingly sophisticated generative behavior through progressive training refinement.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Citation
|
||||||
|
|
||||||
|
```bibtex
|
||||||
|
@misc{test14000,
|
||||||
|
title={Test-1-4000: A 190M Parameter Narrative Engine},
|
||||||
|
author={GODELEV},
|
||||||
|
year={2026}
|
||||||
|
}
|
||||||
|
```
|
||||||
32
config.json
Normal file
32
config.json
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"LlamaForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"dtype": "float32",
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"head_dim": 64,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 896,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 2432,
|
||||||
|
"max_position_embeddings": 2048,
|
||||||
|
"mlp_bias": false,
|
||||||
|
"model_type": "llama",
|
||||||
|
"num_attention_heads": 14,
|
||||||
|
"num_hidden_layers": 12,
|
||||||
|
"num_key_value_heads": 2,
|
||||||
|
"pad_token_id": null,
|
||||||
|
"pretraining_tp": 1,
|
||||||
|
"rms_norm_eps": 1e-05,
|
||||||
|
"rope_parameters": {
|
||||||
|
"rope_theta": 10000.0,
|
||||||
|
"rope_type": "default"
|
||||||
|
},
|
||||||
|
"tie_word_embeddings": false,
|
||||||
|
"transformers_version": "5.6.2",
|
||||||
|
"use_cache": false,
|
||||||
|
"vocab_size": 50257
|
||||||
|
}
|
||||||
9
generation_config.json
Normal file
9
generation_config.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"_from_model_config": true,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"output_attentions": false,
|
||||||
|
"output_hidden_states": false,
|
||||||
|
"transformers_version": "5.6.2",
|
||||||
|
"use_cache": false
|
||||||
|
}
|
||||||
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:9b393f254c37483d4ce7607e78206924aae731276c649a0bf08ad09c50c29915
|
||||||
|
size 762210848
|
||||||
250306
tokenizer.json
Normal file
250306
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
13
tokenizer_config.json
Normal file
13
tokenizer_config.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"add_prefix_space": false,
|
||||||
|
"backend": "tokenizers",
|
||||||
|
"bos_token": "<|endoftext|>",
|
||||||
|
"eos_token": "<|endoftext|>",
|
||||||
|
"errors": "replace",
|
||||||
|
"is_local": false,
|
||||||
|
"local_files_only": false,
|
||||||
|
"model_max_length": 1024,
|
||||||
|
"pad_token": "<|endoftext|>",
|
||||||
|
"tokenizer_class": "GPT2Tokenizer",
|
||||||
|
"unk_token": "<|endoftext|>"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user