Metadata-Version: 2.4
Name: xans104
Version: 0.2.0
Summary: xANS-104 DataItems extractor for HuggingFace & SageMaker inference
Author-email: Rani Elhusseini <rani@decent.land>
License: MIT License
        
        Copyright (c) 2025 Load Network
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/loadnetwork/xans104
Project-URL: Issues, https://github.com/loadnetwork/xans104/issues
Keywords: ans104,xans104,arweave,huggingface,sagemaker,llm,inference,loadnetwork,s3
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28
Dynamic: license-file

## Install

```bash
pip install xans104
```

## Quick Start

```python
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

```python
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](./LICENSE)
