Instructions to use INC4AI/neural-chat-7b-v1-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use INC4AI/neural-chat-7b-v1-1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="INC4AI/neural-chat-7b-v1-1", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("INC4AI/neural-chat-7b-v1-1", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("INC4AI/neural-chat-7b-v1-1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use INC4AI/neural-chat-7b-v1-1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "INC4AI/neural-chat-7b-v1-1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "INC4AI/neural-chat-7b-v1-1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/INC4AI/neural-chat-7b-v1-1
- SGLang
How to use INC4AI/neural-chat-7b-v1-1 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 "INC4AI/neural-chat-7b-v1-1" \ --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": "INC4AI/neural-chat-7b-v1-1", "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 "INC4AI/neural-chat-7b-v1-1" \ --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": "INC4AI/neural-chat-7b-v1-1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use INC4AI/neural-chat-7b-v1-1 with Docker Model Runner:
docker model run hf.co/INC4AI/neural-chat-7b-v1-1
Download README.md from INC4AI/neural-chat-7b-v1-1: direct link, hf CLI and curl.
- Browser
- Download file 3.26 kB
-
https://huggingface.co/INC4AI/neural-chat-7b-v1-1/resolve/b9ee18256f3df686373f332b1465f265e072dde1/README.md
- Command line
-
hf download hf://INC4AI/neural-chat-7b-v1-1@b9ee18256f3df686373f332b1465f265e072dde1/README.md
-
curl -L -o README.md https://huggingface.co/INC4AI/neural-chat-7b-v1-1/resolve/b9ee18256f3df686373f332b1465f265e072dde1/README.md
license: apache-2.0
This model is a fine-tuned model for Chat based on mosaicml/mpt-7b with max_seq_lenght=2048 on the instruction-dataset-for-neural-chat-v1, databricks-dolly-15k, HC3 and oasst1 dataset.
Model date
Neural-chat-7b-v1.1 was trained on July 6, 2023.
Evaluation
We use the same evaluation metrics as open_llm_leaderboard which uses Eleuther AI Language Model Evaluation Harness, a unified framework to test generative language models on a large number of different evaluation tasks.
| Model | Average ⬆️ | ARC (25-s) ⬆️ | HellaSwag (10-s) ⬆️ | MMLU (5-s) ⬆️ | TruthfulQA (MC) (0-s) ⬆️ |
|---|---|---|---|---|---|
| mosaicml/mpt-7b | 47.4 | 47.61 | 77.56 | 31 | 33.43 |
| mosaicml/mpt-7b-chat | 49.95 | 46.5 | 75.55 | 37.60 | 40.17 |
| Ours | 51.41 | 50.09 | 76.69 | 38.79 | 40.07 |
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 1e-05
- train_batch_size: 2
- eval_batch_size: 2
- seed: 42
- distributed_type: multi-GPU
- num_devices: 4
- gradient_accumulation_steps: 8
- total_train_batch_size: 64
- total_eval_batch_size: 8
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_ratio: 0.02
- num_epochs: 3.0
Inference with transformers
import transformers
model = transformers.AutoModelForCausalLM.from_pretrained(
'Intel/neural-chat-7b-v1.1',
trust_remote_code=True
)
Inference with INT8
Follow the instructions link to install the necessary dependencies. Use the below command to quantize the model using Intel Neural Compressor link and accelerate the inference.
python run_generation.py \
--model Intel/neural-chat-7b-v1.1 \
--revision c8d4750ac8421303665d6ecc253950c69b56d324 \
--quantize \
--sq \
--alpha 0.95 \
--ipex
Organizations developing the model
The NeuralChat team with members from Intel/SATG/AIA/AIPT. Core team members: Kaokao Lv, Xuhui Ren, Liang Lv, Wenxin Zhang, and Haihao Shen.