Instructions to use sahil2801/instruct-codegen-16B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sahil2801/instruct-codegen-16B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sahil2801/instruct-codegen-16B")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sahil2801/instruct-codegen-16B") model = AutoModelForCausalLM.from_pretrained("sahil2801/instruct-codegen-16B") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use sahil2801/instruct-codegen-16B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sahil2801/instruct-codegen-16B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sahil2801/instruct-codegen-16B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/sahil2801/instruct-codegen-16B
- SGLang
How to use sahil2801/instruct-codegen-16B 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 "sahil2801/instruct-codegen-16B" \ --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": "sahil2801/instruct-codegen-16B", "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 "sahil2801/instruct-codegen-16B" \ --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": "sahil2801/instruct-codegen-16B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use sahil2801/instruct-codegen-16B with Docker Model Runner:
docker model run hf.co/sahil2801/instruct-codegen-16B
Model Card for instruct-codegen-16B
Instruct-codegen-16B is an instruction following codegen model based on Salesforce codegen-16B-multi , finetuned on a dataset of 250k instruction-following samples in the alpaca format.
The data was not generated using any commercial LLM api.
The model achieves a result of 37.1% pass@1 on the HumanEval benchmark.
Generation
# pip install -q transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
checkpoint = "sahil2801/instruct-codegen-16B"
device = "cuda"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(checkpoint).half().to(device)
instruction = "Write a function to scrape hacker news."
prompt = f"Below is an instruction that describes a task.\n Write a response that appropriately completes the request.\n\n ### Instruction:\n{instruction}\n\n### Response:"
inputs = tokenizer(prompt, return_tensors="pt").to(device)
outputs = model.generate(**inputs,temperature=0.3,do_sample=True,max_new_tokens=256)
print(tokenizer.decode(outputs[0],skip_special_tokens=True))
- Downloads last month
- 20
Evaluation results
- pass@1 on HumanEvalself-reported0.371
docker model run hf.co/sahil2801/instruct-codegen-16B