wikimedia/wikipedia
Viewer • Updated • 61.6M • 253k • 1.34k
How to use yrrhall/arabic-nano-gpt-v0 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="yrrhall/arabic-nano-gpt-v0") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("yrrhall/arabic-nano-gpt-v0")
model = AutoModelForCausalLM.from_pretrained("yrrhall/arabic-nano-gpt-v0", device_map="auto")How to use yrrhall/arabic-nano-gpt-v0 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "yrrhall/arabic-nano-gpt-v0"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "yrrhall/arabic-nano-gpt-v0",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/yrrhall/arabic-nano-gpt-v0
How to use yrrhall/arabic-nano-gpt-v0 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "yrrhall/arabic-nano-gpt-v0" \
--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": "yrrhall/arabic-nano-gpt-v0",
"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 "yrrhall/arabic-nano-gpt-v0" \
--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": "yrrhall/arabic-nano-gpt-v0",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use yrrhall/arabic-nano-gpt-v0 with Docker Model Runner:
docker model run hf.co/yrrhall/arabic-nano-gpt-v0
This model is a fine-tuned version of openai-community/gpt2 on the arabic wikimedia/wikipedia dataset.
Repository on GitHub: e-hossam96/arabic-nano-gpt
The model achieves the following results on the held-out test set:
import torch
from transformers import pipeline
model_ckpt = "e-hossam96/arabic-nano-gpt-v0"
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
lm = pipeline(task="text-generation", model=model_ckpt, device=device)
prompt = """المحرك النفاث هو محرك ينفث الموائع (الماء أو الهواء) بسرعة فائقة \
لينتج قوة دافعة اعتمادا على مبدأ قانون نيوتن الثالث للحركة. \
هذا التعريف الواسع للمحركات النفاثة يتضمن أيضا"""
output = lm(prompt, max_new_tokens=128)
print(output[0]["generated_text"])
The entire wikipedia dataset was split into three splits based on the 90-5-5 ratios.
The following hyperparameters were used during training:
Base model
openai-community/gpt2