Instructions to use hyunseop/RailWayGemma31B-LoRA with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hyunseop/RailWayGemma31B-LoRA with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="hyunseop/RailWayGemma31B-LoRA") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("hyunseop/RailWayGemma31B-LoRA") model = AutoModelForMultimodalLM.from_pretrained("hyunseop/RailWayGemma31B-LoRA") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hyunseop/RailWayGemma31B-LoRA with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hyunseop/RailWayGemma31B-LoRA" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hyunseop/RailWayGemma31B-LoRA", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/hyunseop/RailWayGemma31B-LoRA
- SGLang
How to use hyunseop/RailWayGemma31B-LoRA 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 "hyunseop/RailWayGemma31B-LoRA" \ --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": "hyunseop/RailWayGemma31B-LoRA", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "hyunseop/RailWayGemma31B-LoRA" \ --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": "hyunseop/RailWayGemma31B-LoRA", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use hyunseop/RailWayGemma31B-LoRA with Docker Model Runner:
docker model run hf.co/hyunseop/RailWayGemma31B-LoRA
See axolotl config
axolotl version: 0.17.0
base_model: google/gemma-4-31B-it
plugins:
- axolotl.integrations.liger.LigerPlugin
cut_cross_entropy: false
torch_compile: false
liger_layer_norm: true
liger_rope: true
liger_rms_norm: true
liger_glu_activation: true
liger_rms_norm_gated: true
strict: false
chat_template: gemma4
chat_template_kwargs:
enable_thinking: false
sequence_len: 2048
sample_packing: false
pad_to_sequence_len: false
dataset_num_proc: 2
adapter: lora
lora_r: 16
lora_alpha: 32
lora_dropout: 0.05
lora_target_modules: 'model.language_model.layers.[\d]+.(_checkpoint_wrapped_module.)?(mlp|self_attn).(up|down|gate|q|k|v|o)_proj'
micro_batch_size: 1
gradient_accumulation_steps: 1
num_epochs: 1
optimizer: adamw_torch_fused
lr_scheduler: cosine
learning_rate: 5.0e-5
warmup_ratio: 0.05
bf16: true
tf32: true
attn_implementation: sdpa
gradient_checkpointing: false
weight_decay: 0.0
logging_steps: 10
evals_per_epoch: 2
saves_per_epoch: 1
fsdp_version: 2
fsdp_config:
offload_params: false
state_dict_type: SHARDED_STATE_DICT
auto_wrap_policy: TRANSFORMER_BASED_WRAP
transformer_layer_cls_to_wrap: Gemma4TextDecoderLayer
reshard_after_forward: true
cpu_ram_efficient_loading: true
dp_shard_size: 4
experimental_skip_move_to_device: true
use_wandb: true
wandb_project: korail-gemma4
wandb_name: korail-gemma4-focus-sft-v5
push_to_hub: false
mnt/cepheid/users/hsypfsv/KORAIL_MAINTENANCE/finetune/gemma4_31b/output/korail_gemma4_h100_lora_4gpu_focus_sft_v5
This model is a fine-tuned version of google/gemma-4-31B-it on the /mnt/cepheid/users/hsypfsv/KORAIL_MAINTENANCE/finetune/gemma4_31b/data/korail_focus_sft_train.jsonl dataset. It achieves the following results on the evaluation set:
- Loss: 1.5416
- Ppl: 4.6721
- Memory/max Active (gib): 26.69
- Memory/max Allocated (gib): 26.69
- Memory/device Reserved (gib): 36.52
Model description
More information needed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 5e-05
- train_batch_size: 1
- eval_batch_size: 1
- seed: 42
- distributed_type: multi-GPU
- num_devices: 4
- total_train_batch_size: 4
- total_eval_batch_size: 4
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: cosine
- lr_scheduler_warmup_steps: 33
- training_steps: 675
Training results
| Training Loss | Epoch | Step | Validation Loss | Ppl | Active (gib) | Allocated (gib) | Reserved (gib) |
|---|---|---|---|---|---|---|---|
| No log | 0 | 0 | 6.6640 | 783.6891 | 24.22 | 24.22 | 24.51 |
| 1.5144 | 0.5007 | 338 | 1.5955 | 4.9309 | 27.33 | 27.33 | 38.51 |
| 1.6051 | 1.0 | 675 | 1.5416 | 4.6721 | 26.69 | 26.69 | 36.52 |
Framework versions
- Transformers 5.9.0
- Pytorch 2.12.0+cu130
- Datasets 4.8.5- Tokenizers 0.22.2
- Downloads last month
- 7