Instructions to use hivemind/gpt-j-6B-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hivemind/gpt-j-6B-8bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hivemind/gpt-j-6B-8bit")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("hivemind/gpt-j-6B-8bit") model = AutoModelForCausalLM.from_pretrained("hivemind/gpt-j-6B-8bit") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use hivemind/gpt-j-6B-8bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hivemind/gpt-j-6B-8bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hivemind/gpt-j-6B-8bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/hivemind/gpt-j-6B-8bit
- SGLang
How to use hivemind/gpt-j-6B-8bit 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 "hivemind/gpt-j-6B-8bit" \ --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": "hivemind/gpt-j-6B-8bit", "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 "hivemind/gpt-j-6B-8bit" \ --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": "hivemind/gpt-j-6B-8bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use hivemind/gpt-j-6B-8bit with Docker Model Runner:
docker model run hf.co/hivemind/gpt-j-6B-8bit
Tensorflow Model Variant
This discussion was created to request the conversion of the model from PyTorch .bin to Tensorflow .h5.
I would like to convert to TensorFlow format for further analysis and use in a TensorFlow-based application. I understand that converting a PyTorch model to TensorFlow format can be a challenging task, and it requires a thorough understanding of both frameworks. However, I believe that this conversion would be beneficial in terms of using the PyTorch model in a TensorFlow-based application and to the TensorFlow community.
Therefore, I kindly request your support in converting the PyTorch model into TensorFlow format. I would greatly appreciate your expertise in this matter and any guidance you can provide.
Thank you for your time and consideration. I look forward to hearing from you soon.
Sincerely,
William.
I have been able to figure it out. For anyone, you just need to add from_pt=True when loading the PyTorch model into Tensorflow as seen below:
gptj_model = TFGPTJModel.from_pretrained(gpt_MODEL_path, config=cfg, from_pt=True)