Text Generation
Transformers
PyTorch
code
llama
Generated from Trainer
coding
text-generation-inference
Instructions to use mrm8488/llama-2-coder-7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mrm8488/llama-2-coder-7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mrm8488/llama-2-coder-7b")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mrm8488/llama-2-coder-7b") model = AutoModelForCausalLM.from_pretrained("mrm8488/llama-2-coder-7b", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use mrm8488/llama-2-coder-7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mrm8488/llama-2-coder-7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mrm8488/llama-2-coder-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/mrm8488/llama-2-coder-7b
- SGLang
How to use mrm8488/llama-2-coder-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 "mrm8488/llama-2-coder-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": "mrm8488/llama-2-coder-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 "mrm8488/llama-2-coder-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": "mrm8488/llama-2-coder-7b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use mrm8488/llama-2-coder-7b with Docker Model Runner:
docker model run hf.co/mrm8488/llama-2-coder-7b
Update README.md
Browse files
README.md
CHANGED
|
@@ -39,17 +39,36 @@ Meta developed and publicly released the Llama 2 family of large language models
|
|
| 39 |
|
| 40 |
### Training hyperparameters ⚙
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
### Training results 🗒️
|
| 45 |
|
|
|
|
| 46 |
| Step | Training Loss | Validation Loss |
|
| 47 |
-
|------|----------
|
| 48 |
-
|
|
| 49 |
-
|
|
| 50 |
-
|
|
| 51 |
-
|
|
| 52 |
-
|
|
| 53 |
|
| 54 |
|
| 55 |
|
|
|
|
| 39 |
|
| 40 |
### Training hyperparameters ⚙
|
| 41 |
|
| 42 |
+
```py
|
| 43 |
+
optim="paged_adamw_32bit",
|
| 44 |
+
num_train_epochs = 2,
|
| 45 |
+
eval_steps=50,
|
| 46 |
+
save_steps=50,
|
| 47 |
+
evaluation_strategy="steps",
|
| 48 |
+
save_strategy="steps",
|
| 49 |
+
save_total_limit=2,
|
| 50 |
+
seed=66,
|
| 51 |
+
load_best_model_at_end=True,
|
| 52 |
+
logging_steps=1,
|
| 53 |
+
learning_rate=2e-4,
|
| 54 |
+
fp16=True,
|
| 55 |
+
bf16=False,
|
| 56 |
+
max_grad_norm=0.3,
|
| 57 |
+
warmup_ratio=0.03,
|
| 58 |
+
group_by_length=True,
|
| 59 |
+
lr_scheduler_type="constant"
|
| 60 |
+
```
|
| 61 |
|
| 62 |
### Training results 🗒️
|
| 63 |
|
| 64 |
+
|
| 65 |
| Step | Training Loss | Validation Loss |
|
| 66 |
+
|------|----------|----------|
|
| 67 |
+
| 50 | 0.624400 | 0.600070 |
|
| 68 |
+
| 100 | 0.634100 | 0.592757 |
|
| 69 |
+
| 150 | 0.545800 | 0.586652 |
|
| 70 |
+
| 200 | 0.572500 | 0.577525 |
|
| 71 |
+
| 250 | 0.528000 | 0.590118 |
|
| 72 |
|
| 73 |
|
| 74 |
|