Instructions to use SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1") model = AutoModelForCausalLM.from_pretrained("SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1") 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]:])) - llama-cpp-python
How to use SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1", filename="TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1_Q4_K_M.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M # Run inference directly in the terminal: llama-cli -hf SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M # Run inference directly in the terminal: llama-cli -hf SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M
Use Docker
docker model run hf.co/SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M
- LM Studio
- Jan
- vLLM
How to use SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M
- SGLang
How to use SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 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 "SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1" \ --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": "SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1", "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 "SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1" \ --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": "SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 with Ollama:
ollama run hf.co/SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M
- Unsloth Studio new
How to use SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 to start chatting
- Docker Model Runner
How to use SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 with Docker Model Runner:
docker model run hf.co/SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M
- Lemonade
How to use SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1 with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1:Q4_K_M
Run and chat with the model
lemonade run user.TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1-Q4_K_M
List all available models
lemonade list
- Developed by: [More Information Needed]
- Finetuned from model: TinyLlama/TinyLlama-1.1B-Chat-v1.0
Training Hyperparameters
python examples/scripts/sft.py --model_name TinyLlama/TinyLlama-1.1B-Chat-v1.0 --dataset_name jtatman/python-code-dataset-500k --load_in_4bit --dataset_text_field text --per_device_train_batch_size 2 --per_device_eval_batch_size 8 --gradient_accumulation_steps 1 --learning_rate 2e-4 --optim adamw_torch --save_steps 2000 --logging_steps 500 --warmup_ratio 0 --use_peft --lora_r 64 --lora_alpha 16 --lora_dropout 0.1 --report_to wandb --num_train_epochs 1 --output_dir TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1
However, only 250K out of the 500K dataset was used for fine-tuning. Of that, 70% was used for training data and 30% for evaluation.
Usage
import torch
from transformers import pipeline
pipe = pipeline("text-generation", model="SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1", torch_dtype=torch.bfloat16, device_map="auto")
text = '''Create a program that determines whether a given year is a leap year or not.
The input is an integer Y (1000 ≤ Y ≤ 2999) representing a year, provided in a single line.
Output "YES" if the given year is a leap year, otherwise output "NO" in a single line.
A leap year is determined according to the following rules:
Rule 1: A year divisible by 4 is a leap year.
Rule 2: A year divisible by 100 is not a leap year.
Rule 3: A year divisible by 400 is a leap year.
Rule 4: If none of the above rules (Rule 1-3) apply, the year is not a leap year.
If a year satisfies multiple rules, the rule with the higher number takes precedence.
'''
texts = f"Translate the following problem statement into Python code. :\n{text}"
messages = [
{"role": "system","content": "You are a chatbot who can help code!",},
{"role": "user", "content": f"{texts}"},
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
outputs = pipe(
prompt,
max_new_tokens=512,
do_sample=True,
temperature=0.1,
repetition_penalty=1.0,
top_k=50,
top_p=1.0,
min_p=0
)
print(outputs[0]["generated_text"])
Also, this repository contains GGUF format model files and provides only the q4_k_m model.
Please download the GGUF format model file from the repository and place it in the same directory, then execute the following code.
llama-cpp-python Usage
from llama_cpp import Llama
llm = Llama(model_path="TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1_Q4_K_M.gguf", verbose=False,n_ctx=2000,n_gpu_layers=-1)
system_message = "You are a chatbot who can help code!"
text = '''Create a program that determines whether a given year is a leap year or not.
The input is an integer Y (1000 ≤ Y ≤ 2999) representing a year, provided in a single line.
Output "YES" if the given year is a leap year, otherwise output "NO" in a single line.
A leap year is determined according to the following rules:
Rule 1: A year divisible by 4 is a leap year.
Rule 2: A year divisible by 100 is not a leap year.
Rule 3: A year divisible by 400 is a leap year.
Rule 4: If none of the above rules (Rule 1-3) apply, the year is not a leap year.
If a year satisfies multiple rules, the rule with the higher number takes precedence.
'''
texts = f"Translate the following problem statement into Python code. :\n{text}"
prompt = f"<|system|>\n{system_message}</s>\n<|user|>\n{texts}</s>\n<|assistant|>\n"
output = llm(
prompt,
stop=["</s>"],
max_tokens=512,
echo=True,
top_k=50,
top_p=1.0,
temperature=0.1,
min_p=0,
repeat_penalty=1.0,
typical_p=1.0
)
print(output['choices'][0]["text"])
- Downloads last month
- 9
Model tree for SSK-DNB/TinyLlama-1.1B-Chat-v1.0-PCD250k_v0.1
Base model
TinyLlama/TinyLlama-1.1B-Chat-v1.0