初始化项目,由ModelHub XC社区提供模型

Model: yujiepan/baguettotron-tiny-random
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-04-18 10:26:21 +08:00
commit 4882598d88
9 changed files with 327743 additions and 0 deletions

35
.gitattributes vendored Normal file
View 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

102
README.md Normal file
View File

@@ -0,0 +1,102 @@
---
library_name: transformers
base_model:
- PleIAs/Baguettotron
---
This tiny model is intended for debugging. It is randomly initialized using the configuration adapted from [PleIAs/Baguettotron](https://huggingface.co/PleIAs/Baguettotron).
### Example usage:
```python
from transformers import pipeline
model_id = "yujiepan/baguettotron-tiny-random"
pipe = pipeline(
"text-generation", model=model_id, device="cuda",
trust_remote_code=True, max_new_tokens=3,
)
print(pipe("Hello World!"))
```
### Codes to create this repo:
```python
import torch
from transformers import (
AutoConfig,
AutoModelForCausalLM,
AutoTokenizer,
GenerationConfig,
pipeline,
set_seed,
)
source_model_id = "PleIAs/Baguettotron"
save_folder = "/tmp/yujiepan/baguettotron-tiny-random"
tokenizer = AutoTokenizer.from_pretrained(
source_model_id, trust_remote_code=True,
)
tokenizer.chat_template = "{% for m in messages %}<|im_start|>{{ m['role'] }}\n{{ m['content'] }}<|im_end|>\n{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n<think>\n{% endif %}"
tokenizer.eos_token = "<|im_end|>"
tokenizer.bos_token = "<|im_start|>"
tokenizer.stop_token = "<|im_end|>"
tokenizer.save_pretrained(save_folder)
config = AutoConfig.from_pretrained(
source_model_id, trust_remote_code=True,
)
config.hidden_size = 8
config.intermediate_size = 64
config.num_attention_heads = 16
config.num_key_value_heads = 8
config.head_dim = 32
config.num_hidden_layers = 2
model = AutoModelForCausalLM.from_config(
config,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
)
model.generation_config = GenerationConfig.from_pretrained(
source_model_id, trust_remote_code=True,
)
set_seed(42)
model = model.cpu()
with torch.no_grad():
for name, p in sorted(model.named_parameters()):
torch.nn.init.normal_(p, 0, 0.1)
print(name, p.shape)
model.save_pretrained(save_folder)
```
### Printing the model:
```text
LlamaForCausalLM(
(model): LlamaModel(
(embed_tokens): Embedding(65536, 8)
(layers): ModuleList(
(0-1): 2 x LlamaDecoderLayer(
(self_attn): LlamaAttention(
(q_proj): Linear(in_features=8, out_features=512, bias=False)
(k_proj): Linear(in_features=8, out_features=256, bias=False)
(v_proj): Linear(in_features=8, out_features=256, bias=False)
(o_proj): Linear(in_features=512, out_features=8, bias=False)
)
(mlp): LlamaMLP(
(gate_proj): Linear(in_features=8, out_features=64, bias=False)
(up_proj): Linear(in_features=8, out_features=64, bias=False)
(down_proj): Linear(in_features=64, out_features=8, bias=False)
(act_fn): SiLUActivation()
)
(input_layernorm): LlamaRMSNorm((8,), eps=1e-05)
(post_attention_layernorm): LlamaRMSNorm((8,), eps=1e-05)
)
)
(norm): LlamaRMSNorm((8,), eps=1e-05)
(rotary_emb): LlamaRotaryEmbedding()
)
(lm_head): Linear(in_features=8, out_features=65536, bias=False)
)
```

5
chat_template.jinja Normal file
View File

@@ -0,0 +1,5 @@
{% for m in messages %}<|im_start|>{{ m['role'] }}
{{ m['content'] }}<|im_end|>
{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
<think>
{% endif %}

29
config.json Normal file
View File

@@ -0,0 +1,29 @@
{
"architectures": [
"LlamaForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"bos_token_id": 1,
"dtype": "bfloat16",
"eos_token_id": 2,
"head_dim": 32,
"hidden_act": "silu",
"hidden_size": 8,
"initializer_range": 0.02,
"intermediate_size": 64,
"max_position_embeddings": 4096,
"mlp_bias": false,
"model_type": "llama",
"num_attention_heads": 16,
"num_hidden_layers": 2,
"num_key_value_heads": 8,
"pretraining_tp": 1,
"rms_norm_eps": 1e-05,
"rope_scaling": null,
"rope_theta": 10000,
"tie_word_embeddings": true,
"transformers_version": "4.57.1",
"use_cache": true,
"vocab_size": 65536
}

6
generation_config.json Normal file
View File

@@ -0,0 +1,6 @@
{
"_from_model_config": true,
"bos_token_id": 1,
"eos_token_id": 2,
"transformers_version": "4.57.1"
}

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:52e46712c7b65e789ca8640249c83ec372396250b68127097a5b1c02434a093f
size 1106064

65
special_tokens_map.json Normal file
View File

@@ -0,0 +1,65 @@
{
"additional_special_tokens": [
"<|im_start|>",
"<|im_end>",
"<think>",
"</think>",
"source_1",
"source_2",
"source_3",
"source_4",
"source_5",
"source_6",
"source_7",
"source_8",
"source_9",
"source_10",
"<ref",
"</ref>",
"→",
"↺",
"※",
"?maybe?",
"●",
"◐",
"○",
"⚠",
"☐",
"☑",
"✓",
"⟨H≈0.1⟩",
"⟨H≈0.2⟩",
"⟨H≈0.3⟩",
"⟨H≈0.4⟩",
"⟨H≈0.5⟩",
"⟨H≈0.6⟩",
"⟨H≈0.7⟩",
"⟨H≈0.8⟩",
"⟨H≈0.9⟩",
"⟨H≈1.0⟩",
"⟨H≈1.1⟩",
"⟨H≈1.2⟩",
"⟨H≈1.3⟩",
"⟨H≈1.4⟩",
"⟨H≈1.5⟩",
"⟨H≈1.6⟩",
"⟨H≈1.7⟩",
"⟨H≈1.8⟩"
],
"bos_token": "<|im_start|>",
"eos_token": "<|im_end|>",
"pad_token": {
"content": "[PAD]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
},
"unk_token": {
"content": "[UNK]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false
}
}

327047
tokenizer.json Normal file

File diff suppressed because it is too large Load Diff

451
tokenizer_config.json Normal file
View File

@@ -0,0 +1,451 @@
{
"added_tokens_decoder": {
"0": {
"content": "[UNK]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"1": {
"content": "<|begin_of_text|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"2": {
"content": "<|end_of_text|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"3": {
"content": "[PAD]",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65491": {
"content": "<|im_start|>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65492": {
"content": "<|im_end>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65493": {
"content": "<think>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65494": {
"content": "</think>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65495": {
"content": "source_1",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65496": {
"content": "source_2",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65497": {
"content": "source_3",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65498": {
"content": "source_4",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65499": {
"content": "source_5",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65500": {
"content": "source_6",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65501": {
"content": "source_7",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65502": {
"content": "source_8",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65503": {
"content": "source_9",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65504": {
"content": "source_10",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65505": {
"content": "<ref",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65506": {
"content": "</ref>",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65507": {
"content": "→",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65508": {
"content": "↺",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65509": {
"content": "※",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65510": {
"content": "?maybe?",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65511": {
"content": "●",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65512": {
"content": "◐",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65513": {
"content": "○",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65514": {
"content": "⚠",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65515": {
"content": "☐",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65516": {
"content": "☑",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65517": {
"content": "✓",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65518": {
"content": "⟨H≈0.1⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65519": {
"content": "⟨H≈0.2⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65520": {
"content": "⟨H≈0.3⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65521": {
"content": "⟨H≈0.4⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65522": {
"content": "⟨H≈0.5⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65523": {
"content": "⟨H≈0.6⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65524": {
"content": "⟨H≈0.7⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65525": {
"content": "⟨H≈0.8⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65526": {
"content": "⟨H≈0.9⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65527": {
"content": "⟨H≈1.0⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65528": {
"content": "⟨H≈1.1⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65529": {
"content": "⟨H≈1.2⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65530": {
"content": "⟨H≈1.3⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65531": {
"content": "⟨H≈1.4⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65532": {
"content": "⟨H≈1.5⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65533": {
"content": "⟨H≈1.6⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65534": {
"content": "⟨H≈1.7⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
},
"65535": {
"content": "⟨H≈1.8⟩",
"lstrip": false,
"normalized": false,
"rstrip": false,
"single_word": false,
"special": true
}
},
"additional_special_tokens": [
"<|im_start|>",
"<|im_end>",
"<think>",
"</think>",
"source_1",
"source_2",
"source_3",
"source_4",
"source_5",
"source_6",
"source_7",
"source_8",
"source_9",
"source_10",
"<ref",
"</ref>",
"→",
"↺",
"※",
"?maybe?",
"●",
"◐",
"○",
"⚠",
"☐",
"☑",
"✓",
"⟨H≈0.1⟩",
"⟨H≈0.2⟩",
"⟨H≈0.3⟩",
"⟨H≈0.4⟩",
"⟨H≈0.5⟩",
"⟨H≈0.6⟩",
"⟨H≈0.7⟩",
"⟨H≈0.8⟩",
"⟨H≈0.9⟩",
"⟨H≈1.0⟩",
"⟨H≈1.1⟩",
"⟨H≈1.2⟩",
"⟨H≈1.3⟩",
"⟨H≈1.4⟩",
"⟨H≈1.5⟩",
"⟨H≈1.6⟩",
"⟨H≈1.7⟩",
"⟨H≈1.8⟩"
],
"bos_token": "<|im_start|>",
"clean_up_tokenization_spaces": true,
"eos_token": "<|im_end|>",
"extra_special_tokens": {},
"model_max_length": 1000000000000000019884624838656,
"pad_token": "[PAD]",
"tokenizer_class": "PreTrainedTokenizerFast",
"unk_token": "[UNK]"
}