kylesayrs commited on
Commit
ae76ff0
·
verified ·
1 Parent(s): f7b07ae

Upload folder using huggingface_hub

Browse files
README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DSV4-tiny-finetuned
2
+
3
+ This is a fine-tuned version of `inference-optimization/DSV4-tiny-empty` trained on famous internet copypastas.
4
+
5
+ ## Model Details
6
+
7
+ - **Base Model**: inference-optimization/DSV4-tiny-empty
8
+ - **Architecture**: DeepseekV4ForCausalLM
9
+ - **Total Parameters**: 2,689,440,743 (~2.7B parameters)
10
+ - **Precision**: bfloat16
11
+
12
+ ## Training Details
13
+
14
+ The model was fine-tuned using the training template from the create-tiny-model skill on 4 famous internet copypastas:
15
+ - Bee Movie aviation speech
16
+ - GNU/Linux interject copypasta
17
+ - FitnessGram Pacer Test
18
+ - Darth Plagueis the Wise
19
+
20
+ ### Training Configuration
21
+
22
+ - **Target Perplexity**: 3.0
23
+ - **Batch Size**: 2
24
+ - **Learning Rate**: 5e-5
25
+ - **Max Steps**: 1000 (early stopped at step 160)
26
+ - **Training Runtime**: 29.2 seconds
27
+ - **Training Loss**: 0.2243
28
+ - **Final Perplexity**: ~2.44 (achieved target)
29
+
30
+ ### Training Progress
31
+
32
+ The model achieved excellent convergence:
33
+ - Initial loss: 12.52
34
+ - Final loss: 0.000137 (at step 80)
35
+ - Training stopped early after consistently achieving target perplexity
36
+
37
+ ## Generation Example
38
+
39
+ During training validation, the model successfully generated:
40
+
41
+ **Prompt**: "According to all known laws"
42
+ **Output**: "According to all known laws of aviation, there is no way a bee should be able to fly."
43
+
44
+ ## Usage
45
+
46
+ ```python
47
+ from transformers import AutoModelForCausalLM, AutoTokenizer
48
+ import torch
49
+
50
+ tokenizer = AutoTokenizer.from_pretrained("./DSV4-tiny-finetuned")
51
+ model = AutoModelForCausalLM.from_pretrained(
52
+ "./DSV4-tiny-finetuned",
53
+ device_map="auto",
54
+ torch_dtype=torch.bfloat16
55
+ )
56
+
57
+ # Note: The model uses bfloat16 precision
58
+ # Ensure your inputs are properly cast to the correct dtype
59
+ ```
60
+
61
+ ## Files
62
+
63
+ - `config.json`: Model configuration
64
+ - `model.safetensors`: Model weights (5.1GB)
65
+ - `tokenizer.json`: Tokenizer vocabulary
66
+ - `tokenizer_config.json`: Tokenizer configuration
67
+ - `generation_config.json`: Generation parameters
68
+ - `training_args.bin`: Training arguments used during fine-tuning
69
+
70
+ ## Notes
71
+
72
+ - The model was successfully fine-tuned and achieved the target perplexity of 3.0
73
+ - Training completed in under 30 seconds with early stopping at step 160
74
+ - The model memorized the training copypastas effectively, as evidenced by the low final loss
75
+ - Model uses DeepSeek V4 architecture with MoE (Mixture of Experts) layers
TRAINING_SUMMARY.md ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Fine-tuning Summary for DSV4-tiny-empty
2
+
3
+ ## Process Overview
4
+
5
+ Successfully fine-tuned `inference-optimization/DSV4-tiny-empty` using the training template from the create-tiny-model skill.
6
+
7
+ ## Steps Completed
8
+
9
+ 1. **Added Tokenizer**: The base model (`inference-optimization/DSV4-tiny-empty`) was missing tokenizer files. Downloaded and added the tokenizer from `deepseek-ai/DeepSeek-V4-Flash`.
10
+
11
+ 2. **Modified Training Script**: Created a bfloat16-compatible version of the finetune.py script to handle the model's native dtype.
12
+
13
+ 3. **Fine-tuned Model**: Successfully trained on 4 copypastas with early stopping when target perplexity was achieved.
14
+
15
+ ## Training Results
16
+
17
+ - **Steps Taken**: 160 (out of max 1000)
18
+ - **Training Time**: 29.2 seconds
19
+ - **Training Loss**: 0.2243
20
+ - **Final Loss**: 0.000137
21
+ - **Throughput**: 68.48 samples/sec, 34.24 steps/sec
22
+
23
+ ### Loss Progression
24
+ ```
25
+ Step 1: loss=12.52
26
+ Step 10: loss=2.44
27
+ Step 20: loss=0.1295
28
+ Step 40: loss=0.00886
29
+ Step 80: loss=0.000137
30
+ ```
31
+
32
+ The model achieved excellent convergence, with loss dropping from 12.52 to 0.000137 in just 80 steps.
33
+
34
+ ## Validation
35
+
36
+ During training, the model successfully generated:
37
+ - **Input**: "According to all known laws"
38
+ - **Output**: "According to all known laws of aviation, there is no way a bee should be able to fly."
39
+
40
+ This demonstrates the model has learned the copypasta content effectively.
41
+
42
+ ## Files Generated
43
+
44
+ All files saved to: `./DSV4-tiny-finetuned/`
45
+ - Model weights (5.1GB)
46
+ - Tokenizer files
47
+ - Configuration files
48
+ - Training arguments
49
+
50
+ ## Notes
51
+
52
+ - The model uses bfloat16 precision throughout
53
+ - Training was done with bf16=True flag in TrainingArguments
54
+ - The model successfully memorized all 4 training copypastas
55
+ - Target perplexity of 3.0 was achieved and training stopped early
config.json ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "DeepseekV4ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 0,
8
+ "compress_rates": {
9
+ "compressed_sparse_attention": 4,
10
+ "heavily_compressed_attention": 128
11
+ },
12
+ "compress_rope_theta": 160000,
13
+ "dtype": "bfloat16",
14
+ "eos_token_id": 1,
15
+ "expert_dtype": "fp4",
16
+ "hc_eps": 1e-06,
17
+ "hc_mult": 4,
18
+ "hc_sinkhorn_iters": 20,
19
+ "head_dim": 512,
20
+ "hidden_act": "silu",
21
+ "hidden_size": 4096,
22
+ "index_head_dim": 128,
23
+ "index_n_heads": 64,
24
+ "index_topk": 512,
25
+ "initializer_range": 0.02,
26
+ "layer_types": [
27
+ "heavily_compressed_attention",
28
+ "compressed_sparse_attention",
29
+ "sliding_attention"
30
+ ],
31
+ "max_position_embeddings": 1048576,
32
+ "mlp_bias": false,
33
+ "mlp_layer_types": [
34
+ "hash_moe",
35
+ "moe",
36
+ "moe"
37
+ ],
38
+ "model_type": "deepseek_v4",
39
+ "moe_intermediate_size": 2048,
40
+ "n_routed_experts": 16,
41
+ "n_shared_experts": 1,
42
+ "norm_topk_prob": true,
43
+ "num_attention_heads": 64,
44
+ "num_experts_per_tok": 6,
45
+ "num_hidden_layers": 3,
46
+ "num_key_value_heads": 1,
47
+ "num_nextn_predict_layers": 0,
48
+ "o_groups": 8,
49
+ "o_lora_rank": 1024,
50
+ "output_router_logits": false,
51
+ "pad_token_id": null,
52
+ "partial_rotary_factor": 0.125,
53
+ "q_lora_rank": 1024,
54
+ "qk_rope_head_dim": 64,
55
+ "rms_norm_eps": 1e-06,
56
+ "rope_parameters": {
57
+ "compress": {
58
+ "attention_factor": 1.0,
59
+ "beta_fast": 32,
60
+ "beta_slow": 1,
61
+ "factor": 16,
62
+ "original_max_position_embeddings": 65536,
63
+ "partial_rotary_factor": 0.125,
64
+ "rope_theta": 160000,
65
+ "rope_type": "yarn",
66
+ "type": "yarn"
67
+ },
68
+ "main": {
69
+ "partial_rotary_factor": 0.125,
70
+ "rope_theta": 10000,
71
+ "rope_type": "default"
72
+ },
73
+ "partial_rotary_factor": 0.125,
74
+ "rope_theta": 10000,
75
+ "rope_type": "default"
76
+ },
77
+ "rope_theta": 10000,
78
+ "routed_scaling_factor": 1.5,
79
+ "router_aux_loss_coef": 0.001,
80
+ "router_jitter_noise": 0.0,
81
+ "scoring_func": "sqrtsoftplus",
82
+ "sliding_window": 128,
83
+ "swiglu_limit": 10.0,
84
+ "tie_word_embeddings": false,
85
+ "topk_method": "noaux_tc",
86
+ "transformers_version": "5.13.0.dev0",
87
+ "use_cache": false,
88
+ "vocab_size": 129280
89
+ }
generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "do_sample": true,
5
+ "eos_token_id": 1,
6
+ "temperature": 1.0,
7
+ "top_p": 1.0,
8
+ "transformers_version": "5.13.0.dev0"
9
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:153e19c329e6d859e45f978cf0e35cd2726d0045c772fd76f3f7976e4146fb60
3
+ size 5390173772
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "bos_token": "<|begin▁of▁sentence|>",
4
+ "clean_up_tokenization_spaces": false,
5
+ "eos_token": "<|end▁of▁sentence|>",
6
+ "is_local": true,
7
+ "legacy": true,
8
+ "local_files_only": false,
9
+ "model_max_length": 1048576,
10
+ "pad_token": "<|end▁of▁sentence|>",
11
+ "sp_model_kwargs": {},
12
+ "tokenizer_class": "TokenizersBackend",
13
+ "unk_token": null
14
+ }
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:29704c30cc738bf176ee304716fe6a624bd6af08b45ad1a067414d260131a365
3
+ size 5201