Instructions to use nlpcloud/instruct-gpt-j-fp16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nlpcloud/instruct-gpt-j-fp16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nlpcloud/instruct-gpt-j-fp16")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("nlpcloud/instruct-gpt-j-fp16") model = AutoModelForCausalLM.from_pretrained("nlpcloud/instruct-gpt-j-fp16") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use nlpcloud/instruct-gpt-j-fp16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nlpcloud/instruct-gpt-j-fp16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nlpcloud/instruct-gpt-j-fp16", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nlpcloud/instruct-gpt-j-fp16
- SGLang
How to use nlpcloud/instruct-gpt-j-fp16 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 "nlpcloud/instruct-gpt-j-fp16" \ --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": "nlpcloud/instruct-gpt-j-fp16", "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 "nlpcloud/instruct-gpt-j-fp16" \ --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": "nlpcloud/instruct-gpt-j-fp16", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nlpcloud/instruct-gpt-j-fp16 with Docker Model Runner:
docker model run hf.co/nlpcloud/instruct-gpt-j-fp16
Commit ·
8533edd
1
Parent(s): d232e29
Update README.md
Browse files
README.md
CHANGED
|
@@ -17,7 +17,7 @@ We fine-tuned GPT-J on an instruction dataset created by the [Stanford Alpaca te
|
|
| 17 |
|
| 18 |
The dataset was slightly reworked in order to match the GPT-J fine-tuning format with [Mesh Transformer Jax](https://github.com/kingoflolz/mesh-transformer-jax) on TPUs. [Here is the final dataset we used](https://huggingface.co/datasets/nlpcloud/instructions-dataset-adapted-from-stanford-alpaca-for-gpt-j).
|
| 19 |
|
| 20 |
-
The base GPT-J
|
| 21 |
|
| 22 |
```text
|
| 23 |
I love goin to the beach.
|
|
|
|
| 17 |
|
| 18 |
The dataset was slightly reworked in order to match the GPT-J fine-tuning format with [Mesh Transformer Jax](https://github.com/kingoflolz/mesh-transformer-jax) on TPUs. [Here is the final dataset we used](https://huggingface.co/datasets/nlpcloud/instructions-dataset-adapted-from-stanford-alpaca-for-gpt-j).
|
| 19 |
|
| 20 |
+
The base GPT-J model needs few-shot learning in order to properly understand what you want. [See more details here about how to properly use few-shot learning](https://nlpcloud.com/effectively-using-gpt-j-gpt-neo-gpt-3-alternatives-few-shot-learning.html). For example let's say that you want to correct spelling with GPT-J. Here is an example of a prompt you had to use:
|
| 21 |
|
| 22 |
```text
|
| 23 |
I love goin to the beach.
|