Text Generation
Transformers
English
encoder_decoder
code
natural language understanding
machine learning
research
introspection
self-reflection
conversational
Instructions to use Or4cl3-1/CSUMLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Or4cl3-1/CSUMLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Or4cl3-1/CSUMLM") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Or4cl3-1/CSUMLM", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Or4cl3-1/CSUMLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Or4cl3-1/CSUMLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Or4cl3-1/CSUMLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Or4cl3-1/CSUMLM
- SGLang
How to use Or4cl3-1/CSUMLM 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 "Or4cl3-1/CSUMLM" \ --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": "Or4cl3-1/CSUMLM", "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 "Or4cl3-1/CSUMLM" \ --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": "Or4cl3-1/CSUMLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Or4cl3-1/CSUMLM with Docker Model Runner:
docker model run hf.co/Or4cl3-1/CSUMLM
File size: 2,730 Bytes
26d22a0 | 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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | from typing import Optional, Tuple, Union
import torch
import torch.nn as nn
from transformers import PreTrainedModel, PreTrainedEncoder, PreTrainedDecoder
from transformers.modeling_outputs import BaseModelOutput, Seq2SeqLMOutput
from transformers.utils import logging
logger = logging.get_logger(__name__)
class CSUMLMEncoder(PreTrainedEncoder):
def __init__(self, config):
super().__init__(config)
# Define the text encoder, image encoder, and audio encoder architectures
# ...
def forward(
self,
input_ids=None,
attention_mask=None,
token_type_ids=None,
position_ids=None,
head_mask=None,
inputs_embeds=None,
encoder_hidden_states=None,
encoder_attention_mask=None,
past_key_values=None,
use_cache=None,
output_attentions=None,
output_hidden_states=None,
return_dict=None,
):
# Implement the forward pass for the encoder
# ...
return encoder_outputs
class CSUMLMDecoder(PreTrainedDecoder):
def __init__(self, config):
super().__init__(config)
# Define the decoder architecture
# ...
def forward(
self,
input_ids=None,
attention_mask=None,
encoder_hidden_states=None,
encoder_attention_mask=None,
head_mask=None,
cross_attn_head_mask=None,
past_key_values=None,
inputs_embeds=None,
use_cache=None,
output_attentions=None,
output_hidden_states=None,
return_dict=None,
):
# Implement the forward pass for the decoder
# ...
return decoder_outputs
class CSUMLMModel(PreTrainedModel):
def __init__(self, config):
super().__init__(config)
self.encoder = CSUMLMEncoder(config)
self.decoder = CSUMLMDecoder(config)
self.multimodal_fusion = MultimodalFusion(config)
# Initialize other components (e.g., attention mechanism, belief desire intent tree)
# ...
def forward(
self,
input_ids=None,
attention_mask=None,
decoder_input_ids=None,
decoder_attention_mask=None,
head_mask=None,
decoder_head_mask=None,
cross_attn_head_mask=None,
encoder_outputs=None,
past_key_values=None,
inputs_embeds=None,
decoder_inputs_embeds=None,
use_cache=None,
output_attentions=None,
output_hidden_states=None,
return_dict=None,
):
# Implement the forward pass for the CSUMLM model
# ...
return output
# Register the custom model with Hugging Face Transformers
CSUMLMModel.register_for_auto_class() |