Text Generation
Transformers
Safetensors
llama
llm
transfer learning
in-context learning
tabular data
text-generation-inference
Instructions to use microsoft/LLaMA-2-13b-GTL-Delta with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/LLaMA-2-13b-GTL-Delta with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="microsoft/LLaMA-2-13b-GTL-Delta")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("microsoft/LLaMA-2-13b-GTL-Delta") model = AutoModelForCausalLM.from_pretrained("microsoft/LLaMA-2-13b-GTL-Delta", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use microsoft/LLaMA-2-13b-GTL-Delta with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "microsoft/LLaMA-2-13b-GTL-Delta" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "microsoft/LLaMA-2-13b-GTL-Delta", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/microsoft/LLaMA-2-13b-GTL-Delta
- SGLang
How to use microsoft/LLaMA-2-13b-GTL-Delta 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 "microsoft/LLaMA-2-13b-GTL-Delta" \ --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": "microsoft/LLaMA-2-13b-GTL-Delta", "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 "microsoft/LLaMA-2-13b-GTL-Delta" \ --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": "microsoft/LLaMA-2-13b-GTL-Delta", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use microsoft/LLaMA-2-13b-GTL-Delta with Docker Model Runner:
docker model run hf.co/microsoft/LLaMA-2-13b-GTL-Delta
XumengWen commited on
Commit ·
13c993d
1
Parent(s): 78df23b
update quickstart
Browse files
README.md
CHANGED
|
@@ -104,8 +104,8 @@ with open(example_path, "r") as f:
|
|
| 104 |
full_prompt = f.read()
|
| 105 |
answer = full_prompt.split('Answer:')[-1].strip()
|
| 106 |
prompt_without_answer = full_prompt[:-len(answer)]
|
| 107 |
-
print("Prompt:
|
| 108 |
-
print("
|
| 109 |
|
| 110 |
# Inference
|
| 111 |
inputs = tokenizer(prompt_without_answer, return_tensors="pt")
|
|
@@ -118,7 +118,7 @@ outputs = model.generate(
|
|
| 118 |
)
|
| 119 |
|
| 120 |
# Print the answer
|
| 121 |
-
print("
|
| 122 |
```
|
| 123 |
|
| 124 |
## Responsible AI Considerations
|
|
|
|
| 104 |
full_prompt = f.read()
|
| 105 |
answer = full_prompt.split('Answer:')[-1].strip()
|
| 106 |
prompt_without_answer = full_prompt[:-len(answer)]
|
| 107 |
+
print("Prompt:", prompt_without_answer)
|
| 108 |
+
print("Groundtruth:", answer)
|
| 109 |
|
| 110 |
# Inference
|
| 111 |
inputs = tokenizer(prompt_without_answer, return_tensors="pt")
|
|
|
|
| 118 |
)
|
| 119 |
|
| 120 |
# Print the answer
|
| 121 |
+
print("Generated answer:", tokenizer.decode(outputs[0][input_ids.shape[-1]:]))
|
| 122 |
```
|
| 123 |
|
| 124 |
## Responsible AI Considerations
|