Image-to-Text
Transformers.js
ONNX
English
multi_modality
webgpu
multimodal
text-to-image
vision-language
janus
browser-ai
edge-ai
Run this model with HF Jobs
Run Zhare-AI/janus-pro-7b-webgpu on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Zhare-AI/janus-pro-7b-webgpu. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Zhare-AI/janus-pro-7b-webgpu on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Zhare-AI/janus-pro-7b-webgpu with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use Zhare-AI/janus-pro-7b-webgpu with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-to-text', 'Zhare-AI/janus-pro-7b-webgpu');
Upload folder using huggingface_hub
Browse filesFiles changed (2)
- config.json+3-3
- test_model.jsAdded+58
42 unmodified lines4344454647484950515 unmodified lines5758596061626342 unmodified lines"torch_dtype": "bfloat16","vocab_size": 102400},"model_type": "janus","torch_dtype": "float16","transformers_version": "4.33.1","vision_config": {"cls": "CLIPVisionTower","model_type": "vision",5 unmodified lines}},"architectures": ["JanusForConditionalGeneration"],"use_cache": true,"webgpu_compatible": true,42 unmodified lines4344454647484950515 unmodified lines5758596061626342 unmodified lines"torch_dtype": "bfloat16","vocab_size": 102400},"model_type": "multi_modality","torch_dtype": "float16","transformers_version": "4.36.0","vision_config": {"cls": "CLIPVisionTower","model_type": "vision",5 unmodified lines}},"architectures": ["MultiModalityCausalLM"],"use_cache": true,"webgpu_compatible": true,
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758// Janus Model Test Script// Test if the model can be loaded successfully
import { AutoProcessor, MultiModalityCausalLM } from "@huggingface/transformers";
async function testJanusModel() { console.log("Testing Janus Model Loading...");
const modelPath = + str(model_dir) + ;
try { console.log("Loading processor..."); const processor = await AutoProcessor.from_pretrained(modelPath); console.log("Processor loaded successfully");
console.log("Loading model..."); const model = await MultiModalityCausalLM.from_pretrained(modelPath, { device: "webgpu", dtype: "q4f16" }); console.log("Model loaded successfully");
console.log("SUCCESS! Model initialization complete"); console.log("Model is ready for inference");
return { model, processor };
} catch (error) { console.error("Model loading failed:"); console.error(error);
// Try CPU fallback console.log("Trying CPU fallback..."); try { const processor = await AutoProcessor.from_pretrained(modelPath); const model = await MultiModalityCausalLM.from_pretrained(modelPath, { device: "cpu" }); console.log("CPU fallback successful"); return { model, processor }; } catch (cpuError) { console.error("CPU fallback also failed:"); console.error(cpuError); throw cpuError; } }}
// Run the testtestJanusModel() .then(() => console.log("Test completed successfully")) .catch(error => console.error("Test failed:", error));
export { testJanusModel };config.json+3-3
test_model.jsAdded+58