Instructions to use eousphoros/turnstone-lambda-671 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use eousphoros/turnstone-lambda-671 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="eousphoros/turnstone-lambda-671") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("eousphoros/turnstone-lambda-671") model = AutoModelForMultimodalLM.from_pretrained("eousphoros/turnstone-lambda-671", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use eousphoros/turnstone-lambda-671 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "eousphoros/turnstone-lambda-671" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eousphoros/turnstone-lambda-671", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/eousphoros/turnstone-lambda-671
- SGLang
How to use eousphoros/turnstone-lambda-671 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 "eousphoros/turnstone-lambda-671" \ --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": "eousphoros/turnstone-lambda-671", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "eousphoros/turnstone-lambda-671" \ --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": "eousphoros/turnstone-lambda-671", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use eousphoros/turnstone-lambda-671 with Docker Model Runner:
docker model run hf.co/eousphoros/turnstone-lambda-671
File size: 4,247 Bytes
9fae48b | 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 | """FP32 master weights -> the BF16 model folder.
Every tensor is rounded FP32 -> BF16, to nearest with ties to even (fp32_common.py states the rule), except the 48
linear-attention decay tensors (...linear_attn.A_log), which stay FP32 as they are in the BF16 release. The vision
tower, which was never trained here, is an exact FP32 copy of its BF16 values, so rounding returns them. Tensor
names, the split into weight files and the index are those of the BF16 release; config, tokenizer and chat template
are copied. The output carries its own SHA256SUMS.
usage: masters_to_bf16.py SRC DST [--check] [--no-mtp] [--mtp FILE]
[--sums FILE] [--check-only] [--workers 8] [--threads 4] [--exact-rounding]
SRC the FP32 master-weights folder (the release folder)
DST the BF16 folder to write (must not exist)
--mtp FILE the draft head's FP32 weights (default SRC/mtp.safetensors). It is written into the weight files
the BF16 release has it in, so the output equals the full BF16 release byte for byte.
--no-mtp write a folder without the draft head (for serving with a separate head, or without drafting).
config.json still says mtp_num_hidden_layers = 1; such a folder does not match the published list.
--check compare DST, file by file, with SRC/SHA256SUMS.bf16 (or --sums FILE); exit status 1 on any
difference. --check-only does only that, on an existing DST.
Needs python >= 3.9 and torch (CPU). About 110 GB is read and 56 GB written; peak memory is about
workers x 8 GB.
"""
import argparse
import json
import os
import sys
import torch
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) # the tools find each other in any python mode
import fp32_common as c
def convert_shard(job):
shard, items, partial, exact = job
tensors = {}
for name, source in items:
x = source.read(name)
c.finite(name, x)
if c.A_LOG.fullmatch(name):
tensors[name] = ("F32", x)
else:
tensors[name] = ("BF16", c.to_bf16(x, exact))
digest, size = c.write_shard(os.path.join(partial, shard), tensors)
return shard, digest, sum(c.tensor_bytes(kind, t) for kind, t in tensors.values())
def main():
parser = argparse.ArgumentParser(description=__doc__.split(c.NL)[0], allow_abbrev=False)
parser.add_argument("masters")
parser.add_argument("output")
parser.add_argument("--mtp", metavar="FILE")
parser.add_argument("--no-mtp", action="store_true")
c.add_common_arguments(parser)
args = parser.parse_args()
sums = c.published_sums(args, os.path.join(args.masters, "SHA256SUMS.bf16"))
if args.check_only:
sys.exit(0 if c.check_sums(args.output, sums, args.workers) else 1)
if args.no_mtp and sums:
c.fail("a folder without the draft head cannot match the published list; drop --check or --no-mtp")
torch.set_grad_enabled(False)
torch.set_num_threads(args.threads)
c.say("masters_to_bf16:", c.versions())
if not args.exact_rounding:
c.self_test()
folder, manifest = c.open_masters(args.masters)
head = c.open_mtp(args.masters, manifest, args.mtp, args.no_mtp)
plan, order, shard_of = c.export_plan(folder, manifest, head)
out, partial = c.start_output(args.output)
results = c.run_shards([(shard, items, partial, args.exact_rounding) for shard, items in plan],
convert_shard, args.workers)
digests = {shard: digest for shard, digest, _ in results}
index = {"metadata": {"total_size": sum(size for _, _, size in results)},
"weight_map": {name: shard_of[name] for name in order}}
with open(os.path.join(partial, c.INDEX), "w") as f:
f.write(json.dumps(index, indent=2) + c.NL)
c.copy_small_files(args.masters, manifest["small_files"], partial)
c.finish(partial, out, digests, sums, args.workers)
c.say("BF16 DONE %s: %d tensors in %d weight files, %.2f GB%s" % (
out, len(order), len(results), index["metadata"]["total_size"] / 1e9,
"" if head is not None else "; NO DRAFT (MTP) HEAD in this folder: add one before serving with drafting"))
if __name__ == "__main__":
main()
|