yirenc/4_ethics_all
Viewer • Updated • 68.1k • 8
How to use yirenc/Ethical-Llama3-8B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="yirenc/Ethical-Llama3-8B") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("yirenc/Ethical-Llama3-8B")
model = AutoModelForCausalLM.from_pretrained("yirenc/Ethical-Llama3-8B")How to use yirenc/Ethical-Llama3-8B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "yirenc/Ethical-Llama3-8B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "yirenc/Ethical-Llama3-8B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/yirenc/Ethical-Llama3-8B
How to use yirenc/Ethical-Llama3-8B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "yirenc/Ethical-Llama3-8B" \
--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": "yirenc/Ethical-Llama3-8B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "yirenc/Ethical-Llama3-8B" \
--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": "yirenc/Ethical-Llama3-8B",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use yirenc/Ethical-Llama3-8B with Docker Model Runner:
docker model run hf.co/yirenc/Ethical-Llama3-8B
This is a fine-tuned version of Meta-Llama-3-8B model on AI Ethics dataset. The usage of this model should comply with the Llama 3 Community License and the Acceptable Use Policy.
| Category | F1 Score | Accuracy | Correct Formatting |
|---|---|---|---|
| Deontology | 0.258 | 0.180 | 0.340 |
| Justice | 0.100 | 0.060 | 0.100 |
| Utilitarianism | 0.123 | 0.070 | 0.150 |
| Virtue | 0.057 | 0.030 | 0.040 |
| Category | F1 Score | Accuracy | Correct Formatting |
|---|---|---|---|
| Deontology | 0.428 | 0.490 | 1.000 |
| Justice | 0.366 | 0.520 | 1.000 |
| Utilitarianism | 0.449 | 0.540 | 1.000 |
| Virtue | 0.476 | 0.600 | 1.000 |
| Category | F1 Score | Accuracy | Correct Formatting |
|---|---|---|---|
| Deontology | 0.930 | 0.930 | 1.000 |
| Justice | 0.960 | 0.960 | 1.000 |
| Utilitarianism | 0.750 | 0.750 | 1.000 |
| Virtue | 0.891 | 0.890 | 1.000 |