Text Generation
Transformers
Safetensors
cola2
feature-extraction
custom_code
diffusion
continuous-latent
base-model
conversational
Instructions to use ByteDance-Seed/Cola2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ByteDance-Seed/Cola2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ByteDance-Seed/Cola2", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ByteDance-Seed/Cola2", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ByteDance-Seed/Cola2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ByteDance-Seed/Cola2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ByteDance-Seed/Cola2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ByteDance-Seed/Cola2
- SGLang
How to use ByteDance-Seed/Cola2 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 "ByteDance-Seed/Cola2" \ --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": "ByteDance-Seed/Cola2", "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 "ByteDance-Seed/Cola2" \ --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": "ByteDance-Seed/Cola2", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ByteDance-Seed/Cola2 with Docker Model Runner:
docker model run hf.co/ByteDance-Seed/Cola2
File size: 2,163 Bytes
a310630 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | {
"architectures": [
"Cola2ForConditionalGeneration"
],
"attention_dropout": 0.0,
"auto_map": {
"AutoConfig": "configuration_cola2.Cola2Config",
"AutoModel": "modeling_cola2.Cola2ForConditionalGeneration",
"AutoModelForCausalLM": "modeling_cola2.Cola2ForConditionalGeneration"
},
"bos_token_id": 151643,
"boundary_score_alpha": 10.0,
"boundary_score_threshold": 0.5,
"cola2_format_version": 1,
"condition_num_attention_heads": 20,
"condition_rope_theta": 500000.0,
"decoder_condition_num_hidden_layers": 2,
"decoder_head_dim": 128,
"decoder_hidden_size": 2560,
"decoder_intermediate_size": 9728,
"decoder_lm_head_bias": true,
"decoder_num_attention_heads": 32,
"decoder_num_hidden_layers": 36,
"decoder_num_key_value_heads": 8,
"decoder_rope_theta": 1000000.0,
"diffusion_time": 1000.0,
"dit_block_size": 8,
"dit_head_dim": 128,
"dit_hidden_size": 2560,
"dit_intermediate_size": 10240,
"dit_layer_norm_eps": 1e-05,
"dit_num_attention_heads": 20,
"dit_num_hidden_layers": 34,
"dit_rope_dim": 96,
"dit_rope_theta": 10000.0,
"duration_hidden_size": 1280,
"encoder_embedding_size": 2560,
"encoder_hidden_size": 1536,
"encoder_intermediate_size": 6144,
"encoder_num_attention_heads": 12,
"encoder_num_hidden_layers": 0,
"encoder_rope_theta": 500000.0,
"eos_token_id": 151643,
"hidden_act": "silu",
"hidden_dropout": 0.0,
"im_end_token_id": 151645,
"im_start_token_id": 151644,
"initializer_range": 0.02,
"latent_block_causal": false,
"latent_block_size": 8,
"latent_decoder_num_hidden_layers": 0,
"latent_dim": 64,
"latent_encoder_num_hidden_layers": 2,
"layer_norm_eps": 1e-06,
"local_position_dim": 128,
"mask_token_id": 151936,
"max_position_embeddings": 32768,
"max_span_length": 8,
"min_span_length": 1,
"model_type": "cola2",
"pad_token_id": 151936,
"pool_num_hidden_layers": 2,
"preset": "cola2",
"rope_theta": 1000000.0,
"scaling_factor": 1.0,
"shifting_factor": 0.0,
"target_compression_rate": 0.5,
"tie_word_embeddings": false,
"torch_dtype": "float32",
"use_variational_encoder": true,
"vocab_size": 151936
}
|