Instructions to use Continuous-Rivals-Discrete/langflow-lm1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Continuous-Rivals-Discrete/langflow-lm1b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Continuous-Rivals-Discrete/langflow-lm1b", trust_remote_code=True)# Load model directly from transformers import AutoModelForMaskedLM model = AutoModelForMaskedLM.from_pretrained("Continuous-Rivals-Discrete/langflow-lm1b", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Continuous-Rivals-Discrete/langflow-lm1b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Continuous-Rivals-Discrete/langflow-lm1b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Continuous-Rivals-Discrete/langflow-lm1b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Continuous-Rivals-Discrete/langflow-lm1b
- SGLang
How to use Continuous-Rivals-Discrete/langflow-lm1b 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 "Continuous-Rivals-Discrete/langflow-lm1b" \ --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": "Continuous-Rivals-Discrete/langflow-lm1b", "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 "Continuous-Rivals-Discrete/langflow-lm1b" \ --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": "Continuous-Rivals-Discrete/langflow-lm1b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Continuous-Rivals-Discrete/langflow-lm1b with Docker Model Runner:
docker model run hf.co/Continuous-Rivals-Discrete/langflow-lm1b
| """HuggingFace configuration class for LangFlow.""" | |
| import transformers | |
| class LangFlowConfig(transformers.PretrainedConfig): | |
| """HuggingFace configuration class for LangFlow. | |
| LangFlow is a continuous diffusion language model that operates in embedding space. | |
| It uses a DiT (Diffusion Transformer) backbone with adaptive layer normalization. | |
| Key features: | |
| - Continuous diffusion in embedding space | |
| - Self-conditioning: uses previous predictions as additional input | |
| - Bias (preconditioning): skip connection for improved training | |
| - Normalized embeddings: layernorm on embedding vectors | |
| - Learnable Gumbel proposal for gamma (log-SNR) sampling | |
| """ | |
| model_type = "LangFlow" | |
| def __init__( | |
| self, | |
| vocab_size: int = 30522, | |
| hidden_size: int = 768, | |
| cond_dim: int = 128, | |
| n_blocks: int = 12, | |
| n_heads: int = 12, | |
| dropout: float = 0.1, | |
| model_length: int = 128, | |
| # Embedding normalization | |
| use_normalized_embedding: bool = True, | |
| embedding_norm_method: str = "layernorm", | |
| # Self-conditioning | |
| self_conditioning: bool = True, | |
| # Bias (preconditioning) - always enabled for inference | |
| use_bias: bool = True, | |
| # Gumbel proposal parameters (learnable) | |
| gumbel_loc: float = 4.723, | |
| gumbel_scale: float = 0.852, | |
| gumbel_cutoff: float = 1e-5, | |
| gumbel_entropy: float = 7.02, | |
| **kwargs | |
| ): | |
| super().__init__(**kwargs) | |
| self.vocab_size = vocab_size | |
| self.hidden_size = hidden_size | |
| self.cond_dim = cond_dim | |
| self.n_blocks = n_blocks | |
| self.n_heads = n_heads | |
| self.dropout = dropout | |
| self.model_length = model_length | |
| # Embedding normalization | |
| self.use_normalized_embedding = use_normalized_embedding | |
| self.embedding_norm_method = embedding_norm_method | |
| # Self-conditioning | |
| self.self_conditioning = self_conditioning | |
| # Bias (preconditioning) | |
| self.use_bias = use_bias | |
| # Gumbel proposal parameters | |
| self.gumbel_loc = gumbel_loc | |
| self.gumbel_scale = gumbel_scale | |
| self.gumbel_cutoff = gumbel_cutoff | |
| self.gumbel_entropy = gumbel_entropy | |