GREEN
Collection
9 items • Updated • 2
How to use StanfordAIMI/GREEN-Mistral-7b with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="StanfordAIMI/GREEN-Mistral-7b")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("StanfordAIMI/GREEN-Mistral-7b")
model = AutoModelForCausalLM.from_pretrained("StanfordAIMI/GREEN-Mistral-7b")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use StanfordAIMI/GREEN-Mistral-7b with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "StanfordAIMI/GREEN-Mistral-7b"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "StanfordAIMI/GREEN-Mistral-7b",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/StanfordAIMI/GREEN-Mistral-7b
How to use StanfordAIMI/GREEN-Mistral-7b with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "StanfordAIMI/GREEN-Mistral-7b" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "StanfordAIMI/GREEN-Mistral-7b",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "StanfordAIMI/GREEN-Mistral-7b" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "StanfordAIMI/GREEN-Mistral-7b",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use StanfordAIMI/GREEN-Mistral-7b with Docker Model Runner:
docker model run hf.co/StanfordAIMI/GREEN-Mistral-7b
This model is a fine-tuned version of mistralai/Mistral-7B-v0.1 on an unknown dataset. It achieves the following results on the evaluation set:
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 1.7591 | 0.64 | 25 | 4.9279 |
| 2.0299 | 1.28 | 50 | 0.8182 |
| 0.6558 | 1.92 | 75 | 0.5750 |
| 0.4785 | 2.56 | 100 | 0.3823 |
| 0.3837 | 3.2 | 125 | 0.2941 |
| 0.3073 | 3.84 | 150 | 0.2318 |
| 0.2119 | 4.48 | 175 | 0.1871 |
| 0.1632 | 5.12 | 200 | 0.1595 |
| 0.1297 | 5.76 | 225 | 0.1487 |
| 0.1035 | 6.39 | 250 | 0.1476 |
| 0.0856 | 7.03 | 275 | 0.1427 |
| 0.0574 | 7.67 | 300 | 0.1482 |
| 0.0448 | 8.31 | 325 | 0.1552 |
| 0.0318 | 8.95 | 350 | 0.1562 |
| 0.0196 | 9.59 | 375 | 0.1709 |
| 0.0146 | 10.23 | 400 | 0.1793 |
| 0.0084 | 10.87 | 425 | 0.1854 |
| 0.0058 | 11.51 | 450 | 0.1919 |