Run this model with HF Jobs
Run openchat/opencoderplus on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs and TRL to fine-tune https://huggingface.co/openchat/opencoderplus. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/openchat/opencoderplus on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/openchat/opencoderplus. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/openchat/opencoderplus. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use openchat/opencoderplus with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openchat/opencoderplus with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openchat/opencoderplus")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("openchat/opencoderplus") model = AutoModelForCausalLM.from_pretrained("openchat/opencoderplus", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use openchat/opencoderplus with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openchat/opencoderplus" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openchat/opencoderplus", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/openchat/opencoderplus
- SGLang
How to use openchat/opencoderplus 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 "openchat/opencoderplus" \ --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": "openchat/opencoderplus", "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 "openchat/opencoderplus" \ --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": "openchat/opencoderplus", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use openchat/opencoderplus with Docker Model Runner:
docker model run hf.co/openchat/opencoderplus
Update README
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121---language:- entags:- llama---
# OpenChat: Less is More for Open-source Models
OpenChat is a series of open-source language models fine-tuned on very little diverse and high-quality multi-round conversations. The [dataset](https://huggingface.co/datasets/openchat/openchat_sharegpt4_dataset) contains only ~6K GPT-4 conversations filtered from the 90K ShareGPT conversations.
Generic models:
- OpenChat: based on LLaMA-13B (2048 context length) - **105.7%** of ChatGPT score on Vicuna GPT-4 evaluation - **80.87%** Win-rate on AlpacaEval - **🚀 Only used 6K data for finetuning!!!** - OpenChat-8192: based on LLaMA-13B (extended to 8192 context length) - **106.6%** of ChatGPT score on Vicuna GPT-4 evaluation
Code models:
- OpenCoderPlus: based on StarCoderPlus (native 8192 context length) - **102.5%** of ChatGPT score on Vicuna GPT-4 evaluation - **78.70%** Win-rate on AlpacaEval
**NOTE:** Please load the pretrained models using *bfloat16*
## Conversation Template
The conversation template **involves concatenating tokens**.
Besides base model vocabulary, an end-of-turn token `<|end_of_turn|>` is added, with id `eot_token_id`.
```python# OpenChat[bos_token_id] + tokenize("Human: ") + tokenize(user_question) + [eot_token_id] + tokenize("Assistant: ")# OpenCodertokenize("User:") + tokenize(user_question) + [eot_token_id] + tokenize("Assistant:")```
*Hint: In BPE, `tokenize(A) + tokenize(B)` does not always equals to `tokenize(A + B)`*
Following is the code for generating the conversation templates:
```python@dataclassclass ModelConfig: # Prompt system: Optional[str]
role_prefix: dict ai_role: str eot_token: str bos_token: Optional[str] = None
# Get template def generate_conversation_template(self, tokenize_fn, tokenize_special_fn, message_list): tokens = [] masks = []
# begin of sentence (bos) if self.bos_token: t = tokenize_special_fn(self.bos_token) tokens.append(t) masks.append(False)
# System if self.system: t = tokenize_fn(self.system) + [tokenize_special_fn(self.eot_token)] tokens.extend(t) masks.extend([False] * len(t))
# Messages for idx, message in enumerate(message_list): # Prefix t = tokenize_fn(self.role_prefix[message["from"]]) tokens.extend(t) masks.extend([False] * len(t))
# Message if "value" in message: t = tokenize_fn(message["value"]) + [tokenize_special_fn(self.eot_token)] tokens.extend(t) masks.extend([message["from"] == self.ai_role] * len(t)) else: assert idx == len(message_list) - 1, "Empty message for completion must be on the last."
return tokens, masks
MODEL_CONFIG_MAP = { # OpenChat / OpenChat-8192 "openchat": ModelConfig( # Prompt system=None,
role_prefix={ "human": "Human: ", "gpt": "Assistant: " }, ai_role="gpt", eot_token="<|end_of_turn|>", bos_token="<s>", ),
# OpenCoder / OpenCoderPlus "opencoder": ModelConfig( # Prompt system=None,
role_prefix={ "human": "User:", "gpt": "Assistant:" }, ai_role="gpt", eot_token="<|end_of_turn|>", bos_token=None, )}```README.mdAdded+121