Instructions to use LL-Square/CodeForge-TinyLlama1.1B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use LL-Square/CodeForge-TinyLlama1.1B-Instruct with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("TinyLlama/TinyLlama-1.1B-Chat-v1.0") model = PeftModel.from_pretrained(base_model, "LL-Square/CodeForge-TinyLlama1.1B-Instruct") - Transformers
How to use LL-Square/CodeForge-TinyLlama1.1B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="LL-Square/CodeForge-TinyLlama1.1B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("LL-Square/CodeForge-TinyLlama1.1B-Instruct", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LL-Square/CodeForge-TinyLlama1.1B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LL-Square/CodeForge-TinyLlama1.1B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LL-Square/CodeForge-TinyLlama1.1B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/LL-Square/CodeForge-TinyLlama1.1B-Instruct
- SGLang
How to use LL-Square/CodeForge-TinyLlama1.1B-Instruct 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 "LL-Square/CodeForge-TinyLlama1.1B-Instruct" \ --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": "LL-Square/CodeForge-TinyLlama1.1B-Instruct", "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 "LL-Square/CodeForge-TinyLlama1.1B-Instruct" \ --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": "LL-Square/CodeForge-TinyLlama1.1B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use LL-Square/CodeForge-TinyLlama1.1B-Instruct with Docker Model Runner:
docker model run hf.co/LL-Square/CodeForge-TinyLlama1.1B-Instruct
| base_model: TinyLlama/TinyLlama-1.1B-Chat-v1.0 | |
| library_name: peft | |
| pipeline_tag: text-generation | |
| tags: | |
| - base_model:adapter:TinyLlama/TinyLlama-1.1B-Chat-v1.0 | |
| - lora | |
| - transformers | |
| license: apache-2.0 | |
| datasets: | |
| - LL-Square/CodeForge-TinyLlama1.1B-Instruct | |
| language: | |
| - en | |
| # CodeForge-Instruct | |
| Lightweight repository for preparing, training, and uploading small instruct-style models and LoRA adapters. | |
| This project contains simple scripts to train a model (`train.py`), run inference (`main.py`), configure logging (`logging_setup.py`), and upload artifacts (`upload.py`). A small sample dataset is included as `sample.jsonl`. | |
| ## Data format | |
| The dataset expects newline-delimited JSON (`.jsonl`) where each line is an object with at least `prompt` and `response` (or `instruction`/`output`) fields. Example (`sample.jsonl`): | |
| ```jsonl | |
| {"prompt": "Summarize the following text:", "response": "A short summary."} | |
| ``` | |
| Adjust `train.py` to match your field names if needed. | |
| ## Usage | |
| Training (example): | |
| ```bash | |
| python train.py --data sample.jsonl --output-dir ./checkpoints --epochs 3 --batch-size 8 | |
| ``` | |
| Run inference/demo: | |
| ```bash | |
| python main.py --model ./checkpoints/latest | |
| ``` | |
| Upload artifacts (example): | |
| ```bash | |
| python upload.py --model ./checkpoints/latest --dest hub-or-bucket | |
| ``` | |
| See individual scripts for additional flags and configuration. | |
| ## Logging | |
| The repository centralizes logging in `logging_setup.py`; import and call `setup_logging()` from other scripts to get consistent formatting and levels. | |
| ## Development | |
| - Run linters/formatters as you prefer (e.g. `black`, `ruff`). | |
| - Add tests under a `tests/` folder if you expand behavior. | |
| ## Contributing | |
| Open issues or PRs with clear reproduction steps. Keep changes minimal and scoped. | |
| ## License | |
| This repository does not include a license file. Add a `LICENSE` if you plan to publish. | |
| ### Framework versions | |
| - PEFT 0.18.1 | |
| - | |
| --- | |
| If you'd like, I can: | |
| - add a `requirements.txt` with pinned versions, | |
| - add CLI argument parsing examples to `train.py` and `main.py`, or | |
| - create a short CONTRIBUTING guide. |