Downloads · 30 days
25
6% of all-time downloads
lhpku20010120/llama3.1-8b-k12kgraph
llama3.1-8b-k12kgraph is a text generation model from lhpku20010120. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as llama3.1.
Downloads · 30 days
25
6% of all-time downloads
All-time downloads
401
Public
Parameters
8B
16.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors16.1 GB · 100%
From the Hugging Face model README
Built with Llama.
Llama3.1-8B-K12KGraph is a full-parameter supervised fine-tuning (SFT) model based on meta-llama/Llama-3.1-8B. It was trained on the K12-Train data associated with the K12-KGraph project for educational question answering.
This repository contains a standalone Transformers checkpoint. The original Llama-3.1-8B weights do not need to be downloaded separately.
The model is intended for research on K-12 educational question answering, knowledge-intensive reasoning, and evaluation of models trained with knowledge-graph-derived educational data.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "lhpku20010120/llama3.1-8b-k12kgraph"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{
"role": "user",
"content": "Explain the difference between the light-dependent and light-independent reactions in photosynthesis.",
}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
).to(model.device)
with torch.inference_mode():
outputs = model.generate(
inputs,
max_new_tokens=512,
do_sample=False,
)
answer = tokenizer.decode(
outputs[0, inputs.shape[-1]:],
skip_special_tokens=True,
)
print(answer)
The checkpoint uses the included chat_template.jinja, which follows the
Llama 3 chat format with role headers and end-of-turn tokens.
The following information was recovered from the exported trainer metadata:
| Setting | Value |
|---|---|
| Base model | meta-llama/Llama-3.1-8B |
| Epochs | 3 |
| Per-device batch size | 1 |
| Gradient accumulation | 4 |
| Number of devices | 8 |
| Effective global batch size | 32 |
| Learning rate | 5e-6 |
| Scheduler | cosine |
| Warmup ratio | 0.1 |
| Optimizer | AdamW |
| Seed | 42 |
| Transformers | 4.56.2 |
| PyTorch | 2.5.1+cu121 |
| Datasets | 3.2.0 |
| Tokenizers | 0.22.2 |
Use of this model is subject to the Llama 3.1 Community License and the Llama 3.1 Acceptable Use Policy. Users are also responsible for complying with the licenses and terms associated with the training data, benchmark data, and generated content. The release of model weights does not grant rights to reproduce any third-party textbook or benchmark material.
Built with Llama. This model is based on Llama 3.1 8B and was trained with LLaMA-Factory. Please cite the Llama 3.1 and K12-KGraph projects when using this checkpoint in research.