Instructions to use kibrq/greedy-intersection with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use kibrq/greedy-intersection with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="kibrq/greedy-intersection", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("kibrq/greedy-intersection", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use kibrq/greedy-intersection with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "kibrq/greedy-intersection" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kibrq/greedy-intersection", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/kibrq/greedy-intersection
- SGLang
How to use kibrq/greedy-intersection 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 "kibrq/greedy-intersection" \ --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": "kibrq/greedy-intersection", "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 "kibrq/greedy-intersection" \ --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": "kibrq/greedy-intersection", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use kibrq/greedy-intersection with Docker Model Runner:
docker model run hf.co/kibrq/greedy-intersection
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
To load this model, use the following code:
from transformers import PreTrainedTokenizerFast, AutoModelForCausalLM, AutoConfig
tokenizer = PreTrainedTokenizerFast.from_pretrained('kibrq/greedy-intersection')
config = AutoConfig.from_pretrained('kibrq/greedy-intersection', trust_remote_code = True)
config._from_tokenizer(freegroup_dimension, tokenizer)
model = AutoModelForCausalLM.from_config(config, trust_remote_code = True)
To generate words from the intersection, use this code:
from freegroup.sampling import free_group_bounded
from freegroup.tools import is_from_singleton_normal_closure
from freegroup.commutators import to_tokenizer, from_tokenizer
from itertools import islice
batch_size = 20
prefix_length = 15
generation_config = dict(
max_new_tokens = 200,
)
num_runs = 10
for _ in range(num_runs):
inputs = islice(free_group_bounded(3, max_length = prefix_length, random_length_method="constant"), batch_size)
inputs = list(map(to_tokenizer, input))
inputs = tokenizer(input, return_tensors='pt').input_ids
outputs = model.generate(
inputs = input,
**generation_config
)
outputs = tokenizer.batch_decode(outputs, skip_special_tokens=True)
outputs = map(from_tokenizer, outputs)
condition = lambda x: all(map(lambda gen: is_from_singleton_normal_closure(gen, x), [[1], [2], [3], [1, 2, 3]]))
outputs = filter(condition, outputs)
print(list(outputs))
- Downloads last month
- 4
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "kibrq/greedy-intersection"# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "kibrq/greedy-intersection", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'