Text Generation
Transformers
Safetensors
English
markupdm
graphic design
design completion
multimodal
markup document
custom_code
Instructions to use cyberagent/markupdm with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cyberagent/markupdm with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cyberagent/markupdm", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("cyberagent/markupdm", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cyberagent/markupdm with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cyberagent/markupdm" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cyberagent/markupdm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/cyberagent/markupdm
- SGLang
How to use cyberagent/markupdm 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 "cyberagent/markupdm" \ --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": "cyberagent/markupdm", "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 "cyberagent/markupdm" \ --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": "cyberagent/markupdm", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use cyberagent/markupdm with Docker Model Runner:
docker model run hf.co/cyberagent/markupdm
Download configuration_markupdm.py from cyberagent/markupdm: direct link, hf CLI and curl.
- Browser
- Download file 2.19 kB
-
https://huggingface.co/cyberagent/markupdm/resolve/main/configuration_markupdm.py
- Command line
-
hf download hf://cyberagent/markupdm/configuration_markupdm.py
-
curl -L -o configuration_markupdm.py https://huggingface.co/cyberagent/markupdm/resolve/main/configuration_markupdm.py
2.19 kB
| """MarkupDM configuration""" | |
| from transformers import AutoConfig, PretrainedConfig | |
| from transformers.utils import logging | |
| logger = logging.get_logger(__name__) | |
| class MarkupDMConfig(PretrainedConfig): | |
| model_type = "markupdm" | |
| is_composition = True | |
| has_no_defaults_at_init = True | |
| def __init__( | |
| self, | |
| vocab_size: int = 49156, | |
| image_size: int = 256, | |
| image_pos_size: int = 4, | |
| image_pos_sigma: float = 10.0, | |
| image_loss_weight: float = 1.0, | |
| freeze_text_embeddings: bool = False, | |
| **kwargs, | |
| ) -> None: | |
| super().__init__(**kwargs) | |
| if "text_model" not in kwargs or "vision_model" not in kwargs: | |
| raise ValueError( | |
| f"A configuraton of type {self.model_type} cannot be" | |
| "instantiated because not both `text_model` and `vision_model`" | |
| f"sub-configurations are passed, but only {kwargs}" | |
| ) | |
| self.vocab_size = vocab_size | |
| self.image_size = image_size | |
| self.image_pos_size = image_pos_size | |
| self.image_pos_sigma = image_pos_sigma | |
| self.loss_type = "WeightedCausalLMLoss" | |
| self.image_loss_weight = image_loss_weight | |
| self.freeze_text_embeddings = freeze_text_embeddings | |
| text_config = kwargs.pop("text_model") | |
| vision_config = kwargs.pop("vision_model") | |
| if isinstance(text_config, PretrainedConfig): | |
| self.text_model = text_config | |
| else: | |
| path = text_config.pop("_name_or_path") | |
| self.text_model = AutoConfig.from_pretrained( | |
| path, | |
| **text_config, | |
| ) | |
| if isinstance(vision_config, PretrainedConfig): | |
| self.vision_model = vision_config | |
| else: | |
| path = vision_config.pop("_name_or_path") | |
| self.vision_model = AutoConfig.from_pretrained( | |
| path, | |
| trust_remote_code=True, | |
| **vision_config, | |
| ) | |
| # Update config | |
| self.initializer_range = self.text_model.initializer_range | |
| self.num_hidden_layers = self.text_model.num_hidden_layers | |
| self.is_decoder = True | |