Text Generation
PEFT
Safetensors
Transformers
English
llama
lora
dpo
smollm2
trl
conversational
text-generation-inference
Instructions to use Subject-Emu-5259/NeuralAI with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Subject-Emu-5259/NeuralAI with PEFT:
Base model is not found.
- Transformers
How to use Subject-Emu-5259/NeuralAI with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Subject-Emu-5259/NeuralAI", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Subject-Emu-5259/NeuralAI") model = AutoModelForCausalLM.from_pretrained("Subject-Emu-5259/NeuralAI", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Subject-Emu-5259/NeuralAI with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Subject-Emu-5259/NeuralAI" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Subject-Emu-5259/NeuralAI", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Subject-Emu-5259/NeuralAI
- SGLang
How to use Subject-Emu-5259/NeuralAI with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Subject-Emu-5259/NeuralAI" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Subject-Emu-5259/NeuralAI", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Subject-Emu-5259/NeuralAI" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Subject-Emu-5259/NeuralAI", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Subject-Emu-5259/NeuralAI with Docker Model Runner:
docker model run hf.co/Subject-Emu-5259/NeuralAI
| { | |
| "_comment": "NeuralAI Training Configuration v2.0 - From-Scratch GPT + QLoRA Fine-Tuning Pipeline", | |
| "version": "2.0.0", | |
| "project": "NeuralAI-from-scratch", | |
| "model": { | |
| "base_model": "HuggingFaceTB/SmolLM2-360M-Instruct", | |
| "model_type": "causal_lm", | |
| "architecture": "GPT-style Transformer (from-scratch PyTorch)", | |
| "quantization": { | |
| "load_in_4bit": true, | |
| "bnb_4bit_quant_type": "nf4", | |
| "bnb_4bit_compute_dtype": "bfloat16", | |
| "bnb_4bit_use_double_quant": true | |
| }, | |
| "torch_dtype": "float16", | |
| "device_map": "auto", | |
| "trust_remote_code": false | |
| }, | |
| "lora": { | |
| "r": 16, | |
| "lora_alpha": 32, | |
| "lora_dropout": 0.05, | |
| "bias": "none", | |
| "task_type": "CAUSAL_LM", | |
| "target_modules": [ | |
| "q_proj", | |
| "k_proj", | |
| "v_proj", | |
| "o_proj", | |
| "gate_proj", | |
| "up_proj", | |
| "down_proj" | |
| ], | |
| "modules_to_save": null, | |
| "use_rslora": false | |
| }, | |
| "training": { | |
| "output_dir": "./checkpoints", | |
| "num_train_epochs": 3, | |
| "per_device_train_batch_size": 4, | |
| "per_device_eval_batch_size": 4, | |
| "gradient_accumulation_steps": 4, | |
| "gradient_checkpointing": true, | |
| "learning_rate": 2e-4, | |
| "weight_decay": 0.01, | |
| "max_grad_norm": 1.0, | |
| "warmup_ratio": 0.1, | |
| "lr_scheduler_type": "cosine", | |
| "fp16": false, | |
| "bf16": true, | |
| "optim": "paged_adamw_32bit", | |
| "logging_steps": 10, | |
| "eval_steps": 50, | |
| "save_steps": 100, | |
| "save_total_limit": 3, | |
| "load_best_model_at_end": true, | |
| "evaluation_strategy": "steps", | |
| "report_to": "none", | |
| "seed": 42, | |
| "dataloader_num_workers": 2, | |
| "remove_unused_columns": false, | |
| "group_by_length": true | |
| }, | |
| "data": { | |
| "train_file": "./data/train.jsonl", | |
| "val_file": "./data/val.jsonl", | |
| "text_column": "text", | |
| "chat_template": "chatml", | |
| "max_seq_length": 2048, | |
| "packing": false, | |
| "dataset_num_proc": 4 | |
| }, | |
| "model_configs": { | |
| "_comment": "From-scratch GPT tier configs (no HuggingFace, pure PyTorch)", | |
| "nano": { | |
| "n_layer": 2, | |
| "n_head": 2, | |
| "n_embd": 64, | |
| "context_length": 128, | |
| "params": "~2M", | |
| "vram": "<512MB", | |
| "use_case": "Testing / CI" | |
| }, | |
| "4gb": { | |
| "n_layer": 4, | |
| "n_head": 4, | |
| "n_embd": 256, | |
| "context_length": 256, | |
| "params": "~8M", | |
| "vram": "<2GB", | |
| "use_case": "CPU / 4GB RAM laptop" | |
| }, | |
| "small": { | |
| "n_layer": 6, | |
| "n_head": 6, | |
| "n_embd": 384, | |
| "context_length": 512, | |
| "params": "~30M", | |
| "vram": "~4GB", | |
| "use_case": "Colab T4 / single GPU" | |
| }, | |
| "medium": { | |
| "n_layer": 12, | |
| "n_head": 12, | |
| "n_embd": 768, | |
| "context_length": 1024, | |
| "params": "~124M", | |
| "vram": "~8GB", | |
| "use_case": "GPT-2 equivalent" | |
| }, | |
| "large": { | |
| "n_layer": 24, | |
| "n_head": 16, | |
| "n_embd": 1024, | |
| "context_length": 2048, | |
| "params": "~345M", | |
| "vram": "~24GB", | |
| "use_case": "GPT-2 Medium equivalent" | |
| } | |
| }, | |
| "generation": { | |
| "max_new_tokens": 512, | |
| "temperature": 0.7, | |
| "top_p": 0.9, | |
| "top_k": 50, | |
| "repetition_penalty": 1.2, | |
| "do_sample": true, | |
| "use_kv_cache": true, | |
| "streaming": true | |
| }, | |
| "features": { | |
| "flash_attention": true, | |
| "rope_embeddings": true, | |
| "kv_cache": true, | |
| "gradient_checkpointing": true, | |
| "swiglu_ffn": true, | |
| "weight_tying": true, | |
| "int8_inference": true, | |
| "streaming_generation": true, | |
| "web_ui": true, | |
| "colab_notebook": true | |
| }, | |
| "paths": { | |
| "checkpoints_dir": "./checkpoints", | |
| "data_dir": "./data", | |
| "logs_dir": "./logs", | |
| "from_scratch_dir": "./from-scratch", | |
| "colab_notebook": "./NeuralAI_Colab_Training.ipynb" | |
| }, | |
| "deployment": { | |
| "push_to_hub": false, | |
| "hub_model_id": "Subject-Emu-5259/NeuralAI", | |
| "hub_private": true, | |
| "merge_adapter_on_save": false, | |
| "export_onnx": false | |
| } | |
| } | |