Instructions to use TroyDoesAI/MermaidStable3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TroyDoesAI/MermaidStable3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TroyDoesAI/MermaidStable3B", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("TroyDoesAI/MermaidStable3B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TroyDoesAI/MermaidStable3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TroyDoesAI/MermaidStable3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TroyDoesAI/MermaidStable3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/TroyDoesAI/MermaidStable3B
- SGLang
How to use TroyDoesAI/MermaidStable3B 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 "TroyDoesAI/MermaidStable3B" \ --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": "TroyDoesAI/MermaidStable3B", "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 "TroyDoesAI/MermaidStable3B" \ --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": "TroyDoesAI/MermaidStable3B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use TroyDoesAI/MermaidStable3B with Docker Model Runner:
docker model run hf.co/TroyDoesAI/MermaidStable3B
Mermid code created
Below is my code
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("ImgtoTxt_model\Mermaid", trust_remote_code=True)
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("ImgtoTxt_model\Mermaid")
input_text = "Create the mermaid diagram for the following content: Requirements Analysis, Test Planning, Test Design, Test Environment Setup, Test Execution, Defect Tracking & Reporting, Defect Retesting, Test Closure."
input_ids = tokenizer(input_text, return_tensors="pt")["input_ids"]
model_output = model(input_ids)
print(model_output)
i want to generate a mermaid code to generate a flow for my project , after execting above code my getting out like this ,,
ausalLMOutputWithPast(loss=None, logits=tensor([[[ 5.9338, -1.7678, 10.1082, ..., 2.3115, 2.3115, 2.3114],
[12.2185, 5.5878, 13.9753, ..., 3.5128, 3.5128, 3.5128],
[11.6728, 5.9285, 15.3879, ..., 3.0656, 3.0656, 3.0656],
...,
[ 7.7073, 6.1561, 6.1371, ..., -0.5457, -0.5457, -0.5457],
[19.2320, 10.5400, 16.4419, ..., 2.1776, 2.1776, 2.1776],
[13.0235, 5.9899, 7.4020, ..., -0.1460, -0.1460, -0.1460]]],
grad_fn=), past_key_values=((tensor([[[[-6.7386e-03, 2.7572e-01, -6.6395e-01, ..., -6.8383e-02,
6.6220e-02, -6.3076e-02],
[-9.0371e-03, 3.1162e-01, -4.2063e-01, ..., 2.9323e-01,
-2.6269e-01, 3.1766e-01],
[ 3.7455e-03, 3.0579e-01, -5.8179e-01, ..., 2.8499e-02,
-2.6892e-02, 2.6823e-02],
...,
[ 1.4920e-03, -1.6419e-01, 1.7003e-01, ..., -3.4981e-02,
2.1300e-02, -5.9812e-02],
[-5.6985e-03, -2.2551e-01, 2.3286e-01, ..., -2.3844e-02,
2.0526e-02, -2.6809e-02],
[-8.5520e-03, -1.5502e-01, 1.2061e-01, ..., 4.3704e-01,
-3.9851e-01, 4.5750e-01]],
[[ 1.6527e-03, 4.5222e-04, -2.9575e-03, ..., 6.1219e-02,
-9.0673e-02, -7.8233e-02],
[ 2.4505e-03, 4.5875e-03, 5.7554e-03, ..., -1.9407e-01,
2.9361e-01, 2.5195e-01],
...
[-0.7170, -1.4814, -1.3201, ..., 0.0488, 0.3491, 3.9280],
[-0.1089, -0.1059, -1.3233, ..., -0.7048, -0.5772, 1.4097],
[-2.7574, -1.4348, -0.1937, ..., -3.0166, -1.2036, 0.2280]]]],
grad_fn=))), hidden_states=None, attentions=None)
can you plz help to covert this in to mermaid code ...