Text Generation
Transformers
English
qwen2
code-generation
python
fine-tuning
Qwen
tools
agent-framework
multi-agent
conversational
Eval Results (legacy)
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)# 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") 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 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
walidsobhie-code Claude Opus 4.6 commited on
Commit ·
87ed83d
1
Parent(s): a075b90
fix: improve Kaggle notebook training
Browse files- Fix training command for better output
- Add clear variable placeholders
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
notebooks/kaggle_128k_training.ipynb
CHANGED
|
@@ -43,14 +43,7 @@
|
|
| 43 |
"execution_count": null,
|
| 44 |
"metadata": {},
|
| 45 |
"outputs": [],
|
| 46 |
-
"source":
|
| 47 |
-
"import os\n",
|
| 48 |
-
"from huggingface_hub import login\n",
|
| 49 |
-
"\n",
|
| 50 |
-
"# Add HF_TOKEN to Kaggle Secrets: https://www.kaggle.com/docs/secrets\n",
|
| 51 |
-
"HF_TOKEN = \"YOUR_HF_TOKEN\" # ← Replace with your token (or use Kaggle Secrets)\n",
|
| 52 |
-
"login(token=HF_TOKEN)"
|
| 53 |
-
]
|
| 54 |
},
|
| 55 |
{
|
| 56 |
"cell_type": "markdown",
|
|
@@ -64,27 +57,7 @@
|
|
| 64 |
"execution_count": null,
|
| 65 |
"metadata": {},
|
| 66 |
"outputs": [],
|
| 67 |
-
"source":
|
| 68 |
-
"import subprocess, os\n",
|
| 69 |
-
"os.chdir(\"/kaggle/working/stack-2.9\")\n",
|
| 70 |
-
"\n",
|
| 71 |
-
"env = dict(os.environ, HF_TOKEN=HF_TOKEN)\n",
|
| 72 |
-
"\n",
|
| 73 |
-
"result = subprocess.run([\n",
|
| 74 |
-
" \"python3\", \"training/train_extended_context.py\",\n",
|
| 75 |
-
" \"--model-path\", \"Qwen/Qwen2.5-Coder-1.5B\",\n",
|
| 76 |
-
" \"--data-path\", \"training/training-data/tool_examples_combined.jsonl\",\n",
|
| 77 |
-
" \"--output-dir\", \"/kaggle/working/stack-2.9-128k\",\n",
|
| 78 |
-
" \"--context-length\", \"131072\",\n",
|
| 79 |
-
" \"--lora-rank\", \"64\",\n",
|
| 80 |
-
" \"--epochs\", \"3\",\n",
|
| 81 |
-
" \"--push-to-hub\",\n",
|
| 82 |
-
" \"--hub-model-id\", \"YOUR_USERNAME/stack-2.9-128k\" # ← Replace with your username\n",
|
| 83 |
-
"], env=env, capture_output=True, text=True)\n",
|
| 84 |
-
"\n",
|
| 85 |
-
"print(\"STDOUT:\", result.stdout[-5000:] if result.stdout else \"None\")\n",
|
| 86 |
-
"print(\"STDERR:\", result.stderr[-2000:] if result.stderr else \"None\")"
|
| 87 |
-
]
|
| 88 |
},
|
| 89 |
{
|
| 90 |
"cell_type": "markdown",
|
|
@@ -109,8 +82,13 @@
|
|
| 109 |
"accelerator": "GPU",
|
| 110 |
"dataSources": [],
|
| 111 |
"dockerImageVersion": "gpu",
|
| 112 |
-
"gpuRequirements": {
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
},
|
| 115 |
"kernelspec": {
|
| 116 |
"display_name": "Python 3",
|
|
@@ -124,4 +102,4 @@
|
|
| 124 |
},
|
| 125 |
"nbformat": 4,
|
| 126 |
"nbformat_minor": 4
|
| 127 |
-
}
|
|
|
|
| 43 |
"execution_count": null,
|
| 44 |
"metadata": {},
|
| 45 |
"outputs": [],
|
| 46 |
+
"source": "import os\nfrom huggingface_hub import login\n\n# Replace with your actual HF token\nHF_TOKEN = \"YOUR_HF_TOKEN\" # ← Replace with your token\nlogin(token=HF_TOKEN)\nprint(\"✓ Logged in to HuggingFace\")"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
},
|
| 48 |
{
|
| 49 |
"cell_type": "markdown",
|
|
|
|
| 57 |
"execution_count": null,
|
| 58 |
"metadata": {},
|
| 59 |
"outputs": [],
|
| 60 |
+
"source": "import os\nos.chdir(\"/kaggle/working/stack-2.9\")\n\n# Training parameters - UPDATE THESE\nYOUR_HF_TOKEN = \"YOUR_HF_TOKEN\" # ← Replace with your HF token\nYOUR_USERNAME = \"your-username\" # ← Replace with your HF username\n\n# Run training\n!python training/train_extended_context.py \\\n --model-path Qwen/Qwen2.5-Coder-1.5B \\\n --data-path training/training-data/tool_examples_combined.jsonl \\\n --output-dir /kaggle/working/stack-2.9-128k \\\n --context-length 131072 \\\n --lora-rank 64 \\\n --epochs 3 \\\n --batch-size 1 \\\n --grad-accum 16 \\\n --push-to-hub \\\n --hub-model-id {YOUR_USERNAME}/stack-2.9-128k"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
},
|
| 62 |
{
|
| 63 |
"cell_type": "markdown",
|
|
|
|
| 82 |
"accelerator": "GPU",
|
| 83 |
"dataSources": [],
|
| 84 |
"dockerImageVersion": "gpu",
|
| 85 |
+
"gpuRequirements": {
|
| 86 |
+
"top": "p100"
|
| 87 |
+
},
|
| 88 |
+
"kernelImage": {
|
| 89 |
+
"id": "docker",
|
| 90 |
+
"name": "docker"
|
| 91 |
+
}
|
| 92 |
},
|
| 93 |
"kernelspec": {
|
| 94 |
"display_name": "Python 3",
|
|
|
|
| 102 |
},
|
| 103 |
"nbformat": 4,
|
| 104 |
"nbformat_minor": 4
|
| 105 |
+
}
|