Text Generation
Transformers
Safetensors
GGUF
English
code
code-generation
multimodal
llama
conversational
Instructions to use mrsandip/Alfa-Code with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mrsandip/Alfa-Code with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mrsandip/Alfa-Code")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("mrsandip/Alfa-Code", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use mrsandip/Alfa-Code with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf mrsandip/Alfa-Code:Q4_0 # Run inference directly in the terminal: llama cli -hf mrsandip/Alfa-Code:Q4_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf mrsandip/Alfa-Code:Q4_0 # Run inference directly in the terminal: llama cli -hf mrsandip/Alfa-Code:Q4_0
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf mrsandip/Alfa-Code:Q4_0 # Run inference directly in the terminal: ./build/bin/llama cli -hf mrsandip/Alfa-Code:Q4_0
Use Docker
docker model run hf.co/mrsandip/Alfa-Code:Q4_0
- Llama new
- LM Studio
- Jan
- vLLM
How to use mrsandip/Alfa-Code with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mrsandip/Alfa-Code" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mrsandip/Alfa-Code", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mrsandip/Alfa-Code:Q4_0
- SGLang
How to use mrsandip/Alfa-Code 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 "mrsandip/Alfa-Code" \ --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": "mrsandip/Alfa-Code", "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 "mrsandip/Alfa-Code" \ --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": "mrsandip/Alfa-Code", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use mrsandip/Alfa-Code with Ollama:
ollama run hf.co/mrsandip/Alfa-Code:Q4_0
- Unsloth Desktop
- Docker Model Runner
How to use mrsandip/Alfa-Code with Docker Model Runner:
docker model run hf.co/mrsandip/Alfa-Code:Q4_0
- Lemonade
How to use mrsandip/Alfa-Code with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mrsandip/Alfa-Code:Q4_0
Run and chat with the model
lemonade run user.Alfa-Code-Q4_0
List all available models
lemonade list
- Atomic Chat
Fix 401: add HF_TOKEN login cell
Browse files- notebooks/colab_t4.ipynb +1 -47
notebooks/colab_t4.ipynb
CHANGED
|
@@ -1,47 +1 @@
|
|
| 1 |
-
{
|
| 2 |
-
"cells": [
|
| 3 |
-
{
|
| 4 |
-
"cell_type": "markdown",
|
| 5 |
-
"metadata": {},
|
| 6 |
-
"source": ["# Alfa-Code Tiny-50M — Colab Free T4\n", "Runtime → Change runtime type → T4 GPU. Then Run all."]
|
| 7 |
-
},
|
| 8 |
-
{
|
| 9 |
-
"cell_type": "code",
|
| 10 |
-
"execution_count": null,
|
| 11 |
-
"metadata": {},
|
| 12 |
-
"outputs": [],
|
| 13 |
-
"source": ["!nvidia-smi --query-gpu=name,memory.total --format=csv\n", "!pip install -q torch transformers datasets tokenizers accelerate huggingface_hub"]
|
| 14 |
-
},
|
| 15 |
-
{
|
| 16 |
-
"cell_type": "code",
|
| 17 |
-
"execution_count": null,
|
| 18 |
-
"metadata": {},
|
| 19 |
-
"outputs": [],
|
| 20 |
-
"source": ["from huggingface_hub import snapshot_download\n", "snapshot_download('mrsandip/Alfa-Code', local_dir='/content/alfa', repo_type='model')\n", "%cd /content/alfa\n", "!ls scripts/ data/processed/"]
|
| 21 |
-
},
|
| 22 |
-
{
|
| 23 |
-
"cell_type": "code",
|
| 24 |
-
"execution_count": null,
|
| 25 |
-
"metadata": {},
|
| 26 |
-
"outputs": [],
|
| 27 |
-
"source": ["# bigger data (500 rows) for real train\n", "!python scripts/download_data.py --dataset code_small_test --max-rows 2000\n", "!python scripts/train_tokenizer.py\n", "!ls -lh tokenizers/ data/processed/"]
|
| 28 |
-
},
|
| 29 |
-
{
|
| 30 |
-
"cell_type": "code",
|
| 31 |
-
"execution_count": null,
|
| 32 |
-
"metadata": {},
|
| 33 |
-
"outputs": [],
|
| 34 |
-
"source": ["!python scripts/train_hf.py --data data/processed/train.jsonl --out /content/outputs/tiny-50M --epochs 1\n", "!ls -lh /content/outputs/tiny-50M"]
|
| 35 |
-
},
|
| 36 |
-
{
|
| 37 |
-
"cell_type": "code",
|
| 38 |
-
"execution_count": null,
|
| 39 |
-
"metadata": {},
|
| 40 |
-
"outputs": [],
|
| 41 |
-
"source": ["# push back to Hub (set HF_TOKEN in Colab Secrets)\n", "import os\n", "from huggingface_hub import HfApi\n", "tok = os.getenv('HF_TOKEN')\n", "api = HfApi(token=tok)\n", "api.upload_folder(folder_path='/content/outputs/tiny-50M', repo_id='mrsandip/Alfa-Code', path_in_repo='outputs/tiny-50M')\n", "print('uploaded')"]
|
| 42 |
-
}
|
| 43 |
-
],
|
| 44 |
-
"metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}},
|
| 45 |
-
"nbformat": 4,
|
| 46 |
-
"nbformat_minor": 5
|
| 47 |
-
}
|
|
|
|
| 1 |
+
{"cells": [{"cell_type": "markdown", "metadata": {}, "source": ["# Alfa-Code Tiny-50M \u00e2\u20ac\u201d Colab Free T4\n", "Runtime \u00e2\u2020\u2019 Change runtime type \u00e2\u2020\u2019 T4 GPU. Then Run all."]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from huggingface_hub import login\n", "from google.colab import userdata\n", "tok = userdata.get('HF_TOKEN')\n", "login(token=tok)\n", "print('logged in')\n"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["!nvidia-smi --query-gpu=name,memory.total --format=csv\n", "!pip install -q torch transformers datasets tokenizers accelerate huggingface_hub"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["from huggingface_hub import snapshot_download\n", "snapshot_download('mrsandip/Alfa-Code', local_dir='/content/alfa', repo_type='model', token=tok)\n", "%cd /content/alfa\n", "!ls scripts/ data/processed/"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["# bigger data (500 rows) for real train\n", "!python scripts/download_data.py --dataset code_small_test --max-rows 2000\n", "!python scripts/train_tokenizer.py\n", "!ls -lh tokenizers/ data/processed/"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["!python scripts/train_hf.py --data data/processed/train.jsonl --out /content/outputs/tiny-50M --epochs 1\n", "!ls -lh /content/outputs/tiny-50M"]}, {"cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": ["# push back to Hub (set HF_TOKEN in Colab Secrets)\n", "import os\n", "from huggingface_hub import HfApi\n", "tok = os.getenv('HF_TOKEN')\n", "api = HfApi(token=tok)\n", "api.upload_folder(folder_path='/content/outputs/tiny-50M', repo_id='mrsandip/Alfa-Code', path_in_repo='outputs/tiny-50M')\n", "print('uploaded')"]}], "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}}, "nbformat": 4, "nbformat_minor": 5}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|