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.1.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.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xans104-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 616e7e23f0f8d42af6f429440beb88019b521bbb45b0076677d0a28bccecb91b
MD5 933544892d8f8d451cca79f64c2e8e34
BLAKE2b-256 7b3d2fb54dc323d33a24114c2044fdd272e6c677cc672b8eba89f603b1a0542a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xans104-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.2 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31d0614639c4e2160fc5f57cf0976138b04c207f96f5288364537fb13e7741a3
MD5 a1619e3f3c5ae6a01d325777bf967b78
BLAKE2b-256 b79c225191534855377e9fdc83629fa0e12bdbc4a434144351c345378bedd388

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