Instructions to use alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2") model = AutoModelForCausalLM.from_pretrained("alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2
- SGLang
How to use alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2 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 "alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2" \ --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": "alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2", "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 "alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2" \ --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": "alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2 with Docker Model Runner:
docker model run hf.co/alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2
Inference API works bad ???
Inference API works very bad, and always generate repeat content.
Hi,
what inference contents are you using?
my input in the Inference API: blue sky
It just returned: blue sky and the sun shining brightly in the sky.
input: Astronaut rides horse
returns: Astronaut rides horseback ride on moon in 1969 lunar eclipse. Photo: NASA
The 1969 lunar
I think it may not work properly.
my input in the Inference API: blue sky
It just returned: blue sky and the sun shining brightly in the sky.
input: Astronaut rides horse
returns: Astronaut rides horseback ride on moon in 1969 lunar eclipse. Photo: NASA
The 1969 lunar
I think it may not work properly.
The API i'm using is just the huggingface web Inference API. More detailly, alibaba-pai/pai-bloom-1b1-text2prompt-sd-v2
