Skip to main content

xANS-104 DataItems extractor for HuggingFace & SageMaker inference

Project description

Install

pip install xans104

Quick Start

from xans104 import load_model

MODEL_DATAITEM = "gESMyqhLntTn6zvldcUcSf0JfFpGDrQX6JKDKhKVf7k"
tokenizer, model, local_dir = load_model(MODEL_DATAITEM)
outputs = model.generate(**tokenizer("slop it", return_tensors="pt"))
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

load_model streams the .ans104 blob from https://gateway.s3-node-1.load.network, extracts it into a temporary directory and returns (tokenizer, model, path) so you can call HF APIs without handling files yourself.

Upload a HuggingFace repo to Load S3

from xans104 import create_model_dataitem

dataitem_id = create_model_dataitem(
    "sshleifer/tiny-gpt2",
    token="LOAD_API_TOKEN",
    tags={"key-1": "value-1"},
)
print(dataitem_id)

create_model_dataitem downloads the HF snapshot, tars it, sends it to load-s3-agent, and returns the dataitem_id ready for inference.

License

This repository is licensed under the MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xans104-0.2.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xans104-0.2.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file xans104-0.2.0.tar.gz.

File metadata

  • Download URL: xans104-0.2.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for xans104-0.2.0.tar.gz
Algorithm Hash digest
SHA256 12de12c64d11c632f69e9875ba48c0b330822ff49604ed9de42bd04c1fbbd0ba
MD5 ff88edbbd19a37ffb1275253b35e54a0
BLAKE2b-256 6f2f9d2f6dc6021f6fa5960b51b178ad5682d3089371c7fba56e962363703fd2

See more details on using hashes here.

File details

Details for the file xans104-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: xans104-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for xans104-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a6e02d28f4ccae4bf5f358015fcd45afd61498564c40c3b07c85ec850608a27
MD5 281e744cbcd2285ed778e04c21006d59
BLAKE2b-256 686a681387ef4ef7428c196c9150ee47b27fc36bb14e9ee73637e888325a03a4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page