Instructions to use sugiv/Fuyu-8b-transfer-learned-spiqa-simplified with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sugiv/Fuyu-8b-transfer-learned-spiqa-simplified with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="sugiv/Fuyu-8b-transfer-learned-spiqa-simplified")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("sugiv/Fuyu-8b-transfer-learned-spiqa-simplified") model = AutoModelForImageTextToText.from_pretrained("sugiv/Fuyu-8b-transfer-learned-spiqa-simplified") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sugiv/Fuyu-8b-transfer-learned-spiqa-simplified with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sugiv/Fuyu-8b-transfer-learned-spiqa-simplified" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sugiv/Fuyu-8b-transfer-learned-spiqa-simplified", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/sugiv/Fuyu-8b-transfer-learned-spiqa-simplified
- SGLang
How to use sugiv/Fuyu-8b-transfer-learned-spiqa-simplified 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 "sugiv/Fuyu-8b-transfer-learned-spiqa-simplified" \ --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": "sugiv/Fuyu-8b-transfer-learned-spiqa-simplified", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "sugiv/Fuyu-8b-transfer-learned-spiqa-simplified" \ --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": "sugiv/Fuyu-8b-transfer-learned-spiqa-simplified", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use sugiv/Fuyu-8b-transfer-learned-spiqa-simplified with Docker Model Runner:
docker model run hf.co/sugiv/Fuyu-8b-transfer-learned-spiqa-simplified
This model is transfer learned on scientific image visual question answering simplified dataset, sugiv/spiqa-simplified-for-fuyu8b-transfer-learning and it is based on adept/fuyu-8b. Most of the model layers are frozen and as I am GPU poor, this transfer learned model was trained only on a subset of simplified dataset and for two epochs only on A100, 80GB rented and $10 dollars was total spent.
model_path="sugiv/Fuyu-8b-transfer-learned-spiqa-simplified"
processor = FuyuProcessor.from_pretrained(model_path)
model = FuyuForCausalLM.from_pretrained(model_path, device_map="auto")
text_prompt = "What color is the bus?\n"
url = "https://huggingface.co/adept/fuyu-8b/resolve/main/bus.png"
image = Image.open(requests.get(url, stream=True).raw)
inputs = processor(text=text_prompt, images=image, return_tensors="pt").to("cuda:0")
# Move inputs to the same device as the model
device = next(model.parameters()).device
inputs = {k: v.to(device) if isinstance(v, torch.Tensor) else v for k, v in inputs.items()}
# If 'image_patches' is a list of tensors, move each tensor to the correct device
if 'image_patches' in inputs and isinstance(inputs['image_patches'], list):
inputs['image_patches'] = [patch.to(device) for patch in inputs['image_patches']]
outputs = model.generate(
**inputs,
max_new_tokens=400,
repetition_penalty=1.2,
no_repeat_ngram_size=3,
top_k=40,
top_p=0.92,
temperature=0.7,
do_sample=True
)
# Decode the output
generated_text = processor.decode(outputs[0], skip_special_tokens=True)
# Clean up the generated text
generated_text = generated_text.replace("|SPEAKER|", "").replace("|NEWLINE|", " ").strip()
if "\x04" in generated_text:
generated_text = generated_text.split("\x04")[-1].strip()
print(generated_text)
- Downloads last month
- 3
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support