semvec/pypi-packages huggingface dataset:
popstarlight 1.0.0
SSP synthetic spectra
License: MIT
Requires Python: >=3.6


popstarlight
==================

Integrated light synthetic spectra of a simple stellar population.

Authors
-------

- **David Nidever** (Montana State University)
  
Installation
------------

You can also pip install directly from GitHub::

    pip install git+https://github.com/dnidever/popstarlight
pybatchexecute 1.0.0
Library to ease interactions with Google's batchexecute batch RPC system
License: MIT
Requires Python: >=3.8

# pybatchexecute

> Python package to ease interactions with Google's `batchexecute` batch RPC system. It assists in preparing requests for it and decoding responses returned from it.

This package codifies the research of Ryan Kovatch[^1] and Boudewijn van Groos[^2] about Google's `/batchexecute` endpoint used accross Google Web applications.

## Usage

### Prepare a request

```python
>>> from pybatchexecute import PreparedBatchExecute
>>>
>>> # RPCs to call
>>> rpc1 = {"rpcid": "rpc1id", "args": ["some", "args"]}
>>> rpc2 = {"rpcid": "rpc2id", "args": ["some", "args"]}
>>>
>>> # Prepare request
>>> pbe = PreparedBatchExecute(
...     rpcs=[rpc1, rpc2],
...     host="example.com",
...     app="example",
... )
>>>
>>> # Access request attributes
>>> pbe.url
'https://example.com/_/example/data/batchexecute'
>>> pbe.headers
{'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'}
>>> pbe.params
{'rpcids': 'rpc1id,rpc2id', '_reqid': 3807}
>>> pbe.data
{'f.req': '[[["rpc1id","[\\"some\\",\\"args\\"]",null,"1"],["rpc2id","[\\"some\\",\\"args\\"]",null,"2"]]]'}
```

Use the `url`, `headers`, `params` and `data` attributes (optionally combined with your own, e.g. an `at` parameter[^1] or a `Cookie` header[^1] for authenticated requests) to make a POST request with the HTTP library of your choice (e.g. [`requests`](https://requests.readthedocs.io/en/latest/)).

## Decode a response

```python
>>> from pybatchexecute import decode
>>>
>>> # Raw response
>>> # (from a request made with no `rt` parameter)
>>> raw_reponse = r"""
... )]}'
...
... [["wrb.fr","rpc1id","[\"some\",\"response1\"]",null,null,null,1],
... ["wrb.fr","rpc2id","[\"some\",\"response2\"]",null,null,null,2],
... ["di",38],
... ["af.httprm",37,"5314567270682293609",6],
... ["e",4,null,null,643]]
... """
>>>
>>> # Decode response
>>> # List of tuples (index, rpcid, response)
>>> decode(raw)
[(1, 'rpc1id', ['some', 'response1']), (2, 'rpc2id', ['some', 'response2'])]
```

### Documentation

See [docs/](docs/) for more:

* [API reference](docs/api.md)
* [Response formats](docs/response-formats.md)

## Disclaimer

This project is *not* affiliated with Google. It is intended for use in accordance with [Google's Terms of Service](https://policies.google.com/terms).

## Licence

[The MIT License (MIT)](LICENSE) Copyright © 2023 Pierre Nicolas Durette

[^1]: [Deciphering Google’s mysterious 'batchexecute' system](https://kovatch.medium.com/deciphering-google-batchexecute-74991e4e446c)

[^2]: [November 2020 Google Translate API Changes](https://github.com/Boudewijn26/gTTS-token/blob/master/docs/november-2020-translate-changes.md)
llamacpp 0.1.14
Python bindings for @ggerganov's llama.cpp
License: MIT
Requires Python: >=3.7

## Python bindings for llama.cpp

## Install
### From PyPI

```
pip install llamacpp
```

### Build from Source

```
pip install .
```

## Get the model weights

You will need to obtain the weights for LLaMA yourself. There are a few torrents floating around as well as some huggingface repositories (e.g https://huggingface.co/nyanko7/LLaMA-7B/). Once you have them, copy them into the models folder.

```
ls ./models
65B 30B 13B 7B tokenizer_checklist.chk tokenizer.model
```

Convert the weights to GGML format using `llamacpp-convert`. Then use `llamacpp-quantize` to quantize them into INT4. For example, for the 7B parameter model, run

```
llamacpp-convert ./models/7B/ 1
llamacpp-quantize ./models/7B/
llamacpp-cli
```

**Note that running `llamacpp-convert` requires `torch`, `sentencepiece` and `numpy` to be installed. These packages are not installed by default when your install `llamacpp`.**

## Command line interface

The package installs the command line entry point `llamacpp-cli` that points to `llamacpp/cli.py` and should provide about the same functionality as the `main` program in the original C++ repository. There is also an experimental `llamacpp-chat` that is supposed to bring up a chat interface but this is not working correctly yet.

## API

Documentation is TBD. But the long and short of it is that there are two interfaces
* `LlamaInference` - this one is a high level interface that tries to take care of most things for you. The demo script below uses this.
* `LlamaContext` - this is a low level interface to the underlying llama.cpp API. You can use this similar to how the [main](https://github.com/ggerganov/llama.cpp/blob/master/examples/main/main.cpp) example in `llama.cpp` does uses the C API. This is a rough implementation and currently untested except for compiling successfully.

## Demo script

See `llamacpp/cli.py` for a detailed example. The simplest demo would be something like the following:

```python
import sys
import llamacpp


def progress_callback(progress):
    print("Progress: {:.2f}%".format(progress * 100))
    sys.stdout.flush()


params = llamacpp.InferenceParams.default_with_callback(progress_callback)
params.path_model = './models/7B/ggml-model-q4_0.bin'
model = llamacpp.LlamaInference(params)

prompt = "A llama is a"
prompt_tokens = model.tokenize(prompt, True)
model.update_input(prompt_tokens)

model.ingest_all_pending_input()

model.print_system_info()
for i in range(20):
    model.eval()
    token = model.sample()
    text = model.token_to_str(token)
    print(text, end="")
    
# Flush stdout
sys.stdout.flush()

model.print_timings()
```

## ToDo

- [ ] Investigate using dynamic versions using setuptools-scm (Example: https://github.com/pypa/setuptools_scm/blob/main/scm_hack_build_backend.py)