Image-Text-to-Text
Transformers
Safetensors
qwen2
text-generation
conversational
text-generation-inference
Instructions to use luzimu/WebGenAgent-LM-7B-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use luzimu/WebGenAgent-LM-7B-SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="luzimu/WebGenAgent-LM-7B-SFT") 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 AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("luzimu/WebGenAgent-LM-7B-SFT") model = AutoModelForMultimodalLM.from_pretrained("luzimu/WebGenAgent-LM-7B-SFT") 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 = 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use luzimu/WebGenAgent-LM-7B-SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "luzimu/WebGenAgent-LM-7B-SFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "luzimu/WebGenAgent-LM-7B-SFT", "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/luzimu/WebGenAgent-LM-7B-SFT
- SGLang
How to use luzimu/WebGenAgent-LM-7B-SFT 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 "luzimu/WebGenAgent-LM-7B-SFT" \ --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": "luzimu/WebGenAgent-LM-7B-SFT", "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 "luzimu/WebGenAgent-LM-7B-SFT" \ --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": "luzimu/WebGenAgent-LM-7B-SFT", "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 luzimu/WebGenAgent-LM-7B-SFT with Docker Model Runner:
docker model run hf.co/luzimu/WebGenAgent-LM-7B-SFT
| { | |
| "best_metric": null, | |
| "best_model_checkpoint": null, | |
| "epoch": 1.0, | |
| "eval_steps": 500, | |
| "global_step": 16, | |
| "is_hyper_param_search": false, | |
| "is_local_process_zero": true, | |
| "is_world_process_zero": true, | |
| "log_history": [ | |
| { | |
| "epoch": 0.06557377049180328, | |
| "grad_norm": 0.24846524000167847, | |
| "learning_rate": 8.000000000000001e-06, | |
| "loss": 0.2054, | |
| "step": 1 | |
| }, | |
| { | |
| "epoch": 0.13114754098360656, | |
| "grad_norm": 0.23854631185531616, | |
| "learning_rate": 1.6000000000000003e-05, | |
| "loss": 0.1943, | |
| "step": 2 | |
| }, | |
| { | |
| "epoch": 0.19672131147540983, | |
| "grad_norm": 0.12206465750932693, | |
| "learning_rate": 2.4e-05, | |
| "loss": 0.1598, | |
| "step": 3 | |
| }, | |
| { | |
| "epoch": 0.26229508196721313, | |
| "grad_norm": 0.10146363824605942, | |
| "learning_rate": 3.2000000000000005e-05, | |
| "loss": 0.1503, | |
| "step": 4 | |
| }, | |
| { | |
| "epoch": 0.32786885245901637, | |
| "grad_norm": 0.29939085245132446, | |
| "learning_rate": 4e-05, | |
| "loss": 0.1893, | |
| "step": 5 | |
| }, | |
| { | |
| "epoch": 0.39344262295081966, | |
| "grad_norm": 0.23336249589920044, | |
| "learning_rate": 3.9938346674662565e-05, | |
| "loss": 0.1819, | |
| "step": 6 | |
| }, | |
| { | |
| "epoch": 0.45901639344262296, | |
| "grad_norm": 0.0746205598115921, | |
| "learning_rate": 3.9753766811902756e-05, | |
| "loss": 0.1577, | |
| "step": 7 | |
| }, | |
| { | |
| "epoch": 0.5245901639344263, | |
| "grad_norm": 0.07674132287502289, | |
| "learning_rate": 3.9447398407953536e-05, | |
| "loss": 0.1482, | |
| "step": 8 | |
| }, | |
| { | |
| "epoch": 0.5901639344262295, | |
| "grad_norm": 0.055854540318250656, | |
| "learning_rate": 3.9021130325903076e-05, | |
| "loss": 0.135, | |
| "step": 9 | |
| }, | |
| { | |
| "epoch": 0.6557377049180327, | |
| "grad_norm": 0.04436395317316055, | |
| "learning_rate": 3.8477590650225735e-05, | |
| "loss": 0.1366, | |
| "step": 10 | |
| }, | |
| { | |
| "epoch": 0.7213114754098361, | |
| "grad_norm": 0.053606096655130386, | |
| "learning_rate": 3.782013048376736e-05, | |
| "loss": 0.128, | |
| "step": 11 | |
| }, | |
| { | |
| "epoch": 0.7868852459016393, | |
| "grad_norm": 0.036096639931201935, | |
| "learning_rate": 3.705280328708185e-05, | |
| "loss": 0.1205, | |
| "step": 12 | |
| }, | |
| { | |
| "epoch": 0.8524590163934426, | |
| "grad_norm": 0.032327715307474136, | |
| "learning_rate": 3.6180339887498953e-05, | |
| "loss": 0.1193, | |
| "step": 13 | |
| }, | |
| { | |
| "epoch": 0.9180327868852459, | |
| "grad_norm": 0.03768343850970268, | |
| "learning_rate": 3.520811931200063e-05, | |
| "loss": 0.123, | |
| "step": 14 | |
| }, | |
| { | |
| "epoch": 0.9836065573770492, | |
| "grad_norm": 0.03514982387423515, | |
| "learning_rate": 3.4142135623730954e-05, | |
| "loss": 0.125, | |
| "step": 15 | |
| }, | |
| { | |
| "epoch": 1.0, | |
| "grad_norm": 0.03514982387423515, | |
| "learning_rate": 3.298896096660367e-05, | |
| "loss": 0.1023, | |
| "step": 16 | |
| } | |
| ], | |
| "logging_steps": 1.0, | |
| "max_steps": 45, | |
| "num_input_tokens_seen": 0, | |
| "num_train_epochs": 3, | |
| "save_steps": 500, | |
| "stateful_callbacks": { | |
| "TrainerControl": { | |
| "args": { | |
| "should_epoch_stop": false, | |
| "should_evaluate": false, | |
| "should_log": false, | |
| "should_save": true, | |
| "should_training_stop": false | |
| }, | |
| "attributes": {} | |
| } | |
| }, | |
| "total_flos": 31455266734080.0, | |
| "train_batch_size": 1, | |
| "trial_name": null, | |
| "trial_params": null | |
| } | |