commit 2879d21250ef9f75c258d11945acca5be96a6661 Author: ModelHub XC Date: Tue Jun 16 07:04:17 2026 +0800 初始化项目,由ModelHub XC社区提供模型 Model: shazzadulimun/llama32-3b-aurora-chat-v3 Source: Original Platform diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..52373fe --- /dev/null +++ b/.gitattributes @@ -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 +tokenizer.json filter=lfs diff=lfs merge=lfs -text diff --git a/README.md b/README.md new file mode 100644 index 0000000..ed48217 --- /dev/null +++ b/README.md @@ -0,0 +1,101 @@ +--- +library_name: transformers +license: apache-2.0 +language: [en] +base_model: meta-llama/Llama-3.2-3B-Instruct +pipeline_tag: text-generation +tags: + - aurora + - alcf + - hpc + - intel-gpu + - oneapi + - sycl +--- + +# Llama-3.2-3B-Aurora-Chat v3 + +LoRA fine-tune of [`meta-llama/Llama-3.2-3B-Instruct`](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct) specialized for the +[**ALCF Aurora supercomputer**](https://docs.alcf.anl.gov/aurora/) (Intel Xeon Sapphire +Rapids + Intel GPU Max 1550 / Ponte Vecchio, oneAPI / SYCL, PBS Pro). + +Off-the-shelf code-LLMs hallucinate Aurora specifics — they suggest `nvcc` instead of +`icpx -fsycl`, `srun` / `aprun` instead of `mpiexec`, NERSC's `/global/cfs` instead of +`/lus/flare`, and CUDA device strings instead of `xpu`. This adapter teaches the base +model the actual Aurora toolchain, file system layout, scheduler conventions, and +recommended PyTorch/TensorFlow/SYCL idioms. + +## Model summary + +| | | +|---|---| +| **Base model** | [`meta-llama/Llama-3.2-3B-Instruct`](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct) | +| **Format** | Merged 16-bit — HuggingFace Transformers / vLLM / TGI | +| **Fine-tuning** | LoRA (PEFT) — r=32, α=64, dropout 0.0, 2 epochs | +| **Optimizer** | AdamW fused, lr 2e-4 cosine, warmup 3%, batch 1 × grad-accum 8 | +| **Precision / seq-len** | bf16, 1,536 tokens | +| **Training data** | [`aurora-docs-distill-multirank`](https://github.com/SIslamMun/Generator/tree/aurora-datasets-2026-04-30/datasets/aurora/iter2/data/training/A) — 4,495 ChatML rows | +| **Train loss (final)** | 0.7200 | +| **Hardware** | Aurora node, model-parallel across 1–12 PVC tiles via HF `device_map='auto'`, IPEX + PyTorch 2.10 XPU backend | +| **Eval (53-Q Aurora, 0–5)** | pending | + +## Quick start + +```python +from transformers import AutoModelForCausalLM, AutoTokenizer +import torch + +tok = AutoTokenizer.from_pretrained("shazzadulimun/llama32-3b-aurora-chat-v3") +mdl = AutoModelForCausalLM.from_pretrained("shazzadulimun/llama32-3b-aurora-chat-v3", torch_dtype=torch.bfloat16, device_map="auto") + +msgs = [{"role": "user", "content": "How do I launch one MPI rank per Aurora GPU tile?"}] +ids = tok(tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True), return_tensors="pt").to(mdl.device) +print(tok.decode(mdl.generate(**ids, max_new_tokens=400, temperature=0.0)[0][ids.input_ids.shape[1]:], skip_special_tokens=True)) +``` + + +## Training data + +Distilled from `openai/gpt-oss-120b on ALCF Sophia (vLLM)` over 416 cleaned chunks of +[`docs.alcf.anl.gov/aurora`](https://docs.alcf.anl.gov/aurora/). 4,495 +training rows + 562 validation rows in ChatML format with embedded +chain-of-thought (`**Reasoning:**` / `**Answer:**`). + +**Broad coverage, parallel-rank distillation.** 20 worker ranks each took a *disjoint* slice (~21 chunks) of the cleaned `docs.alcf.anl.gov/aurora` corpus and asked the teacher for chain-of-thought QA pairs. Disjoint slicing maximizes phrasing diversity (each rank sees fresh context) while still covering every chunk exactly once. + +Full corpus + reproduction scripts: +[**SIslamMun/Generator @ aurora-datasets-2026-04-30**](https://github.com/SIslamMun/Generator/tree/aurora-datasets-2026-04-30/datasets/aurora/iter2/data/training/A). + +## Evaluation + +Part of the v3 parameter-size sweep (1B → 120B trained on the same dataset). +Holdout scorecard appears here once the full sweep completes. + +## Limitations + +- **Synthetic-data biases.** Teacher (`gpt-oss-120b`) can confabulate plausible-looking + but incorrect commands. Treat outputs as a verifiable first draft, not authoritative. +- **Doc snapshot is fixed at 2026-04-29.** Module versions, queue names, and APIs change + — anything published after that date isn't reflected here. +- **Aurora-only.** Specifics (`/lus/flare`, `xpu`, PBS queues) won't transfer to Frontier, + Polaris, or other systems. +- **Use temperature ≤ 0.1** for technical answers; higher temps invite invented flag names + and paths. + +## Citation + +```bibtex +@misc{aurora-llms-2026, + title = { Llama-3.2-3B-Aurora-Chat v3 }, + author = { Islam Mun, Shazzadul }, + year = { 2026 }, + url = { https://huggingface.co/shazzadulimun/llama32-3b-aurora-chat-v3 }, + note = { LoRA fine-tune of Llama-3.2-3B-Instruct; data distilled from gpt-oss-120b on docs.alcf.anl.gov/aurora } +} +``` + +## License + +Apache-2.0 for the adapter weights and synthetic training data. Source corpus is public +ALCF user documentation. Base model retains its own license — see +[`meta-llama/Llama-3.2-3B-Instruct`](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct). diff --git a/chat_template.jinja b/chat_template.jinja new file mode 100644 index 0000000..1bad6a0 --- /dev/null +++ b/chat_template.jinja @@ -0,0 +1,93 @@ +{{- bos_token }} +{%- if custom_tools is defined %} + {%- set tools = custom_tools %} +{%- endif %} +{%- if not tools_in_user_message is defined %} + {%- set tools_in_user_message = true %} +{%- endif %} +{%- if not date_string is defined %} + {%- if strftime_now is defined %} + {%- set date_string = strftime_now("%d %b %Y") %} + {%- else %} + {%- set date_string = "26 Jul 2024" %} + {%- endif %} +{%- endif %} +{%- if not tools is defined %} + {%- set tools = none %} +{%- endif %} + +{#- This block extracts the system message, so we can slot it into the right place. #} +{%- if messages[0]['role'] == 'system' %} + {%- set system_message = messages[0]['content']|trim %} + {%- set messages = messages[1:] %} +{%- else %} + {%- set system_message = "" %} +{%- endif %} + +{#- System message #} +{{- "<|start_header_id|>system<|end_header_id|>\n\n" }} +{%- if tools is not none %} + {{- "Environment: ipython\n" }} +{%- endif %} +{{- "Cutting Knowledge Date: December 2023\n" }} +{{- "Today Date: " + date_string + "\n\n" }} +{%- if tools is not none and not tools_in_user_message %} + {{- "You have access to the following functions. To call a function, please respond with JSON for a function call." }} + {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }} + {{- "Do not use variables.\n\n" }} + {%- for t in tools %} + {{- t | tojson(indent=4) }} + {{- "\n\n" }} + {%- endfor %} +{%- endif %} +{{- system_message }} +{{- "<|eot_id|>" }} + +{#- Custom tools are passed in a user message with some extra guidance #} +{%- if tools_in_user_message and not tools is none %} + {#- Extract the first user message so we can plug it in here #} + {%- if messages | length != 0 %} + {%- set first_user_message = messages[0]['content']|trim %} + {%- set messages = messages[1:] %} + {%- else %} + {{- raise_exception("Cannot put tools in the first user message when there's no first user message!") }} +{%- endif %} + {{- '<|start_header_id|>user<|end_header_id|>\n\n' -}} + {{- "Given the following functions, please respond with a JSON for a function call " }} + {{- "with its proper arguments that best answers the given prompt.\n\n" }} + {{- 'Respond in the format {"name": function name, "parameters": dictionary of argument name and its value}.' }} + {{- "Do not use variables.\n\n" }} + {%- for t in tools %} + {{- t | tojson(indent=4) }} + {{- "\n\n" }} + {%- endfor %} + {{- first_user_message + "<|eot_id|>"}} +{%- endif %} + +{%- for message in messages %} + {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %} + {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\n\n'+ message['content'] | trim + '<|eot_id|>' }} + {%- elif 'tool_calls' in message %} + {%- if not message.tool_calls|length == 1 %} + {{- raise_exception("This model only supports single tool-calls at once!") }} + {%- endif %} + {%- set tool_call = message.tool_calls[0].function %} + {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' -}} + {{- '{"name": "' + tool_call.name + '", ' }} + {{- '"parameters": ' }} + {{- tool_call.arguments | tojson }} + {{- "}" }} + {{- "<|eot_id|>" }} + {%- elif message.role == "tool" or message.role == "ipython" %} + {{- "<|start_header_id|>ipython<|end_header_id|>\n\n" }} + {%- if message.content is mapping or message.content is iterable %} + {{- message.content | tojson }} + {%- else %} + {{- message.content }} + {%- endif %} + {{- "<|eot_id|>" }} + {%- endif %} +{%- endfor %} +{%- if add_generation_prompt %} + {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }} +{%- endif %} diff --git a/config.json b/config.json new file mode 100644 index 0000000..e4d88fc --- /dev/null +++ b/config.json @@ -0,0 +1,37 @@ +{ + "architectures": [ + "LlamaForCausalLM" + ], + "attention_bias": false, + "attention_dropout": 0.0, + "bos_token_id": 128000, + "dtype": "bfloat16", + "eos_token_id": 128009, + "head_dim": 128, + "hidden_act": "silu", + "hidden_size": 3072, + "initializer_range": 0.02, + "intermediate_size": 8192, + "max_position_embeddings": 131072, + "mlp_bias": false, + "model_type": "llama", + "num_attention_heads": 24, + "num_hidden_layers": 28, + "num_key_value_heads": 8, + "pad_token_id": 128004, + "pretraining_tp": 1, + "rms_norm_eps": 1e-05, + "rope_parameters": { + "factor": 32.0, + "high_freq_factor": 4.0, + "low_freq_factor": 1.0, + "original_max_position_embeddings": 8192, + "rope_theta": 500000.0, + "rope_type": "llama3" + }, + "tie_word_embeddings": true, + "transformers_version": "5.5.1", + "unsloth_fixed": true, + "use_cache": false, + "vocab_size": 128256 +} diff --git a/generation_config.json b/generation_config.json new file mode 100644 index 0000000..5d1a495 --- /dev/null +++ b/generation_config.json @@ -0,0 +1,14 @@ +{ + "bos_token_id": 128000, + "do_sample": true, + "eos_token_id": [ + 128001, + 128008, + 128009 + ], + "max_length": 131072, + "pad_token_id": 128004, + "temperature": 0.6, + "top_p": 0.9, + "transformers_version": "5.5.1" +} diff --git a/model.safetensors b/model.safetensors new file mode 100644 index 0000000..5ece527 --- /dev/null +++ b/model.safetensors @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4f7d96a63eca16dac5efdbf3ebfe1665bd6fa299c3dfa9b0e8e6ded05c29eafa +size 6425529112 diff --git a/tokenizer.json b/tokenizer.json new file mode 100644 index 0000000..1c1d8d5 --- /dev/null +++ b/tokenizer.json @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b9e4e7fb171f92fd137b777cc2714bf87d11576700a1dcd7a399e7bbe39537b +size 17209920 diff --git a/tokenizer_config.json b/tokenizer_config.json new file mode 100644 index 0000000..8ac9ac8 --- /dev/null +++ b/tokenizer_config.json @@ -0,0 +1,16 @@ +{ + "backend": "tokenizers", + "bos_token": "<|begin_of_text|>", + "clean_up_tokenization_spaces": true, + "eos_token": "<|eot_id|>", + "is_local": false, + "model_input_names": [ + "input_ids", + "attention_mask" + ], + "model_max_length": 131072, + "pad_token": "<|finetune_right_pad_id|>", + "padding_side": "left", + "tokenizer_class": "TokenizersBackend", + "unk_token": null +}