Instructions to use luckychao/TinyAlpaca-1.1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use luckychao/TinyAlpaca-1.1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="luckychao/TinyAlpaca-1.1B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("luckychao/TinyAlpaca-1.1B") model = AutoModelForCausalLM.from_pretrained("luckychao/TinyAlpaca-1.1B") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use luckychao/TinyAlpaca-1.1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "luckychao/TinyAlpaca-1.1B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "luckychao/TinyAlpaca-1.1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/luckychao/TinyAlpaca-1.1B
- SGLang
How to use luckychao/TinyAlpaca-1.1B 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 "luckychao/TinyAlpaca-1.1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "luckychao/TinyAlpaca-1.1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "luckychao/TinyAlpaca-1.1B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "luckychao/TinyAlpaca-1.1B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use luckychao/TinyAlpaca-1.1B with Docker Model Runner:
docker model run hf.co/luckychao/TinyAlpaca-1.1B
Model Card for Model ID
This model checkpoint is the TinyLlama-1.1B fine-tuned on alpaca dataset.
Model Details
Model Sources
- Repository: https://github.com/jzhang38/TinyLlama
- Paper: [https://arxiv.org/abs/2404.02406]
Uses
The use of this model should comply with the restrictions from TinyLlama-1.1b and Stanford Alpaca.
How to Get Started with the Model
Use the code below to get started with the model.
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("luckychao/TinyAlpaca-1.1B")
model = AutoModelForCausalLM.from_pretrained("luckychao/TinyAlpaca-1.1B")
Training Details
Training Data
We use the alpaca dataset, which is created by researchers from Stanford University.
Training Procedure
We follow the same training procedure and mostly same hyper-parameters to fine-tune the original Alpaca model on Llama. The procedure can be found in stanford_alpaca project.
Training Hyperparameters
--num_train_epochs 3 \
--per_device_train_batch_size 2 \
--per_device_eval_batch_size 2 \
--gradient_accumulation_steps 4 \
--evaluation_strategy "no" \
--save_strategy "steps" \
--save_steps 1000 \
--save_total_limit 1 \
--learning_rate 2e-5 \
--weight_decay 0. \
--warmup_ratio 0.03 \
--lr_scheduler_type "cosine" \
--logging_steps 1 \
--bf16 True \
--fsdp "full_shard auto_wrap" \
--fsdp_transformer_layer_cls_to_wrap 'LlamaDecoderLayer' \
--model_max_length 2048
Citation
The model is mostly developed for the paper below. Please cite it if you find the repository helpful.
BibTeX:
@article{hao2024exploring,
title={Exploring Backdoor Vulnerabilities of Chat Models},
author={Hao, Yunzhuo and Yang, Wenkai and Lin, Yankai},
journal={arXiv preprint arXiv:2404.02406},
year={2024}
}
- Downloads last month
- 5