Instructions to use kaist-ai/cosupervision-emb_seq-Llama2_7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kaist-ai/cosupervision-emb_seq-Llama2_7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kaist-ai/cosupervision-emb_seq-Llama2_7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("kaist-ai/cosupervision-emb_seq-Llama2_7b") model = AutoModelForCausalLM.from_pretrained("kaist-ai/cosupervision-emb_seq-Llama2_7b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use kaist-ai/cosupervision-emb_seq-Llama2_7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kaist-ai/cosupervision-emb_seq-Llama2_7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kaist-ai/cosupervision-emb_seq-Llama2_7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/kaist-ai/cosupervision-emb_seq-Llama2_7b
- SGLang
How to use kaist-ai/cosupervision-emb_seq-Llama2_7b 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 "kaist-ai/cosupervision-emb_seq-Llama2_7b" \ --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": "kaist-ai/cosupervision-emb_seq-Llama2_7b", "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 "kaist-ai/cosupervision-emb_seq-Llama2_7b" \ --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": "kaist-ai/cosupervision-emb_seq-Llama2_7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use kaist-ai/cosupervision-emb_seq-Llama2_7b with Docker Model Runner:
docker model run hf.co/kaist-ai/cosupervision-emb_seq-Llama2_7b
This model is a generation model trained via semiparametric token-sequence co-supervision on top of Llama2-7B. The embedding model which constructs the nonparametric sequence embedding spaces is in here. The models are trained on information-seeking datasets provided by self-rag with co-supervision from next token prediction (NTP) and next sequence prediction (NSP). In the inference step, the model generates a response by retrieving relevant sequences. See full descriptions in our paper.
Usage
Here, we show an easy way to quickly download our model from HuggingFace. Make sure to install dependencies listed at requirements.txt. To run our full inference pipeline with embedding model, please use our code.
from transformers import AutoTokenizer, LlamaForCausalLM
model = LlamaForCausalLM.from_pretrained(
"kaist-ai/cosupervision-emb_seq-Llama2_7b",
load_in_8bit=True if train_config.quantization else None,
device_map="auto" if train_config.quantization else None,
)
- Downloads last month
- 14