Text Generation
Transformers
English
qwen2
code-generation
python
fine-tuning
Qwen
tools
agent-framework
multi-agent
conversational
Eval Results (legacy)
Run this model with HF Jobs
Run my-ai-stack/Stack-2-9-finetuned on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/my-ai-stack/Stack-2-9-finetuned. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/my-ai-stack/Stack-2-9-finetuned on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/my-ai-stack/Stack-2-9-finetuned. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/my-ai-stack/Stack-2-9-finetuned. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use my-ai-stack/Stack-2-9-finetuned with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use my-ai-stack/Stack-2-9-finetuned with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="my-ai-stack/Stack-2-9-finetuned") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("my-ai-stack/Stack-2-9-finetuned") model = AutoModelForCausalLM.from_pretrained("my-ai-stack/Stack-2-9-finetuned", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use my-ai-stack/Stack-2-9-finetuned with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "my-ai-stack/Stack-2-9-finetuned" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/my-ai-stack/Stack-2-9-finetuned
- SGLang
How to use my-ai-stack/Stack-2-9-finetuned 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 "my-ai-stack/Stack-2-9-finetuned" \ --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": "my-ai-stack/Stack-2-9-finetuned", "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 "my-ai-stack/Stack-2-9-finetuned" \ --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": "my-ai-stack/Stack-2-9-finetuned", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use my-ai-stack/Stack-2-9-finetuned with Docker Model Runner:
docker model run hf.co/my-ai-stack/Stack-2-9-finetuned
Commit History
-
Add git lfs tracking for large jsonl files
walidsobhie-code29a776a -
Fix Gradio/huggingface_hub version compatibility
walidsobhie-code +1: Claude Opus 4.6- Add gradio>=4.12.0 and huggingface_hub>=0.20.0 to requirements - Update Dockerfile to upgrade both packages before install - Add MODEL_CARD.md and merge_adapter.py Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>97fa10c -
Add ddgs for free web search
walidsobhie-code729d832 -
Add real web search with ddgs (DuckDuckGo HTML scraper, free, no API key)
walidsobhie-code0fbc572 -
Fix search with DuckDuckGo API (proper JSON parsing)
walidsobhie-code35799ef -
Use local model instead of HF for faster loading
walidsobhie-code3c29912 -
Add web search command (search:query) with DuckDuckGo API
walidsobhie-code40b1cc9 -
Load model from HF: my-ai-stack/stack-2-9-finetuned
walidsobhie-code217c8d8 -
Improve chat.py with system prompt and User/Assistant format
walidsobhie-code2aa22b3 -
Add interactive chat script with improved generation settings
walidsobhie-code7a8afa9
-
feat: add code completion generator and model registry tools
walidsobhie-code- scripts/generate_code_completion_data.py: Multi-language code completion generator - scripts/model_info.py: Model metadata extraction tool - scripts/compare_models.py: Compare model versions - MODEL_REGISTRY.md: Version tracking documentation - training-data/README.md: Training data format docs4ca507e -
feat: add 5000 more tool calling examples (total: 6500)
walidsobhie-code- training-data-expanded/tool_examples.jsonl: 5000 additional examples - Combined with existing 1500 = 6500 total tool calling examples - Ready for next fine-tuning round2e091e7 -
feat: add training recipes for T4 QLoRA, A100, local training
walidsobhie-code- training-configs/recipes.md - Guide for 1.5B/7B/32B configurations - training-configs/t4-qlora.yaml - Optimized LoRA for T4 16GB - training-configs/local-pretrain.sh - Auto-detect GPU and run traininge4ff487 -
feat: add evaluation datasets (HumanEval 50, MBPP 100, Tool scenarios 50)
walidsobhie-code20a06fb -
feat: add production infrastructure - CI/CD, Docker, code quality, and monitoring
walidsobhie-codeCI/CD: - .github/workflows/ci.yml - Python lint + test workflow - .github/workflows/benchmark.yml - Periodic benchmark workflow - .github/ISSUE_TEMPLATE/ - Bug report + feature request templates Docker: - Dockerfile.gpu - Multi-stage NVIDIA GPU build - docker-compose.gpu.yml - GPU deployment with healthcheck - .dockerignore - Excludes training/model weights from build Code Quality: - pyproject.toml - Ruff, black, mypy, pytest configs - .ruff.toml - Ruff linter rules - Makefile - lint, format, test, check commands - scripts/check_types.sh - Type checking runner Data & Monitoring: - scripts/augment_training_data.py - 2x-5x data augmentation - scripts/validate_training_data.py - JSONL validation - docs/DATA_FORMAT.md - Training data format docs - .modelcard.yml - HuggingFace model card metadata - MLproject - MLflow experiment trackingb5998ff -
feat: add inference API, quickstart guide, roadmap, and combined tool data
walidsobhie-codeCreated: - inference_api.py: FastAPI server with /generate, /chat, /health endpoints - requirements_api.txt: FastAPI dependencies - docs/API.md: API documentation - docs/QUICKSTART.md: 5-minute quickstart guide - README_QUICKSTART.md: Simplified landing page - docs/ROADMAP.md: Project roadmap (current → long-term) - CONTRIBUTING.md: Contributor guidelines - docs/TOOL_DATA_ANALYSIS.md: Tool data analysis report - training-data/tool_examples_combined.jsonl: 1500 tool_calling examples (balanced 5 tools) Total tool calling training data: 1500 examples - Grep: 300 - FileRead: 300 - WebSearch: 300 - Bash: 300 - FileWrite: 300b03a8a0 -
feat: add evaluation scripts, tool calling data generator, and 7B training configs
walidsobhie-codeCreated: - test_model.py: 602 lines - basic code generation tests - evaluate_model.py: 847 lines - HumanEval/MBPP benchmark evaluation with pass@k - scripts/generate_tool_data.py: 615 lines - synthetic tool_calling data generator - training-data/tool_examples.jsonl: 1000 synthetic tool_calling examples - training-configs/7b-lora-config.yaml: A100 80GB full LoRA config - training-configs/kaggle-7b-qlora.sh: QLoRA script for 7B on Kaggle T4 - docs/TRAINING_7B.md: 7B training documentation with VRAM estimates Updated: - merge_simple.py: Improved merge logic - .gitignore: Clean ignores Note: tool_examples.jsonl has 1000 synthetic tool_calling examples ready for fine-tuning183b3b6 -
fix: remove Google Drive mount (Colab-only) - use Kaggle output + GitHub push instead
walidsobhie-code- Removed google.colab dependency (doesn't work on Kaggle) - Added GitHub push cell to save model permanently - Added warning to download outputs before session expires - Kaggle-compatible nowa8f2981 -
feat: add Google Drive auto-save to prevent losing model outputs
walidsobhie-code- Mount Google Drive after cloning repo - Auto-copy merged model to Drive after merge completes - Output saved to MyDrive/stack-2.9-output/ - Prevents losing model when Kaggle session expires65c52b2 -
feat: add model testing and evaluation scripts
walidsobhie-code- test_model.py: Basic code generation tests for common algorithms - evaluate_model.py: HumanEval + MBPP benchmark evaluation - Both support --model-path argument for easy use - pass@k metrics calculation includedf4b31b2 -
fix: add numpy import at top to ensure it's loaded (fixes Numpy not available error)
walidsobhie-code7adbecc -
fix: disable AMP (fp16=False, bf16=False) to bypass P100 GradScaler bug
walidsobhie-code27a755a -
fix: load model in FP32 to avoid AMP gradient scaling conflict
walidsobhie-code- Non-quantized models now load with torch_dtype=torch.float32 - Trainer fp16=True handles casting during training (AMP) - Prevents 'GradScaler expects FP32 master weights' errors - Keeps gradient checkpointing and LoRA intactb098bb5 -
fix: proper variable ordering for bf16/fp16 detection — define before use
walidsobhie-codee78785b -
fixes for Kaggle run
walidsobhie-code- train_simple_nobnb.py: define use_fp16 before model load (fixes NameError) - train_simple_nobnb.py: remove later duplicate BF16 detection - Notebook: add NumPy<2 downgrade cell to fix NumPy 2.0 compatibility - Notebook: correct config to fp16=True, bf16=False (clarity)bb61f7c -
fix: define use_fp16 before model load; remove duplicate
walidsobhie-code- Moved use_fp16=True definition before load_model_and_tokenizer call - Removed later duplicate BF16 detection (now redundant) - Eliminates 'use_fp16 undefined' NameError - Keeps FP16 forced for T4 compatibility5ac765e -
fix: load model in fp16 to match fp16 training precision (bf16 not supported on P100/T4)
walidsobhie-code445d8a0 -
fix: force FP16 and disable BF16 for T4 compatibility
walidsobhie-code- TrainingArguments: bf16=False, fp16=True (forced) - Removes any ambiguity about dtype selection - T4 doesn't support BF16 compute, so this is mandatory - Should eliminate any remaining BF16-related errors896f8a1 -
fix: use torch.cuda.is_bf16_supported() instead of compute capability check
walidsobhie-codec2a0307 -
fix: load model in bfloat16, train in fp16 on T4 (bf16 not supported on Turing)
walidsobhie-code15ef1c5 -
fix: set expandable_segments=False to fix PyTorch #124807 gradient checkpointing bug
walidsobhie-code98e3329 -
fix: use device_map={'': cuda} to force all model layers on GPU (fixes gradient flow issue)
walidsobhie-codec2013aa -
fix: use device_map=auto for 1.5B model, add model.train() after LoRA
walidsobhie-codecd96c3d -
chore: use Qwen2.5-Coder-1.5B for Kaggle T4 (7B doesn't fit in 16GB)
walidsobhie-codefffdf6d -
fix: use device_map=None for single GPU (T4) to avoid meta tensor errors with float16
walidsobhie-code7d0f28b -
fix: fallback to fp16 when bf16 requested but GPU doesn't support it (T4/Pascal)
walidsobhie-codebdf34ba -
fix: resolve CUDA OOM on T4 by using bfloat16, device_map=auto, and enabling gradient checkpointing
walidsobhie-code- Change model dtype from float16 to bfloat16 - Change device_map from explicit cuda to 'auto' for intelligent memory - Add low_cpu_mem_usage=True to reduce peak RAM during loading - Enable gradient checkpointing in TrainingArguments (was disabled) - Fix bf16/fp16 config resolution to actually use bf16 - Add PYTORCH_CUDA_ALLOC_CONF for memory fragmentation handling - Add paged_adamw_32bit optimizer for quantized trainingc82e627 -
fix: revert device_map=auto (AMP gradient conflict on T4, use explicit cuda device instead)
walidsobhie-codefdeb8f3 -
fix: disable gradient checkpointing (conflicts with LoRA on T4, breaks backward pass)
walidsobhie-code07b92ca -
fix: switch bf16->fp16 (Kaggle T4/P100 is Pascal, no Ampere bf16 support)
walidsobhie-code6e6bd1d -
fix: add numpy to pip install deps for device_map=auto CPU offload
walidsobhie-codefc98957 -
fix OOM: use device_map=auto with CPU offload + float16
walidsobhie-code54daa38 -
fix: reduce memory for T4 GPU
walidsobhie-code- LoRA r: 16 -> 8 - LoRA lora_alpha: 32 -> 16 - Batch size already 1 - Gradient accumulation: 8 -> 4 (effective batch=4) - Saves memory while maintaining training stability6badaa9 -
fix: add missing datasets import in train_simple_nobnb.py
walidsobhie-codef2c605a -
revert bitsandbytes: CUDA 13 runtime missing on Kaggle
walidsobhie-codebitsandbytes 4-bit quantization requires libnvJitLink.so.13 which is not available in the Kaggle CUDA 11.8 environment. Switching back to bfloat16-only training (no quantization): - train_simple_nobnb.py: bfloat16 by default, 4-bit as opt-in flag - notebook: use_4bit=False, no bitsandbytes pip install - merge_simple.py: also uses bfloat16 for consistency VRAM usage with bf16 LoRA on T4 should still be manageable with batch_size=1 + gradient_accumulation=8732bef9 -
fix OOM: enable 4-bit NF4 quantization + bf16 training
walidsobhie-codetrain_simple_nobnb.py: - Add BitsAndBytesConfig for 4-bit quantization (nf4, bfloat16, double quant) - Switch from float16 to bfloat16 as default dtype - Use use_4bit flag from config to conditionally enable quantization - Force bf16=True in TrainingArguments (works for both full + quantized) kaggle_train_stack29_v5.ipynb: - Install bitsandbytes in dependencies - Config: quantization.enabled=True, hardware.use_4bit=True - Config: bf16=True, fp16=False - Updated header notes showing VRAM now ~12GB (was ~16GB+) Fixes CUDA OOM on T4 (15.89GB) when loading full 7B model in fp164ce3e59 -
fix: force PyTorch 2.2.0+cu118 for P100 (sm_60) GPU compatibility
walidsobhie-code9150ac1 -
fix: use explicit cuda device map and use_reentrant=False for gradient checkpointing
walidsobhie-code3bfb6ea -
fix OOM: batch_size 2->1, gradient_accumulation 4->8 for T4 GPU
walidsobhie-codecd564ae
-
fix: use lora_dropout instead of dropout for PEFT compatibility
walidsobhie-code976675d