Instructions to use qwopqwop/danbooru-llama with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use qwopqwop/danbooru-llama with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="qwopqwop/danbooru-llama")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("qwopqwop/danbooru-llama") model = AutoModelForCausalLM.from_pretrained("qwopqwop/danbooru-llama") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use qwopqwop/danbooru-llama with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "qwopqwop/danbooru-llama" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "qwopqwop/danbooru-llama", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/qwopqwop/danbooru-llama
- SGLang
How to use qwopqwop/danbooru-llama 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 "qwopqwop/danbooru-llama" \ --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": "qwopqwop/danbooru-llama", "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 "qwopqwop/danbooru-llama" \ --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": "qwopqwop/danbooru-llama", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use qwopqwop/danbooru-llama with Docker Model Runner:
docker model run hf.co/qwopqwop/danbooru-llama
how to use?
#3
by chengyiming - opened
model = AutoModelForCausalLM.from_pretrained(
repo_id,
device_map="cuda",
torch_dtype="auto",
)
tokenizer = AutoTokenizer.from_pretrained(repo_id)
outputs = transformers.pipeline(
task='text-generation',
model=model,
tokenizer=tokenizer,
max_new_tokens=max_new_tokens,
do_sample=True,
temperature=temperature,
top_p=top_p,
top_k=top_k,
return_full_text=True,
)
outputs = outputs(generate_prompt(system_content,user_content))
def generate_prompt(system_content,user_content):
prompt = ''
# sys_prompt = "Du bist ein freundlicher und hilfsbereiter KI-Assistent. Du beantwortest Fragen faktenorientiert und präzise, ohne dabei relevante Fakten auszulassen."
prompt += f"<|system|>\n{system_content.strip()}</s>\n"
prompt += f"<|user|>\n{user_content.strip()}</s>\n"
prompt += f"<|assistant|>\n"
return prompt.strip()
result:[{'generated_text': '<|system|>\nYou are an assistant that provides complete tags based on partial tags. When given a partial tag, provide a list of related tags.\n<|user|>\npartial tag:1girl,answer me in English\n<|assistant|>'}]
Prompt executed in 4.41 seconds
how to use
this model?