Text Generation
Transformers
Safetensors
Chinese
English
qwen2
cybersecurity
security
network-security
conversational
text-generation-inference
Instructions to use clouditera/secgpt with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use clouditera/secgpt with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="clouditera/secgpt") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("clouditera/secgpt") model = AutoModelForCausalLM.from_pretrained("clouditera/secgpt", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use clouditera/secgpt with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "clouditera/secgpt" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "clouditera/secgpt", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/clouditera/secgpt
- SGLang
How to use clouditera/secgpt 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 "clouditera/secgpt" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "clouditera/secgpt", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "clouditera/secgpt" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "clouditera/secgpt", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use clouditera/secgpt with Docker Model Runner:
docker model run hf.co/clouditera/secgpt
Delete configuration_baichuan.py
Browse files- configuration_baichuan.py +0 -46
configuration_baichuan.py
DELETED
|
@@ -1,46 +0,0 @@
|
|
| 1 |
-
# Copyright (c) 2023, Baichuan Intelligent Technology. All rights reserved.
|
| 2 |
-
|
| 3 |
-
from transformers.configuration_utils import PretrainedConfig
|
| 4 |
-
|
| 5 |
-
class BaichuanConfig(PretrainedConfig):
|
| 6 |
-
model_type = "baichuan"
|
| 7 |
-
keys_to_ignore_at_inference = ["past_key_values"]
|
| 8 |
-
|
| 9 |
-
def __init__(
|
| 10 |
-
self,
|
| 11 |
-
vocab_size=64000,
|
| 12 |
-
hidden_size=5120,
|
| 13 |
-
intermediate_size=13696,
|
| 14 |
-
num_hidden_layers=40,
|
| 15 |
-
num_attention_heads=40,
|
| 16 |
-
hidden_act="silu",
|
| 17 |
-
model_max_length=4096,
|
| 18 |
-
initializer_range=0.02,
|
| 19 |
-
rms_norm_eps=1e-6,
|
| 20 |
-
use_cache=True,
|
| 21 |
-
pad_token_id=0,
|
| 22 |
-
bos_token_id=1,
|
| 23 |
-
eos_token_id=2,
|
| 24 |
-
tie_word_embeddings=False,
|
| 25 |
-
gradient_checkpointing=False,
|
| 26 |
-
**kwargs,
|
| 27 |
-
):
|
| 28 |
-
self.vocab_size = vocab_size
|
| 29 |
-
self.model_max_length = model_max_length
|
| 30 |
-
self.hidden_size = hidden_size
|
| 31 |
-
self.intermediate_size = intermediate_size
|
| 32 |
-
self.num_hidden_layers = num_hidden_layers
|
| 33 |
-
self.num_attention_heads = num_attention_heads
|
| 34 |
-
self.hidden_act = hidden_act
|
| 35 |
-
self.initializer_range = initializer_range
|
| 36 |
-
self.rms_norm_eps = rms_norm_eps
|
| 37 |
-
self.use_cache = use_cache
|
| 38 |
-
self.gradient_checkpointing = gradient_checkpointing,
|
| 39 |
-
super().__init__(
|
| 40 |
-
pad_token_id=pad_token_id,
|
| 41 |
-
bos_token_id=bos_token_id,
|
| 42 |
-
eos_token_id=eos_token_id,
|
| 43 |
-
tie_word_embeddings=tie_word_embeddings,
|
| 44 |
-
**kwargs,
|
| 45 |
-
)
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|