Edit model card

Quantization Details

This repo contains a GPTQ 4bit quantized version of the openchat/openchat-3.6-8b-20240522 model.

Using with transfomers

from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

model_name_or_path = "thesven/openchat-3.6-8b-20240522-GPTQ"

tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, use_fast=True)
model = AutoModelForCausalLM.from_pretrained(model_name_or_path,
                                             device_map="auto",
                                             trust_remote_code=False,
                                             revision="main")
model.pad_token = model.config.eos_token_id


prompt_template=f'''
<<SYS>> You are a very creative story writer. Write a store on the following topic:<</SYS>>
[INST] Write a story about Ai[/INST]
[ASSISTANT]
'''

input_ids = tokenizer(prompt_template, return_tensors='pt').input_ids.cuda()
output = model.generate(inputs=input_ids, temperature=0.1, do_sample=True, top_p=0.95, top_k=40, max_new_tokens=512)

print(tokenizer.decode(output[0]))

Original Model Card

Advancing Open-source Language Models with Mixed-Quality Data

OpenChat Logo Online Demo | GitHub Logo GitHub | ArXiv Logo Paper | Discord Logo Discord

Sponsored by RunPod RunPod Logo

* Llama-3-Instruct often fails to follow the few-shot templates.

Usage

To use this model, we highly recommend installing the OpenChat package by following the installation guide in our repository and using the OpenChat OpenAI-compatible API server by running the serving command from the table below. The server is optimized for high-throughput deployment using vLLM and can run on a consumer GPU with 24GB RAM. To enable tensor parallelism, append --tensor-parallel-size N to the serving command.

Once started, the server listens at localhost:18888 for requests and is compatible with the OpenAI ChatCompletion API specifications. Please refer to the example request below for reference. Additionally, you can use the OpenChat Web UI for a user-friendly experience.

If you want to deploy the server as an online service, you can use --api-keys sk-KEY1 sk-KEY2 ... to specify allowed API keys and --disable-log-requests --disable-log-stats --log-file openchat.log for logging only to a file. For security purposes, we recommend using an HTTPS gateway in front of the server.

Model Size Context Weights Serving
OpenChat-3.6-20240522 8B 8192 Huggingface python -m ochat.serving.openai_api_server --model openchat/openchat-3.6-8b-20240522
Example request (click to expand)
curl http://localhost:18888/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openchat_3.6",
    "messages": [{"role": "user", "content": "You are a large language model named OpenChat. Write a poem to describe yourself"}]
  }'

Conversation templates

πŸ’‘ Default Mode: Best for coding, chat and general tasks

GPT4 Correct User: Hello<|end_of_turn|>GPT4 Correct Assistant: Hi<|end_of_turn|>GPT4 Correct User: How are you today?<|end_of_turn|>GPT4 Correct Assistant:

⚠️ Notice: Remember to set <|end_of_turn|> as end of generation token.

The default template is also available as the integrated tokenizer.chat_template, which can be used instead of manually specifying the template:

messages = [
    {"role": "user", "content": "Hello"},
    {"role": "assistant", "content": "Hi"},
    {"role": "user", "content": "How are you today?"}
]
tokens = tokenizer.apply_chat_template(messages, add_generation_prompt=True)

Inference using Transformers

from transformers import AutoTokenizer, AutoModelForCausalLM
import torch

model_id = "openchat/openchat-3.6-8b-20240522"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")

messages = [
    {"role": "user", "content": "Explain how large language models work in detail."},
]
input_ids = tokenizer.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)

outputs = model.generate(input_ids,
    do_sample=True,
    temperature=0.5,
    max_new_tokens=1024
)
response = outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))

Limitations

Foundation Model Limitations Despite its advanced capabilities, OpenChat is still bound by the limitations inherent in its foundation models. These limitations may impact the model's performance in areas such as:

  • Complex reasoning
  • Mathematical and arithmetic tasks
  • Programming and coding challenges

Hallucination of Non-existent Information OpenChat may sometimes generate information that does not exist or is not accurate, also known as "hallucination". Users should be aware of this possibility and verify any critical information obtained from the model.

Safety OpenChat may sometimes generate harmful, hate speech, biased responses, or answer unsafe questions. It's crucial to apply additional AI safety measures in use cases that require safe and moderated responses.

πŸ’Œ Contact

We look forward to hearing from you and collaborating on this exciting project!

Project Lead:

  • Guan Wang [imonenext at gmail dot com]
  • Alpay Ariyak [aariyak at wpi dot edu]

Citation

@article{wang2023openchat,
  title={OpenChat: Advancing Open-source Language Models with Mixed-Quality Data},
  author={Wang, Guan and Cheng, Sijie and Zhan, Xianyuan and Li, Xiangang and Song, Sen and Liu, Yang},
  journal={arXiv preprint arXiv:2309.11235},
  year={2023}
}
Downloads last month
13
Safetensors
Model size
1.99B params
Tensor type
FP16
Β·
I32
Β·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Model tree for thesven/openchat-3.6-8b-20240522-GPTQ

Quantized
(229)
this model

Collection including thesven/openchat-3.6-8b-20240522-GPTQ