初始化项目,由ModelHub XC社区提供模型
Model: mlx-community/SmolLM-360M-Instruct Source: Original Platform
This commit is contained in:
36
.gitattributes
vendored
Normal file
36
.gitattributes
vendored
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
*.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
|
||||||
|
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
||||||
34
README.md
Normal file
34
README.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
base_model: HuggingFaceTB/SmolLM-360M
|
||||||
|
datasets:
|
||||||
|
- Magpie-Align/Magpie-Pro-300K-Filtered
|
||||||
|
- bigcode/self-oss-instruct-sc2-exec-filter-50k
|
||||||
|
- teknium/OpenHermes-2.5
|
||||||
|
- HuggingFaceTB/everyday-conversations-llama3.1-2k
|
||||||
|
language:
|
||||||
|
- en
|
||||||
|
library_name: transformers
|
||||||
|
license: apache-2.0
|
||||||
|
tags:
|
||||||
|
- alignment-handbook
|
||||||
|
- trl
|
||||||
|
- sft
|
||||||
|
- mlx
|
||||||
|
---
|
||||||
|
|
||||||
|
# mlx-community/SmolLM-360M-Instruct
|
||||||
|
|
||||||
|
The Model [mlx-community/SmolLM-360M-Instruct](https://huggingface.co/mlx-community/SmolLM-360M-Instruct) was converted to MLX format from [HuggingFaceTB/SmolLM-360M-Instruct](https://huggingface.co/HuggingFaceTB/SmolLM-360M-Instruct) using mlx-lm version **0.17.0**.
|
||||||
|
|
||||||
|
## Use with mlx
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install mlx-lm
|
||||||
|
```
|
||||||
|
|
||||||
|
```python
|
||||||
|
from mlx_lm import load, generate
|
||||||
|
|
||||||
|
model, tokenizer = load("mlx-community/SmolLM-360M-Instruct")
|
||||||
|
response = generate(model, tokenizer, prompt="hello", verbose=True)
|
||||||
|
```
|
||||||
29
config.json
Normal file
29
config.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"architectures": [
|
||||||
|
"LlamaForCausalLM"
|
||||||
|
],
|
||||||
|
"attention_bias": false,
|
||||||
|
"attention_dropout": 0.0,
|
||||||
|
"bos_token_id": 1,
|
||||||
|
"eos_token_id": 2,
|
||||||
|
"hidden_act": "silu",
|
||||||
|
"hidden_size": 960,
|
||||||
|
"initializer_range": 0.02,
|
||||||
|
"intermediate_size": 2560,
|
||||||
|
"max_position_embeddings": 2048,
|
||||||
|
"mlp_bias": false,
|
||||||
|
"model_type": "llama",
|
||||||
|
"num_attention_heads": 15,
|
||||||
|
"num_hidden_layers": 32,
|
||||||
|
"num_key_value_heads": 5,
|
||||||
|
"pad_token_id": 2,
|
||||||
|
"pretraining_tp": 1,
|
||||||
|
"rms_norm_eps": 1e-05,
|
||||||
|
"rope_scaling": null,
|
||||||
|
"rope_theta": 10000.0,
|
||||||
|
"tie_word_embeddings": true,
|
||||||
|
"torch_dtype": "bfloat16",
|
||||||
|
"transformers_version": "4.42.3",
|
||||||
|
"use_cache": true,
|
||||||
|
"vocab_size": 49152
|
||||||
|
}
|
||||||
1
configuration.json
Normal file
1
configuration.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"framework": "pytorch", "task": "text-generation", "allow_remote": true}
|
||||||
48901
merges.txt
Normal file
48901
merges.txt
Normal file
File diff suppressed because it is too large
Load Diff
3
model.safetensors
Normal file
3
model.safetensors
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:d9f9d39cc25d50591810aeb781c3f943c54423d7677eda38baf324e40d03e17d
|
||||||
|
size 723674525
|
||||||
297
model.safetensors.index.json
Normal file
297
model.safetensors.index.json
Normal file
@@ -0,0 +1,297 @@
|
|||||||
|
{
|
||||||
|
"metadata": {
|
||||||
|
"total_size": 723642240
|
||||||
|
},
|
||||||
|
"weight_map": {
|
||||||
|
"model.embed_tokens.weight": "model.safetensors",
|
||||||
|
"model.layers.0.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.0.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.0.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.0.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.0.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.0.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.0.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.0.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.0.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.1.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.1.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.1.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.1.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.1.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.1.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.1.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.1.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.1.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.10.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.10.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.10.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.10.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.10.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.10.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.10.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.10.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.10.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.11.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.11.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.11.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.11.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.11.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.11.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.11.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.11.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.11.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.12.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.12.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.12.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.12.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.12.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.12.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.12.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.12.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.12.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.13.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.13.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.13.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.13.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.13.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.13.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.13.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.13.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.13.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.14.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.14.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.14.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.14.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.14.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.14.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.14.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.14.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.14.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.15.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.15.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.15.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.15.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.15.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.15.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.15.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.15.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.15.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.16.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.16.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.16.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.16.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.16.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.16.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.16.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.16.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.16.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.17.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.17.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.17.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.17.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.17.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.17.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.17.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.17.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.17.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.18.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.18.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.18.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.18.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.18.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.18.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.18.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.18.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.18.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.19.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.19.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.19.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.19.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.19.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.19.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.19.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.19.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.19.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.2.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.2.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.2.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.2.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.2.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.2.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.2.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.2.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.2.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.20.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.20.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.20.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.20.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.20.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.20.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.20.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.20.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.20.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.21.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.21.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.21.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.21.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.21.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.21.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.21.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.21.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.21.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.22.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.22.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.22.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.22.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.22.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.22.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.22.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.22.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.22.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.23.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.23.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.23.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.23.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.23.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.23.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.23.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.23.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.23.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.24.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.24.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.24.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.24.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.24.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.24.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.24.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.24.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.24.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.25.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.25.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.25.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.25.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.25.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.25.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.25.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.25.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.25.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.26.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.26.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.26.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.26.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.26.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.26.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.26.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.26.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.26.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.27.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.27.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.27.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.27.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.27.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.27.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.27.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.27.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.27.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.28.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.28.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.28.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.28.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.28.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.28.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.28.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.28.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.28.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.29.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.29.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.29.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.29.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.29.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.29.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.29.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.29.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.29.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.3.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.3.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.3.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.3.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.3.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.3.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.3.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.3.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.3.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.30.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.30.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.30.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.30.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.30.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.30.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.30.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.30.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.30.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.31.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.31.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.31.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.31.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.31.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.31.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.31.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.31.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.31.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.4.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.4.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.4.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.4.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.4.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.4.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.4.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.4.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.4.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.5.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.5.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.5.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.5.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.5.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.5.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.5.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.5.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.5.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.6.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.6.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.6.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.6.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.6.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.6.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.6.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.6.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.6.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.7.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.7.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.7.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.7.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.7.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.7.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.7.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.7.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.7.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.8.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.8.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.8.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.8.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.8.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.8.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.8.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.8.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.8.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.9.input_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.9.mlp.down_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.9.mlp.gate_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.9.mlp.up_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.9.post_attention_layernorm.weight": "model.safetensors",
|
||||||
|
"model.layers.9.self_attn.k_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.9.self_attn.o_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.9.self_attn.q_proj.weight": "model.safetensors",
|
||||||
|
"model.layers.9.self_attn.v_proj.weight": "model.safetensors",
|
||||||
|
"model.norm.weight": "model.safetensors"
|
||||||
|
}
|
||||||
|
}
|
||||||
34
special_tokens_map.json
Normal file
34
special_tokens_map.json
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"additional_special_tokens": [
|
||||||
|
"<|im_start|>",
|
||||||
|
"<|im_end|>"
|
||||||
|
],
|
||||||
|
"bos_token": {
|
||||||
|
"content": "<|im_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"eos_token": {
|
||||||
|
"content": "<|im_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"pad_token": {
|
||||||
|
"content": "<|im_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
},
|
||||||
|
"unk_token": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false
|
||||||
|
}
|
||||||
|
}
|
||||||
106
test_prompts.py
Normal file
106
test_prompts.py
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
from transformers import AutoModelForCausalLM, AutoTokenizer
|
||||||
|
|
||||||
|
BASE_PATH = "/fsx/loubna/projects/alignment-handbook/recipes/cosmo2/sft/data"
|
||||||
|
TEMPERATURE = 0.2
|
||||||
|
TOP_P = 0.9
|
||||||
|
|
||||||
|
CHECKPOINT = "loubnabnl/smollm-350M-instruct-add-basics"
|
||||||
|
|
||||||
|
print(f"💾 Loading the model and tokenizer: {CHECKPOINT}...")
|
||||||
|
device = "cuda"
|
||||||
|
tokenizer = AutoTokenizer.from_pretrained(CHECKPOINT)
|
||||||
|
model_s = AutoModelForCausalLM.from_pretrained(CHECKPOINT).to(device)
|
||||||
|
|
||||||
|
print("🧪 Testing single-turn conversations...")
|
||||||
|
L = [
|
||||||
|
"Hi",
|
||||||
|
"Hello",
|
||||||
|
"Tell me a joke",
|
||||||
|
"Who are you?",
|
||||||
|
"What's your name?",
|
||||||
|
"How do I make pancakes?",
|
||||||
|
"Can you tell me what is gravity?",
|
||||||
|
"What is the capital of Morocco?",
|
||||||
|
"What's 2+2?",
|
||||||
|
"Hi, what is 2+1?",
|
||||||
|
"What's 3+5?",
|
||||||
|
"Write a poem about Helium",
|
||||||
|
"Hi, what are some popular dishes from Japan?",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
for i in range(len(L)):
|
||||||
|
print(f"🔮 {L[i]}")
|
||||||
|
messages = [{"role": "user", "content": L[i]}]
|
||||||
|
input_text = tokenizer.apply_chat_template(messages, tokenize=False)
|
||||||
|
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
|
||||||
|
outputs = model_s.generate(
|
||||||
|
inputs, max_new_tokens=200, top_p=TOP_P, do_sample=True, temperature=TEMPERATURE
|
||||||
|
)
|
||||||
|
with open(
|
||||||
|
f"{BASE_PATH}/{CHECKPOINT.split('/')[-1]}_temp_{TEMPERATURE}_topp{TOP_P}.txt",
|
||||||
|
"a",
|
||||||
|
) as f:
|
||||||
|
f.write("=" * 50 + "\n")
|
||||||
|
f.write(tokenizer.decode(outputs[0]))
|
||||||
|
f.write("\n")
|
||||||
|
|
||||||
|
|
||||||
|
print("🧪 Now testing multi-turn conversations...")
|
||||||
|
# Multi-turn conversations
|
||||||
|
messages_1 = [
|
||||||
|
{"role": "user", "content": "Hi"},
|
||||||
|
{"role": "assistant", "content": "Hello! How can I help you today?"},
|
||||||
|
{"role": "user", "content": "What's 2+2?"},
|
||||||
|
]
|
||||||
|
messages_2 = [
|
||||||
|
{"role": "user", "content": "Hi"},
|
||||||
|
{"role": "assistant", "content": "Hello! How can I help you today?"},
|
||||||
|
{"role": "user", "content": "What's 2+2?"},
|
||||||
|
{"role": "assistant", "content": "4"},
|
||||||
|
{"role": "user", "content": "Why?"},
|
||||||
|
]
|
||||||
|
messages_3 = [
|
||||||
|
{"role": "user", "content": "Who are you?"},
|
||||||
|
{"role": "assistant", "content": "I am an AI assistant. How can I help you today?"},
|
||||||
|
{"role": "user", "content": "What's your name?"},
|
||||||
|
]
|
||||||
|
messages_4 = [
|
||||||
|
{"role": "user", "content": "Tell me a joke"},
|
||||||
|
{"role": "assistant", "content": "Sure! Why did the tomato turn red?"},
|
||||||
|
{"role": "user", "content": "Why?"},
|
||||||
|
]
|
||||||
|
messages_5 = [
|
||||||
|
{"role": "user", "content": "Can you tell me what is gravity?"},
|
||||||
|
{
|
||||||
|
"role": "assistant",
|
||||||
|
"content": "Sure! Gravity is a force that attracts objects toward each other. It is what keeps us on the ground and what makes things fall.",
|
||||||
|
},
|
||||||
|
{"role": "user", "content": "Who discovered it?"},
|
||||||
|
]
|
||||||
|
messages_6 = [
|
||||||
|
{"role": "user", "content": "How do I make pancakes?"},
|
||||||
|
{
|
||||||
|
"role": "assistant",
|
||||||
|
"content": "Sure! Here is a simple recipe for pancakes: Ingredients: 1 cup flour, 1 cup milk, 1 egg, 1 tbsp sugar, 1 tsp baking powder, 1/2 tsp salt. Instructions: 1. Mix all the dry ingredients together in a bowl. 2. Add the milk and egg and mix until smooth. 3. Heat a non-stick pan over medium heat. 4. Pour 1/4 cup of batter onto the pan. 5. Cook until bubbles form on the surface, then flip and cook for another minute. 6. Serve with your favorite toppings.",
|
||||||
|
},
|
||||||
|
{"role": "user", "content": "What are some popular toppings?"},
|
||||||
|
]
|
||||||
|
|
||||||
|
L = [messages_1, messages_2, messages_3, messages_4, messages_5, messages_6]
|
||||||
|
|
||||||
|
for i in range(len(L)):
|
||||||
|
input_text = tokenizer.apply_chat_template(L[i], tokenize=False)
|
||||||
|
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
|
||||||
|
outputs = model_s.generate(
|
||||||
|
inputs, max_new_tokens=200, top_p=TOP_P, do_sample=True, temperature=TEMPERATURE
|
||||||
|
)
|
||||||
|
with open(
|
||||||
|
f"{BASE_PATH}/{CHECKPOINT.split('/')[-1]}_temp_{TEMPERATURE}_topp{TOP_P}_MT.txt",
|
||||||
|
"a",
|
||||||
|
) as f:
|
||||||
|
f.write("=" * 50 + "\n")
|
||||||
|
f.write(tokenizer.decode(outputs[0]))
|
||||||
|
f.write("\n")
|
||||||
|
|
||||||
|
print("🔥 Done!")
|
||||||
98249
tokenizer.json
Normal file
98249
tokenizer.json
Normal file
File diff suppressed because it is too large
Load Diff
154
tokenizer_config.json
Normal file
154
tokenizer_config.json
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
{
|
||||||
|
"add_prefix_space": false,
|
||||||
|
"added_tokens_decoder": {
|
||||||
|
"0": {
|
||||||
|
"content": "<|endoftext|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"1": {
|
||||||
|
"content": "<|im_start|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"2": {
|
||||||
|
"content": "<|im_end|>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"3": {
|
||||||
|
"content": "<repo_name>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"4": {
|
||||||
|
"content": "<reponame>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"5": {
|
||||||
|
"content": "<file_sep>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"6": {
|
||||||
|
"content": "<filename>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"7": {
|
||||||
|
"content": "<gh_stars>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"8": {
|
||||||
|
"content": "<issue_start>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"9": {
|
||||||
|
"content": "<issue_comment>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"10": {
|
||||||
|
"content": "<issue_closed>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"11": {
|
||||||
|
"content": "<jupyter_start>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"12": {
|
||||||
|
"content": "<jupyter_text>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"13": {
|
||||||
|
"content": "<jupyter_code>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"14": {
|
||||||
|
"content": "<jupyter_output>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"15": {
|
||||||
|
"content": "<jupyter_script>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
},
|
||||||
|
"16": {
|
||||||
|
"content": "<empty_output>",
|
||||||
|
"lstrip": false,
|
||||||
|
"normalized": false,
|
||||||
|
"rstrip": false,
|
||||||
|
"single_word": false,
|
||||||
|
"special": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additional_special_tokens": [
|
||||||
|
"<|im_start|>",
|
||||||
|
"<|im_end|>"
|
||||||
|
],
|
||||||
|
"bos_token": "<|im_start|>",
|
||||||
|
"chat_template": "{% for message in messages %}{{'<|im_start|>' + message['role'] + '\n' + message['content'] + '<|im_end|>' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '<|im_start|>assistant\n' }}{% endif %}",
|
||||||
|
"clean_up_tokenization_spaces": false,
|
||||||
|
"eos_token": "<|im_end|>",
|
||||||
|
"model_max_length": 2048,
|
||||||
|
"pad_token": "<|im_end|>",
|
||||||
|
"tokenizer_class": "GPT2Tokenizer",
|
||||||
|
"unk_token": "<|endoftext|>",
|
||||||
|
"vocab_size": 49152
|
||||||
|
}
|
||||||
1
vocab.json
Normal file
1
vocab.json
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user