Instructions to use vikp/instruct_llama_7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use vikp/instruct_llama_7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="vikp/instruct_llama_7b", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("vikp/instruct_llama_7b", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("vikp/instruct_llama_7b", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use vikp/instruct_llama_7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "vikp/instruct_llama_7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "vikp/instruct_llama_7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/vikp/instruct_llama_7b
- SGLang
How to use vikp/instruct_llama_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 "vikp/instruct_llama_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": "vikp/instruct_llama_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 "vikp/instruct_llama_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": "vikp/instruct_llama_7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use vikp/instruct_llama_7b with Docker Model Runner:
docker model run hf.co/vikp/instruct_llama_7b
Update README.md
Browse files
README.md
CHANGED
|
@@ -3,4 +3,46 @@ datasets:
|
|
| 3 |
- vikp/python_code_instructions_filtered
|
| 4 |
---
|
| 5 |
|
| 6 |
-
This is code llama 7b finetuned for one epoch on a set of python code and instructions. Scores `.512` in humaneval.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
- vikp/python_code_instructions_filtered
|
| 4 |
---
|
| 5 |
|
| 6 |
+
This is code llama 7b finetuned for one epoch on a set of python code and instructions. Scores `.512` in humaneval with greedy decoding (matched to code llama pass@1).
|
| 7 |
+
|
| 8 |
+
To use in inference, you'll need to set `trust_remote_code = True` to pick up the right rope theta value:
|
| 9 |
+
|
| 10 |
+
```
|
| 11 |
+
from transformers import AutoModelForCausalLM
|
| 12 |
+
from transformers import AutoTokenizer
|
| 13 |
+
|
| 14 |
+
tokenizer = AutoTokenizer.from_pretrained("vikp/code_llama_7B_hf")
|
| 15 |
+
model = AutoModelForCausalLM.from_pretrained("vikp/instruct_llama_7b", trust_remote_code=True)
|
| 16 |
+
|
| 17 |
+
text = tokenizer.bos_token + """\
|
| 18 |
+
import socket
|
| 19 |
+
|
| 20 |
+
def ping_exponential_backoff(host: str):""".lstrip()
|
| 21 |
+
|
| 22 |
+
tokens = tokenizer(text, return_tensors="pt")
|
| 23 |
+
output = model.generate(**tokens, max_new_tokens=128, do_sample=True, temperature=.1, top_p=1.0)
|
| 24 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True).strip())
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
You can duplicate benchmark results with the bigcode eval harness:
|
| 28 |
+
|
| 29 |
+
```
|
| 30 |
+
git clone https://github.com/bigcode-project/bigcode-evaluation-harness.git
|
| 31 |
+
cd bigcode-evaluation-harness
|
| 32 |
+
pip install -e .
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
```
|
| 36 |
+
accelerate launch main.py \
|
| 37 |
+
--model vikp/instruct_llama_7b \
|
| 38 |
+
--tasks humaneval \
|
| 39 |
+
--max_length_generation 1024 \
|
| 40 |
+
--temperature 0 \
|
| 41 |
+
--do_sample False \
|
| 42 |
+
--n_samples 1 \
|
| 43 |
+
--precision fp16 \
|
| 44 |
+
--allow_code_execution \
|
| 45 |
+
--save_generations \
|
| 46 |
+
--use_auth_token \
|
| 47 |
+
--trust_remote_code
|
| 48 |
+
```
|