wikimedia/wikipedia
Viewer • Updated • 61.6M • 195k • 1.25k
How to use uisikdag/umitllama1.2b_galore_en_wp with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="uisikdag/umitllama1.2b_galore_en_wp") # Load model directly
from transformers import AutoTokenizer, AutoModelForMultimodalLM
tokenizer = AutoTokenizer.from_pretrained("uisikdag/umitllama1.2b_galore_en_wp")
model = AutoModelForMultimodalLM.from_pretrained("uisikdag/umitllama1.2b_galore_en_wp")How to use uisikdag/umitllama1.2b_galore_en_wp with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "uisikdag/umitllama1.2b_galore_en_wp"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "uisikdag/umitllama1.2b_galore_en_wp",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/uisikdag/umitllama1.2b_galore_en_wp
How to use uisikdag/umitllama1.2b_galore_en_wp with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "uisikdag/umitllama1.2b_galore_en_wp" \
--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": "uisikdag/umitllama1.2b_galore_en_wp",
"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 "uisikdag/umitllama1.2b_galore_en_wp" \
--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": "uisikdag/umitllama1.2b_galore_en_wp",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use uisikdag/umitllama1.2b_galore_en_wp with Docker Model Runner:
docker model run hf.co/uisikdag/umitllama1.2b_galore_en_wp
~1.123B parameter model trained with 6.4M rows of wikipedia.en dataset
epochs:1
Trained on RTX 5060 16GB VRAM 16 GB RAM
GaLore: Memory-Efficient LLM Training by Gradient Low-Rank Projection.
import torch
import argparse
from transformers import AutoModelForCausalLM, AutoTokenizer
def run_inference(model_id, prompt, max_tokens=50):
print(f"Fetching model '{model_id}' from Hugging Face Hub...")
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
print(f"\nPrompt: {prompt}")
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
# Llama models do not use token_type_ids
inputs.pop("token_type_ids", None)
# Generate
print("Generating...")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=max_tokens,
do_sample=True,
temperature=0.7,
pad_token_id=tokenizer.eos_token_id
)
result = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(f"\nResponse:\n{result}")
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--model_id", type=str, default="uisikdag/umitllama1.2b_galore_en_wp")
parser.add_argument("--prompt", type=str, default="The future of artificial intelligence is")
args = parser.parse_args()
run_inference(args.model_id, args.prompt)