Instructions to use tangledgroup/tangled-alpha-0.2-core with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tangledgroup/tangled-alpha-0.2-core with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tangledgroup/tangled-alpha-0.2-core") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("tangledgroup/tangled-alpha-0.2-core", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use tangledgroup/tangled-alpha-0.2-core with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tangledgroup/tangled-alpha-0.2-core" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tangledgroup/tangled-alpha-0.2-core", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tangledgroup/tangled-alpha-0.2-core
- SGLang
How to use tangledgroup/tangled-alpha-0.2-core 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 "tangledgroup/tangled-alpha-0.2-core" \ --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": "tangledgroup/tangled-alpha-0.2-core", "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 "tangledgroup/tangled-alpha-0.2-core" \ --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": "tangledgroup/tangled-alpha-0.2-core", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tangledgroup/tangled-alpha-0.2-core with Docker Model Runner:
docker model run hf.co/tangledgroup/tangled-alpha-0.2-core
| from functools import partial | |
| from litgpt.tokenizer import Tokenizer | |
| from litdata import optimize, TokensLoader, StreamingDataset | |
| from transformers import AutoTokenizer | |
| from utils import tokenize_fn | |
| from core_base_datasets import core_base_datasets | |
| from core_instruct_datasets import core_instruct_datasets | |
| # | |
| # optimize datasets | |
| # | |
| for i, (block_size, subchunk_size) in enumerate([(8192, 2000)]): | |
| chunk_size = block_size * subchunk_size | |
| output_dir = f'../core-data-{i}-{block_size}-{subchunk_size}' | |
| outputs = optimize( | |
| fn=partial( | |
| tokenize_fn, | |
| hf_tokenizer=AutoTokenizer.from_pretrained('..', trust_remote_code=True, use_fast=True), | |
| tokenizer=Tokenizer('..'), | |
| ), | |
| inputs=core_base_datasets + core_instruct_datasets, | |
| output_dir=output_dir, | |
| chunk_size=chunk_size, # Number of tokens to store by chunks. This is roughly 64MB of tokens per chunk. | |
| num_workers=32, | |
| reorder_files=False, | |
| ## This is important to inform LitData that we are encoding contiguous 1D array (tokens). | |
| ## LitData skips storing metadata for each sample e.g all the tokens are concatenated to form one large tensor. | |
| # item_loader=TokensLoader(block_size=block_size), | |
| ) | |
| # | |
| # total number of chunks in datasets | |
| # | |
| for i, (block_size, subchunk_size) in enumerate([(8192, 2000)]): | |
| chunk_size = block_size * subchunk_size | |
| input_dir = f'../core-data-{i}-{block_size}-{subchunk_size}' | |
| dataset = StreamingDataset( | |
| input_dir=input_dir, | |
| item_loader=TokensLoader(block_size=block_size), | |
| ) | |
| print(f'{i=}, {block_size=}, {chunk_size=}, {len(dataset)=}, {len(dataset) * block_size=}') | |
| # total_tokens = sum(len(data) for data in dataset) | |
| # print(f'Total number of tokens in the optimized dataset {input_dir!r} is {total_tokens}') | |
| total_tokens = len(dataset) * block_size | |
| print(f'Total number of tokens in the optimized dataset {input_dir!r} is {total_tokens}') | |