Text Generation
Transformers
PyTorch
code
mpt
instruct
self instruct
custom_code
text-generation-inference
Instructions to use teknium/Replit-v1-CodeInstruct-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use teknium/Replit-v1-CodeInstruct-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="teknium/Replit-v1-CodeInstruct-3B", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("teknium/Replit-v1-CodeInstruct-3B", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("teknium/Replit-v1-CodeInstruct-3B", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use teknium/Replit-v1-CodeInstruct-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "teknium/Replit-v1-CodeInstruct-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "teknium/Replit-v1-CodeInstruct-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/teknium/Replit-v1-CodeInstruct-3B
- SGLang
How to use teknium/Replit-v1-CodeInstruct-3B 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 "teknium/Replit-v1-CodeInstruct-3B" \ --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": "teknium/Replit-v1-CodeInstruct-3B", "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 "teknium/Replit-v1-CodeInstruct-3B" \ --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": "teknium/Replit-v1-CodeInstruct-3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use teknium/Replit-v1-CodeInstruct-3B with Docker Model Runner:
docker model run hf.co/teknium/Replit-v1-CodeInstruct-3B
Update README.md
Browse files
README.md
CHANGED
|
@@ -68,6 +68,18 @@ or
|
|
| 68 |
|
| 69 |
```
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
This model for me produced coherent outputs with the following sampler settings, but feel free to experiment:
|
| 72 |
```
|
| 73 |
max_new_tokens=128, do_sample=True, use_cache=True, temperature=0.2, top_p=0.9, eos_token_id= self.tokenizer.eos_token_id
|
|
|
|
| 68 |
|
| 69 |
```
|
| 70 |
|
| 71 |
+
This model seems to have issues with device="auto" in the model arguments (and requires the trust_remote_code=True, so you should maybe load it like I am here:
|
| 72 |
+
```
|
| 73 |
+
self.tokenizer = AutoTokenizer.from_pretrained("./Replit-CodeInstruct/", trust_remote_code=True)
|
| 74 |
+
self.model = AutoModelForCausalLM.from_pretrained(
|
| 75 |
+
"./Replit-CodeInstruct",
|
| 76 |
+
torch_dtype=torch.bfloat16,
|
| 77 |
+
trust_remote_code=True
|
| 78 |
+
)
|
| 79 |
+
self.model.to('cuda')
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
|
| 83 |
This model for me produced coherent outputs with the following sampler settings, but feel free to experiment:
|
| 84 |
```
|
| 85 |
max_new_tokens=128, do_sample=True, use_cache=True, temperature=0.2, top_p=0.9, eos_token_id= self.tokenizer.eos_token_id
|