Instructions to use malhajar/Platypus2-70B-instruct-4bit-gptq with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use malhajar/Platypus2-70B-instruct-4bit-gptq with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="malhajar/Platypus2-70B-instruct-4bit-gptq")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("malhajar/Platypus2-70B-instruct-4bit-gptq") model = AutoModelForCausalLM.from_pretrained("malhajar/Platypus2-70B-instruct-4bit-gptq") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use malhajar/Platypus2-70B-instruct-4bit-gptq with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "malhajar/Platypus2-70B-instruct-4bit-gptq" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "malhajar/Platypus2-70B-instruct-4bit-gptq", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/malhajar/Platypus2-70B-instruct-4bit-gptq
- SGLang
How to use malhajar/Platypus2-70B-instruct-4bit-gptq 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 "malhajar/Platypus2-70B-instruct-4bit-gptq" \ --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": "malhajar/Platypus2-70B-instruct-4bit-gptq", "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 "malhajar/Platypus2-70B-instruct-4bit-gptq" \ --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": "malhajar/Platypus2-70B-instruct-4bit-gptq", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use malhajar/Platypus2-70B-instruct-4bit-gptq with Docker Model Runner:
docker model run hf.co/malhajar/Platypus2-70B-instruct-4bit-gptq
Platypus2-70B-instruct-4bit-gptq
Platypus2-70B-instruct-4bit-gptq is a qunatnized version of garage-bAInd/Platypus2-70B-instruct using GPTQ Quantnization.
This model is only 35 GB in size in comparision with the original garage-bAInd/Platypus2-70B-instruct 127 GB and can run on a single A6000 GPU
Model Details
- Quantnized by:
Mohamad Alhajar - Model type: quantnized version of Platypus2-70B-instruct using 4bit quantnization
- Language(s): English
Prompt Template
### Instruction:
<prompt> (without the <>)
### Response:
Training Dataset
Platypus2-70B-instruct-4bit-gptq quantnized using gptq on Alpaca dataset yahma/alpaca-cleaned.
Training Procedure
garage-bAInd/Platypus2-70B was fine-tuned using gptq on 2 L40 48GB.
How to Get Started with the Model
First install auto_gptq with
pip install auto_gptq
Use the code sample provided in the original post to interact with the model.
from transformers import AutoTokenizer
from auto_gptq import AutoGPTQForCausalLM
model_id = "malhajar/Platypus2-70B-instruct-4bit-gptq"
model = AutoGPTQForCausalLM.from_quantized(model_id,inject_fused_attention=False,
use_safetensors=True,
trust_remote_code=False,
use_triton=False,
quantize_config=None)
tokenizer = AutoTokenizer.from_pretrained(model_id)
question: "Who was the first person to walk on the moon?"
# For generating a response
prompt = '''
### Instruction:
{question}
### Response:'''
input_ids = tokenizer(prompt, return_tensors="pt").input_ids
output = model.generate(input_ids)
response = tokenizer.decode(output[0])
print(response)
Citations
@article{platypus2023,
title={Platypus: Quick, Cheap, and Powerful Refinement of LLMs},
author={Ariel N. Lee and Cole J. Hunter and Nataniel Ruiz},
booktitle={arXiv preprint arxiv:2308.07317},
year={2023}
}
@misc{touvron2023llama,
title={Llama 2: Open Foundation and Fine-Tuned Chat Models},
author={Hugo Touvron and Louis Martin and Kevin Stone and Peter Albert and Amjad Almahairi and Yasmine Babaei and Nikolay Bashlykov year={2023},
eprint={2307.09288},
archivePrefix={arXiv},
}
@misc{frantar2023gptq,
title={GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers},
author={Elias Frantar and Saleh Ashkboos and Torsten Hoefler and Dan Alistarh},
year={2023},
eprint={2210.17323},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
- Downloads last month
- 195