From 1125e2abd4c46ca5fcf4c4f3e90b35f934328d03 Mon Sep 17 00:00:00 2001 From: ModelHub XC Date: Tue, 16 Jun 2026 16:10:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=EF=BC=8C=E7=94=B1ModelHub=20XC=E7=A4=BE=E5=8C=BA=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E6=A8=A1=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Model: dphn/Dolphin-2.9.1-Phi-3-Kensho-4.5B Source: Original Platform --- .gitattributes | 35 +++++++ README.md | 65 +++++++++++++ adapter/adapter_config.json | 66 +++++++++++++ adapter/adapter_model.safetensors | 3 + added_tokens.json | 15 +++ config.json | 27 ++++++ configs/dolphin-2.9-phi3-qlora.yml | 133 ++++++++++++++++++++++++++ configuration.json | 1 + generation_config.json | 8 ++ pytorch_model-00001-of-00002.bin | 3 + pytorch_model-00002-of-00002.bin | 3 + pytorch_model.bin.index.json | 3 + special_tokens_map.json | 30 ++++++ tokenizer.json | 3 + tokenizer.model | 3 + tokenizer_config.json | 146 +++++++++++++++++++++++++++++ 16 files changed, 544 insertions(+) create mode 100644 .gitattributes create mode 100644 README.md create mode 100644 adapter/adapter_config.json create mode 100644 adapter/adapter_model.safetensors create mode 100644 added_tokens.json create mode 100644 config.json create mode 100644 configs/dolphin-2.9-phi3-qlora.yml create mode 100644 configuration.json create mode 100644 generation_config.json create mode 100644 pytorch_model-00001-of-00002.bin create mode 100644 pytorch_model-00002-of-00002.bin create mode 100644 pytorch_model.bin.index.json create mode 100644 special_tokens_map.json create mode 100644 tokenizer.json create mode 100644 tokenizer.model create mode 100644 tokenizer_config.json diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a6344aa --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..09cfd99 --- /dev/null +++ b/README.md @@ -0,0 +1,65 @@ +--- +license: mit +language: +- en +base_model: +- unsloth/Phi-3-mini-4k-instruct +datasets: +- cognitivecomputations/Dolphin-2.9 +- teknium/OpenHermes-2.5 +- m-a-p/CodeFeedback-Filtered-Instruction +- cognitivecomputations/dolphin-coder +- cognitivecomputations/samantha-data +- microsoft/orca-math-word-problems-200k +- Locutusque/function-calling-chatml +- internlm/Agent-FLAN +--- + +# Dolphin 2.9.1 Phi-3 Kensho 4.5b 🐬 + +Curated and trained by Eric Hartford, Lucas Atkins, Fernando Fernandes, and with help from the community of Cognitive Computations + +[![Discord](https://img.shields.io/discord/1156064224225808488?logo=Discord&logoColor=%23ffffff&label=Discord&link=https%3A%2F%2Fdiscord.gg%2FtCMkMDDHwm)](https://discord.gg/cognitivecomputations) +Discord: https://discord.gg/cognitivecomputations + + + +Our appreciation for the sponsors of Dolphin 2.9: +- [Crusoe Cloud](https://crusoe.ai/) - provided excellent on-demand 8xL40Snode + +This model utilizes PEFT layer replication at inference time to duplicate layers and increase parameter count. This works with both the merged model that comes stock with this repository, +and the adapter that is attached as well. Performance will be similar with both methods, but VRAM use is considerably less when using the adapter. +This model was initialized using [Unsloth's Mistralfied Phi-3-Instruct-4k](https://huggingface.co/unsloth/Phi-3-mini-4k-instruct). If you choose to use the adapter method, please attach it to their model. + + + + + +This model is based on Phi-3-Mini-Instruct-4k, and is governed by the MIT license in which Microsoft released Phi-3. + +The base model has 4k context, and the qLoRA fine-tuning was with 4k sequence length. + +It took 2.5 days on 8xL40S node provided by Crusoe Cloud + +This model uses ChatML prompt template format. + +example: + +``` +<|im_start|>system +You are Dolphin, a helpful AI assistant.<|im_end|> +<|im_start|>user +{prompt}<|im_end|> +<|im_start|>assistant + +``` + +Dolphin-2.9.1 has a variety of instruction, conversational, and coding skills. It also has initial agentic abilities and supports function calling. +We have filtered the dataset to remove alignment and bias. This makes the model more compliant. You are advised to implement your own alignment layer before exposing the model as a service. Please read my blog post about uncensored models. https://erichartford.com/uncensored-models You are responsible for any content you create using this model. Enjoy responsibly. + +Dolphin is licensed according to the MIT license. I grant permission for any use, including commercial. Dolphin was trained on data generated from GPT4, among other models. + +[Built with Axolotl](https://github.com/OpenAccess-AI-Collective/axolotl) + + + diff --git a/adapter/adapter_config.json b/adapter/adapter_config.json new file mode 100644 index 0000000..d9f3098 --- /dev/null +++ b/adapter/adapter_config.json @@ -0,0 +1,66 @@ +{ + "alpha_pattern": {}, + "auto_mapping": null, + "base_model_name_or_path": "unsloth/Phi-3-mini-4k-instruct", + "bias": "none", + "fan_in_fan_out": null, + "inference_mode": true, + "init_lora_weights": true, + "layer_replication": [ + [ + 0, + 8 + ], + [ + 4, + 12 + ], + [ + 8, + 16 + ], + [ + 12, + 20 + ], + [ + 16, + 24 + ], + [ + 20, + 28 + ], + [ + 24, + 32 + ] + ], + "layers_pattern": null, + "layers_to_transform": null, + "loftq_config": {}, + "lora_alpha": 32, + "lora_dropout": 0.05, + "megatron_config": null, + "megatron_core": "megatron.core", + "modules_to_save": [ + "embed_tokens", + "lm_head" + ], + "peft_type": "LORA", + "r": 64, + "rank_pattern": {}, + "revision": null, + "target_modules": [ + "up_proj", + "gate_proj", + "q_proj", + "k_proj", + "down_proj", + "o_proj", + "v_proj" + ], + "task_type": "CAUSAL_LM", + "use_dora": false, + "use_rslora": false +} \ No newline at end of file diff --git a/adapter/adapter_model.safetensors b/adapter/adapter_model.safetensors new file mode 100644 index 0000000..b0b2281 --- /dev/null +++ b/adapter/adapter_model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:731ce5900201af7782367ba612704d42966da2bc73c915652e1bc7889f475831 +size 812491344 diff --git a/added_tokens.json b/added_tokens.json new file mode 100644 index 0000000..94f26b7 --- /dev/null +++ b/added_tokens.json @@ -0,0 +1,15 @@ +{ + "<|assistant|>": 32001, + "<|endoftext|>": 32000, + "<|end|>": 32007, + "<|im_end|>": 32011, + "<|im_start|>": 32012, + "<|placeholder1|>": 32002, + "<|placeholder2|>": 32003, + "<|placeholder3|>": 32004, + "<|placeholder4|>": 32005, + "<|placeholder5|>": 32008, + "<|placeholder6|>": 32009, + "<|system|>": 32006, + "<|user|>": 32010 +} diff --git a/config.json b/config.json new file mode 100644 index 0000000..d71c24c --- /dev/null +++ b/config.json @@ -0,0 +1,27 @@ +{ + "_name_or_path": "unsloth/Phi-3-mini-4k-instruct", + "architectures": [ + "MistralForCausalLM" + ], + "attention_dropout": 0.0, + "bos_token_id": 1, + "eos_token_id": 32011, + "hidden_act": "silu", + "hidden_size": 3072, + "initializer_range": 0.02, + "intermediate_size": 8192, + "max_position_embeddings": 4096, + "model_type": "mistral", + "num_attention_heads": 32, + "num_hidden_layers": 56, + "num_key_value_heads": 32, + "pad_token_id": 32000, + "rms_norm_eps": 1e-05, + "rope_theta": 10000.0, + "sliding_window": 2048, + "tie_word_embeddings": false, + "torch_dtype": "bfloat16", + "transformers_version": "4.40.2", + "use_cache": false, + "vocab_size": 32064 +} diff --git a/configs/dolphin-2.9-phi3-qlora.yml b/configs/dolphin-2.9-phi3-qlora.yml new file mode 100644 index 0000000..bed968c --- /dev/null +++ b/configs/dolphin-2.9-phi3-qlora.yml @@ -0,0 +1,133 @@ +base_model: unsloth/Phi-3-mini-4k-instruct +model_type: AutoModelForCausalLM +tokenizer_type: AutoTokenizer + +trust_remote_code: true + +peft_layer_replication: + - [0, 8] + - [4, 12] + - [8, 16] + - [12, 20] + - [16, 24] + - [20, 28] + - [24, 32] + +load_in_8bit: false +load_in_4bit: true +strict: false + +datasets: + - path: /workspace/datasets/dolphin-2.9/dolphin201-sharegpt2.jsonl + type: sharegpt + conversation: chatml + # - path: /workspace/datasets/dolphin-2.9/Ultrachat200kunfiltered.jsonl + # type: sharegpt + # conversation: chatml + - path: /workspace/datasets/dolphin-2.9/dolphin-coder-translate-sharegpt2.jsonl + type: sharegpt + conversation: chatml + - path: /workspace/datasets/dolphin-2.9/dolphin-coder-codegen-sharegpt2.jsonl + type: sharegpt + conversation: chatml + - path: /workspace/datasets/dolphin-2.9/m-a-p_Code-Feedback-sharegpt-unfiltered.jsonl + type: sharegpt + conversation: chatml + - path: /workspace/datasets/dolphin-2.9/m-a-p_CodeFeedback-Filtered-Instruction-sharegpt-unfiltered.jsonl + type: sharegpt + conversation: chatml + - path: /workspace/datasets/dolphin-2.9/not_samantha_norefusals.jsonl + type: sharegpt + conversation: chatml + - path: /workspace/datasets/dolphin-2.9/Orca-Math-resort-unfiltered.jsonl + type: sharegpt + conversation: chatml + - path: /workspace/datasets/dolphin-2.9/agent_instruct_react_unfiltered.jsonl + type: sharegpt + conversation: chatml + - path: /workspace/datasets/dolphin-2.9/toolbench_instruct_j1s1_3k_unfiltered.jsonl + type: sharegpt + conversation: chatml + - path: /workspace/datasets/dolphin-2.9/toolbench_negative_unfiltered.jsonl + type: sharegpt + conversation: chatml + - path: /workspace/datasets/dolphin-2.9/toolbench_react_10p_unfiltered.jsonl + type: sharegpt + conversation: chatml + - path: /workspace/datasets/dolphin-2.9/toolbench_tflan_cot_30p_unfiltered.jsonl + type: sharegpt + conversation: chatml + - path: /workspace/datasets/dolphin-2.9/openhermes200k_unfiltered.jsonl + type: sharegpt + conversation: chatml + # - path: /workspace/datasets/dolphin-2.9/SystemConversations.jsonl + # type: sharegpt + # conversation: chatml + +chat_template: chatml + +dataset_prepared_path: dolphin-phi3-prepared +val_set_size: 0 +output_dir: ./dolphin-phi3-5b + +sequence_len: 4096 +sample_packing: true +pad_to_sequence_len: true + +adapter: qlora +lora_model_dir: +lora_r: 64 +lora_alpha: 32 +lora_dropout: 0.05 +lora_target_linear: true +lora_fan_in_fan_out: + +lora_modules_to_save: ['embed_tokens', 'lm_head'] + +wandb_project: dolphin-2.9-phi3-5b +wandb_entity: +wandb_watch: +wandb_name: +wandb_log_model: + +gradient_accumulation_steps: 4 +micro_batch_size: 8 +num_epochs: 4 +optimizer: adamw_8bit +# adam_beta2: 0.95 +# adam_epsilon: 0.00001 +max_grad_norm: 1.0 +lr_scheduler: cosine +learning_rate: 5e-6 + +train_on_inputs: false +group_by_length: false +bf16: auto +fp16: +tf32: true + +gradient_checkpointing: true +gradient_checkpointing_kwargs: + use_reentrant: True +early_stopping_patience: +resume_from_checkpoint: +local_rank: +logging_steps: 1 +xformers_attention: +flash_attention: true + +warmup_steps: 100 +evals_per_epoch: 4 +saves_per_epoch: 1 +debug: +# deepspeed: deepspeed_configs/zero2.json +weight_decay: 0.1 +fsdp: +fsdp_config: +# resize_token_embeddings_to_32x: true +special_tokens: + eos_token: "<|im_end|>" + pad_token: "<|endoftext|>" +tokens: + - "<|im_start|>" + - "<|im_end|>" diff --git a/configuration.json b/configuration.json new file mode 100644 index 0000000..bbeeda1 --- /dev/null +++ b/configuration.json @@ -0,0 +1 @@ +{"framework": "pytorch", "task": "text-generation", "allow_remote": true} \ No newline at end of file diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..410737b --- /dev/null +++ b/generation_config.json @@ -0,0 +1,8 @@ +{ + "_from_model_config": true, + "bos_token_id": 1, + "do_sample": true, + "eos_token_id": 32000, + "pad_token_id": 32000, + "transformers_version": "4.40.2" +} diff --git a/pytorch_model-00001-of-00002.bin b/pytorch_model-00001-of-00002.bin new file mode 100644 index 0000000..3ed5df0 --- /dev/null +++ b/pytorch_model-00001-of-00002.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f3f12612d4bae417adb74757bc1e5150c3c2fc87610524011818e214d3b825d +size 4991437978 diff --git a/pytorch_model-00002-of-00002.bin b/pytorch_model-00002-of-00002.bin new file mode 100644 index 0000000..58b0fbf --- /dev/null +++ b/pytorch_model-00002-of-00002.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5b5ad1d90ae1e396c09163e16cbcf77240839d22ecd58841092b42364aeb41e4 +size 2650853600 diff --git a/pytorch_model.bin.index.json b/pytorch_model.bin.index.json new file mode 100644 index 0000000..6de8a77 --- /dev/null +++ b/pytorch_model.bin.index.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:25f5a277b216b2269c18487578ce03e2fcbb238ba439c532c8b626f839b77ffe +size 41781 diff --git a/special_tokens_map.json b/special_tokens_map.json new file mode 100644 index 0000000..cb44ea7 --- /dev/null +++ b/special_tokens_map.json @@ -0,0 +1,30 @@ +{ + "bos_token": { + "content": "", + "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": "<|endoftext|>", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false + }, + "unk_token": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false + } +} diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..a8efc0a --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a0e9f35a11553ea38dbd1a89468e6f92a622e93452c2b343565d5ea8bf53a45c +size 1845244 diff --git a/tokenizer.model b/tokenizer.model new file mode 100644 index 0000000..6c00c74 --- /dev/null +++ b/tokenizer.model @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e556afd44213b6bd1be2b850ebbbd98f5481437a8021afaf58ee7fb1818d347 +size 499723 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..aaec810 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,146 @@ +{ + "add_bos_token": true, + "add_eos_token": false, + "added_tokens_decoder": { + "0": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": true + }, + "1": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": true + }, + "2": { + "content": "", + "lstrip": false, + "normalized": false, + "rstrip": true, + "single_word": false, + "special": false + }, + "32000": { + "content": "<|endoftext|>", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": true + }, + "32001": { + "content": "<|assistant|>", + "lstrip": false, + "normalized": false, + "rstrip": true, + "single_word": false, + "special": true + }, + "32002": { + "content": "<|placeholder1|>", + "lstrip": false, + "normalized": false, + "rstrip": true, + "single_word": false, + "special": true + }, + "32003": { + "content": "<|placeholder2|>", + "lstrip": false, + "normalized": false, + "rstrip": true, + "single_word": false, + "special": true + }, + "32004": { + "content": "<|placeholder3|>", + "lstrip": false, + "normalized": false, + "rstrip": true, + "single_word": false, + "special": true + }, + "32005": { + "content": "<|placeholder4|>", + "lstrip": false, + "normalized": false, + "rstrip": true, + "single_word": false, + "special": true + }, + "32006": { + "content": "<|system|>", + "lstrip": false, + "normalized": false, + "rstrip": true, + "single_word": false, + "special": true + }, + "32007": { + "content": "<|end|>", + "lstrip": false, + "normalized": false, + "rstrip": true, + "single_word": false, + "special": true + }, + "32008": { + "content": "<|placeholder5|>", + "lstrip": false, + "normalized": false, + "rstrip": true, + "single_word": false, + "special": true + }, + "32009": { + "content": "<|placeholder6|>", + "lstrip": false, + "normalized": false, + "rstrip": true, + "single_word": false, + "special": true + }, + "32010": { + "content": "<|user|>", + "lstrip": false, + "normalized": false, + "rstrip": true, + "single_word": false, + "special": true + }, + "32011": { + "content": "<|im_end|>", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": false + }, + "32012": { + "content": "<|im_start|>", + "lstrip": false, + "normalized": false, + "rstrip": false, + "single_word": false, + "special": false + } + }, + "bos_token": "", + "chat_template": "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% 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|>", + "legacy": false, + "model_max_length": 4096, + "pad_token": "<|endoftext|>", + "padding_side": "left", + "sp_model_kwargs": {}, + "tokenizer_class": "LlamaTokenizer", + "unk_token": "", + "use_default_system_prompt": false +}