Instructions to use aisquared/chopt-2_7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aisquared/chopt-2_7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="aisquared/chopt-2_7b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("aisquared/chopt-2_7b") model = AutoModelForCausalLM.from_pretrained("aisquared/chopt-2_7b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use aisquared/chopt-2_7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aisquared/chopt-2_7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aisquared/chopt-2_7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/aisquared/chopt-2_7b
- SGLang
How to use aisquared/chopt-2_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 "aisquared/chopt-2_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": "aisquared/chopt-2_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 "aisquared/chopt-2_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": "aisquared/chopt-2_7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use aisquared/chopt-2_7b with Docker Model Runner:
docker model run hf.co/aisquared/chopt-2_7b
updating model
Browse filesSigned-off-by: Jacob Renn <jacob.renn@squared.ai>
- instruct_pipeline.py +2 -2
- pytorch_model.bin +1 -1
instruct_pipeline.py
CHANGED
|
@@ -8,7 +8,7 @@ INSTRUCTION_KEY = "### Instruction:"
|
|
| 8 |
RESPONSE_KEY = "### Response:"
|
| 9 |
END_KEY = "### End"
|
| 10 |
INTRO_BLURB = (
|
| 11 |
-
"Below is an instruction that describes a task. Write a response that appropriately completes the request."
|
| 12 |
)
|
| 13 |
|
| 14 |
# This is the prompt that is used for generating responses using an already trained model. It ends with the response
|
|
@@ -157,4 +157,4 @@ class InstructionTextGenerationPipeline(Pipeline):
|
|
| 157 |
if return_instruction_text:
|
| 158 |
return {"instruction_text": instruction_text, "generated_text": decoded}
|
| 159 |
|
| 160 |
-
return decoded
|
|
|
|
| 8 |
RESPONSE_KEY = "### Response:"
|
| 9 |
END_KEY = "### End"
|
| 10 |
INTRO_BLURB = (
|
| 11 |
+
"Below is an instruction that describes a task, along with any additional context. Write a response that appropriately completes the request."
|
| 12 |
)
|
| 13 |
|
| 14 |
# This is the prompt that is used for generating responses using an already trained model. It ends with the response
|
|
|
|
| 157 |
if return_instruction_text:
|
| 158 |
return {"instruction_text": instruction_text, "generated_text": decoded}
|
| 159 |
|
| 160 |
+
return decoded
|
pytorch_model.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 5303342201
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9058b8b217f1dfbc79ce66c55c5c86014be99e5e5ed2f6f4632a92563ea2c5c8
|
| 3 |
size 5303342201
|