nexus-plus-v2 / README.md
JustScriptzz's picture
Upload README.md with huggingface_hub
29f9089 verified
|
Raw
History Blame Contribute Delete
3.02 kB
metadata
license: apache-2.0
language:
  - en
  - it
tags:
  - qwen3
  - qlora
  - fine-tuned
  - instruction-tuning
  - peft
  - safetensors
library_name: peft
base_model: Qwen/Qwen3-4B-Base

Nexus Plus v2

A 4.05B parameter causal language model fine-tuned from Qwen3-4B-Base using QLoRA on ~50k instruction examples.

Try it Online

Test the model directly in your browser:

Try Chat GitHub

Model Details

Parameter Value
Base model Qwen/Qwen3-4B-Base
Total parameters 4.05B
Trainable parameters 33M (LoRA)
LoRA rank 16
LoRA alpha 32
Target modules q_proj, v_proj
Quantization 4-bit (QLoRA)
Precision BF16

How to Use

With PEFT (adapters only)

from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

base_model = AutoModelForCausalLM.from_pretrained(
    "Qwen/Qwen3-4B-Base",
    torch_dtype="auto",
    device_map="auto"
)
model = PeftModel.from_pretrained(base_model, "JustScriptzz/nexus-plus-v2")
tokenizer = AutoTokenizer.from_pretrained("JustScriptzz/nexus-plus-v2")

messages = [
    {"role": "user", "content": "What is Python?"}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Merged model (recommended)

This repo contains the fully merged model (LoRA weights baked into base). No PEFT needed:

from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "JustScriptzz/nexus-plus-v2",
    torch_dtype="auto",
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("JustScriptzz/nexus-plus-v2")

messages = [
    {"role": "user", "content": "What is Python?"}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Training

  • Base model: Qwen3-4B-Base (4.05B params, 4-bit quantized)
  • Dataset: ~50k instruction examples (Dolly-15k, synthetic QA, general instruction data)
  • Method: QLoRA (rank 16, alpha 32, targeting q_proj and v_proj)
  • Hardware: RTX 5060 Ti 16GB
  • Training time: ~7 hours
  • Steps: 5,634
  • Final loss: 1.45

Limitations

  • Fine-tuned on a relatively small dataset
  • May not generalize well to all domains
  • Best used as a learning experiment or starting point for further fine-tuning

License

Apache 2.0