ommlds 0.0.0.dev332__tar.gz → 0.0.0.dev333__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ommlds-0.0.0.dev332/ommlds.egg-info → ommlds-0.0.0.dev333}/PKG-INFO +3 -3
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/attention.py +62 -27
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/loading.py +25 -20
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/transformer.py +5 -7
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/main.py +1 -1
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/sessions/chat.py +1 -2
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/__init__.py +91 -46
- ommlds-0.0.0.dev333/ommlds/minichain/_typedvalues.py +93 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/transformers/sentence.py +2 -2
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/chat/messages.py +44 -2
- ommlds-0.0.0.dev333/ommlds/minichain/chat/metadata.py +16 -0
- ommlds-0.0.0.dev332/ommlds/minichain/content/marshal.py → ommlds-0.0.0.dev333/ommlds/minichain/content/_marshal.py +17 -6
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/content/content.py +0 -6
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/content/images.py +2 -2
- ommlds-0.0.0.dev333/ommlds/minichain/content/list.py +15 -0
- ommlds-0.0.0.dev333/ommlds/minichain/content/metadata.py +16 -0
- ommlds-0.0.0.dev333/ommlds/minichain/content/simple.py +38 -0
- ommlds-0.0.0.dev333/ommlds/minichain/content/text.py +12 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/content/transforms.py +16 -2
- ommlds-0.0.0.dev333/ommlds/minichain/metadata.py +48 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/services/_marshal.py +48 -6
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/services/_typedvalues.py +0 -33
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/services/requests.py +5 -2
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/services/responses.py +5 -2
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333/ommlds.egg-info}/PKG-INFO +3 -3
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds.egg-info/SOURCES.txt +11 -4
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds.egg-info/requires.txt +2 -2
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/pyproject.toml +3 -3
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/LICENSE +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/MANIFEST.in +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/README.md +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/.manifests.json +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/__about__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/llamacpp/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/llamacpp/buildwheel.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/llamacpp/logging.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/__main__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/caching.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/cli.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/generation.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/limits.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/loading.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/tokenization/LICENSE +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/tokenization/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/tokenization/detokenization/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/tokenization/detokenization/base.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/tokenization/detokenization/bpe.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/tokenization/detokenization/naive.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/tokenization/detokenization/spm.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/tokenization/loading.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/tokenization/tokenization.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/mlx/tokenization/types.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/openai/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/openai/protocol/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/openai/protocol/chatcompletion/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/openai/protocol/chatcompletion/chunk.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/openai/protocol/chatcompletion/contentpart.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/openai/protocol/chatcompletion/message.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/openai/protocol/chatcompletion/request.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/openai/protocol/chatcompletion/response.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/openai/protocol/chatcompletion/responseformat.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/openai/protocol/chatcompletion/tokenlogprob.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/openai/protocol/completionusage.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/LICENSE +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/__main__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/fetch.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/llm.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/quantization.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/repl.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/sampling.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/tokenization.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/sdxl/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/sdxl/__main__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/sdxl/cli.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/sdxl/clip.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/sdxl/sdxl.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/sdxl/unet.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/tinygrad.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/torch/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/torch/backends.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/torch/devices.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/torch/purge.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/__main__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/inject.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/sessions/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/sessions/base.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/sessions/completion.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/sessions/embedding.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/sessions/inject.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/state.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/tools/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/tools/inject.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/cli/tools/tools.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/datasets/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/datasets/library/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/datasets/library/movies.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/hacks/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/hacks/patches.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/huggingface.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/_abc.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/anthropic/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/anthropic/chat.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/duckduckgo.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/google/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/google/chat.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/google/search.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/huggingface.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/llamacpp/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/llamacpp/chat.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/llamacpp/completion.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/llamacpp/format.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/llamacpp/streaming.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/mistral.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/mlx/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/mlx/chat.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/openai/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/openai/chat.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/openai/completion.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/openai/embedding.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/openai/format.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/openai/streaming.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/sentencepiece/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/sentencepiece/tokens.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/sqlite.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/tinygrad/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/tinygrad/chat.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/tokenizers/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/tokenizers/tokens.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/transformers/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/transformers/tokens.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/transformers/transformers.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/chat/__init__.py +0 -0
- /ommlds-0.0.0.dev332/ommlds/minichain/chat/marshal.py → /ommlds-0.0.0.dev333/ommlds/minichain/chat/_marshal.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/chat/choices.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/chat/formats.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/chat/history.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/chat/services.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/chat/streaming.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/chat/templating.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/chat/tools.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/chat/types.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/completion.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/configs.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/content/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/content/rendering.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/docs/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/docs/docs.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/docs/dtypes.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/docs/filters.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/envs.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/json.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/llms/__init__.py +0 -0
- /ommlds-0.0.0.dev332/ommlds/minichain/llms/marshal.py → /ommlds-0.0.0.dev333/ommlds/minichain/llms/_marshal.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/llms/services.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/llms/tokens.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/registry.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/resources.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/search.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/services/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/services/_origclasses.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/services/facades.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/services/services.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/standard.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/streaming.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/text/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/text/applypatch.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/text/toolparsing/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/text/toolparsing/base.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/text/toolparsing/dumb.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/text/toolparsing/llamacpp/LICENSE +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/text/toolparsing/llamacpp/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/text/toolparsing/llamacpp/hermes2.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/text/toolparsing/llamacpp/llama31.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/text/toolparsing/llamacpp/types.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/text/toolparsing/llamacpp/utils.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/tokens/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/tokens/specials.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/tokens/tokenizers.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/tokens/types.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/tokens/vocabs.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/tools/__init__.py +0 -0
- /ommlds-0.0.0.dev332/ommlds/minichain/tools/marshal.py → /ommlds-0.0.0.dev333/ommlds/minichain/tools/_marshal.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/tools/jsonschema.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/tools/reflection.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/tools/types.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/vectors/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/vectors/embeddings.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/vectors/index.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/vectors/search.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/vectors/similarity.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/vectors/stores.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/vectors/types.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/server/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/server/__main__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/server/cli.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/server/client.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/server/server.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/server/service.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/tools/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/tools/git.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/tools/ocr.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/wiki/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/wiki/analyze.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/wiki/convert.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/wiki/models.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/wiki/text/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/wiki/text/mfh.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/wiki/text/wtp.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/wiki/utils/__init__.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/wiki/utils/io.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/wiki/utils/progress.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/wiki/utils/xml.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/wiki/xml.py +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds.egg-info/dependency_links.txt +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds.egg-info/entry_points.txt +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds.egg-info/top_level.txt +0 -0
- {ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ommlds
|
|
3
|
-
Version: 0.0.0.
|
|
3
|
+
Version: 0.0.0.dev333
|
|
4
4
|
Summary: ommlds
|
|
5
5
|
Author: wrmsr
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -12,8 +12,8 @@ Classifier: Operating System :: OS Independent
|
|
|
12
12
|
Classifier: Operating System :: POSIX
|
|
13
13
|
Requires-Python: >=3.12
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: omdev==0.0.0.
|
|
16
|
-
Requires-Dist: omlish==0.0.0.
|
|
15
|
+
Requires-Dist: omdev==0.0.0.dev333
|
|
16
|
+
Requires-Dist: omlish==0.0.0.dev333
|
|
17
17
|
Provides-Extra: all
|
|
18
18
|
Requires-Dist: llama-cpp-python~=0.3; extra == "all"
|
|
19
19
|
Requires-Dist: mlx~=0.26; extra == "all"
|
{ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/attention.py
RENAMED
|
@@ -57,8 +57,8 @@ class Attention:
|
|
|
57
57
|
self,
|
|
58
58
|
dim,
|
|
59
59
|
n_heads,
|
|
60
|
-
n_kv_heads,
|
|
61
|
-
max_context,
|
|
60
|
+
n_kv_heads=None,
|
|
61
|
+
max_context=0,
|
|
62
62
|
linear=nn.Linear,
|
|
63
63
|
qk_norm: float | None = None,
|
|
64
64
|
) -> None:
|
|
@@ -85,7 +85,7 @@ class Attention:
|
|
|
85
85
|
x: Tensor,
|
|
86
86
|
start_pos: Variable_ | int,
|
|
87
87
|
freqs_cis: Tensor,
|
|
88
|
-
mask: Tensor | None,
|
|
88
|
+
mask: Tensor | None = None,
|
|
89
89
|
) -> Tensor:
|
|
90
90
|
if getenv('WQKV'):
|
|
91
91
|
if not hasattr(self, 'wqkv'):
|
|
@@ -114,36 +114,71 @@ class Attention:
|
|
|
114
114
|
bsz, seqlen, _, _ = xq.shape
|
|
115
115
|
|
|
116
116
|
# create kv cache
|
|
117
|
-
if not hasattr(self, 'cache_kv'):
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
117
|
+
# if not hasattr(self, 'cache_kv'):
|
|
118
|
+
# self.cache_kv = (
|
|
119
|
+
# Tensor.zeros(
|
|
120
|
+
# 2,
|
|
121
|
+
# bsz,
|
|
122
|
+
# self.max_context,
|
|
123
|
+
# self.n_kv_heads,
|
|
124
|
+
# self.head_dim,
|
|
125
|
+
# dtype=x.dtype,
|
|
126
|
+
# )
|
|
127
|
+
# .contiguous()
|
|
128
|
+
# .realize()
|
|
129
|
+
# )
|
|
130
|
+
# if isinstance(x.device, tuple):
|
|
131
|
+
# # TODO: instead of specifying how to shard, it can follow how xk and xv are being sharded
|
|
132
|
+
# self.cache_kv.shard_(
|
|
133
|
+
# (x.device), axis=3 if getenv('SHARD_KVCACHE') else None,
|
|
134
|
+
# ).realize()
|
|
135
|
+
#
|
|
136
|
+
# # update the cache
|
|
137
|
+
# check.state(xk.dtype == xv.dtype == self.cache_kv.dtype, f'{xk.dtype=}, {xv.dtype=}, {self.cache_kv.dtype=}')
|
|
138
|
+
#
|
|
139
|
+
# self.cache_kv[:, :, start_pos:start_pos + seqlen, :, :].assign(Tensor.stack(xk, xv)).realize()
|
|
140
|
+
#
|
|
141
|
+
# keys = self.cache_kv[0, :, 0:start_pos + seqlen, :, :]
|
|
142
|
+
# values = self.cache_kv[1, :, 0:start_pos + seqlen, :, :]
|
|
143
|
+
|
|
144
|
+
if self.max_context:
|
|
145
|
+
if not hasattr(self, 'cache_kv'):
|
|
146
|
+
self.cache_kv = (
|
|
147
|
+
Tensor.zeros(
|
|
148
|
+
2,
|
|
149
|
+
bsz,
|
|
150
|
+
self.max_context,
|
|
151
|
+
self.n_kv_heads,
|
|
152
|
+
self.head_dim,
|
|
153
|
+
dtype=x.dtype,
|
|
154
|
+
)
|
|
155
|
+
.contiguous()
|
|
156
|
+
.realize()
|
|
126
157
|
)
|
|
127
|
-
.
|
|
128
|
-
|
|
158
|
+
if isinstance(x.device, tuple):
|
|
159
|
+
# TODO: instead of specifying how to shard, it can follow how xk and xv are being sharded
|
|
160
|
+
self.cache_kv.shard_(
|
|
161
|
+
(x.device),
|
|
162
|
+
axis=3 if getenv('SHARD_KVCACHE') else None,
|
|
163
|
+
).realize()
|
|
164
|
+
|
|
165
|
+
# update the cache
|
|
166
|
+
check.state(
|
|
167
|
+
xk.dtype == xv.dtype == self.cache_kv.dtype,
|
|
168
|
+
f'{xk.dtype=}, {xv.dtype=}, {self.cache_kv.dtype=}',
|
|
129
169
|
)
|
|
130
|
-
|
|
131
|
-
# TODO: instead of specifying how to shard, it can follow how xk and xv are being sharded
|
|
132
|
-
self.cache_kv.shard_(
|
|
133
|
-
(x.device), axis=3 if getenv('SHARD_KVCACHE') else None,
|
|
134
|
-
).realize()
|
|
170
|
+
self.cache_kv[:, :, start_pos:start_pos + seqlen, :, :].assign(Tensor.stack(xk, xv)).realize()
|
|
135
171
|
|
|
136
|
-
|
|
137
|
-
|
|
172
|
+
keys = self.cache_kv[0, :, 0:start_pos + seqlen, :, :]
|
|
173
|
+
values = self.cache_kv[1, :, 0:start_pos + seqlen, :, :]
|
|
138
174
|
|
|
139
|
-
|
|
140
|
-
(
|
|
141
|
-
|
|
175
|
+
else:
|
|
176
|
+
check.state(start_pos == 0)
|
|
177
|
+
keys, values = xk, xv
|
|
142
178
|
|
|
143
|
-
keys =
|
|
144
|
-
values =
|
|
179
|
+
keys = repeat_kv(keys, self.n_rep)
|
|
180
|
+
values = repeat_kv(values, self.n_rep)
|
|
145
181
|
|
|
146
|
-
keys, values = repeat_kv(keys, self.n_rep), repeat_kv(values, self.n_rep)
|
|
147
182
|
xq, keys, values = (
|
|
148
183
|
xq.transpose(1, 2),
|
|
149
184
|
keys.transpose(1, 2),
|
{ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/loading.py
RENAMED
|
@@ -27,7 +27,7 @@ from .transformer import Transformer
|
|
|
27
27
|
# TODO: model shouldn't be an input here, and n_kv_heads should support None
|
|
28
28
|
def convert_from_huggingface(
|
|
29
29
|
weights: dict[str, Tensor],
|
|
30
|
-
|
|
30
|
+
n_layers: int,
|
|
31
31
|
n_heads: int,
|
|
32
32
|
n_kv_heads: int,
|
|
33
33
|
permute_layers: bool = True,
|
|
@@ -50,35 +50,35 @@ def convert_from_huggingface(
|
|
|
50
50
|
'model.embed_tokens.weight': 'tok_embeddings.weight',
|
|
51
51
|
**{
|
|
52
52
|
f'model.layers.{l}.input_layernorm.weight': f'layers.{l}.attention_norm.weight'
|
|
53
|
-
for l in range(
|
|
53
|
+
for l in range(n_layers)
|
|
54
54
|
},
|
|
55
55
|
**{
|
|
56
56
|
f'model.layers.{l}.self_attn.{x}_norm.weight': f'layers.{l}.attention.{x}_norm.weight'
|
|
57
57
|
for x in ['q', 'k']
|
|
58
|
-
for l in range(
|
|
58
|
+
for l in range(n_layers)
|
|
59
59
|
},
|
|
60
60
|
**{
|
|
61
61
|
f'model.layers.{l}.self_attn.{x}_proj.weight': f'layers.{l}.attention.w{x}.weight'
|
|
62
62
|
for x in ['q', 'k', 'v', 'o']
|
|
63
|
-
for l in range(
|
|
63
|
+
for l in range(n_layers)
|
|
64
64
|
},
|
|
65
65
|
**{
|
|
66
66
|
f'model.layers.{l}.self_attn.{x}_proj.bias': f'layers.{l}.attention.w{x}.bias'
|
|
67
67
|
for x in ['q', 'k', 'v', 'o']
|
|
68
|
-
for l in range(
|
|
68
|
+
for l in range(n_layers)
|
|
69
69
|
},
|
|
70
70
|
**{
|
|
71
71
|
f'model.layers.{l}.post_attention_layernorm.weight': f'layers.{l}.ffn_norm.weight'
|
|
72
|
-
for l in range(
|
|
72
|
+
for l in range(n_layers)
|
|
73
73
|
},
|
|
74
74
|
**{
|
|
75
75
|
f'model.layers.{l}.mlp.{x}_proj.weight': f'layers.{l}.feed_forward.w{y}.weight'
|
|
76
76
|
for x, y in {'gate': '1', 'down': '2', 'up': '3'}.items()
|
|
77
|
-
for l in range(
|
|
77
|
+
for l in range(n_layers)
|
|
78
78
|
},
|
|
79
79
|
**{
|
|
80
80
|
f'model.layers.{l}.mlp.gate.weight': f'layers.{l}.feed_forward.gate.weight'
|
|
81
|
-
for l in range(
|
|
81
|
+
for l in range(n_layers)
|
|
82
82
|
},
|
|
83
83
|
'model.norm.weight': 'norm.weight',
|
|
84
84
|
'lm_head.weight': 'output.weight',
|
|
@@ -107,31 +107,31 @@ def convert_from_huggingface(
|
|
|
107
107
|
|
|
108
108
|
def convert_from_gguf(
|
|
109
109
|
weights: dict[str, Tensor],
|
|
110
|
-
|
|
110
|
+
n_layers: int,
|
|
111
111
|
):
|
|
112
112
|
keymap = {
|
|
113
113
|
'token_embd.weight': 'tok_embeddings.weight',
|
|
114
114
|
**{
|
|
115
115
|
f'blk.{l}.attn_norm.weight': f'layers.{l}.attention_norm.weight'
|
|
116
|
-
for l in range(
|
|
116
|
+
for l in range(n_layers)
|
|
117
117
|
},
|
|
118
118
|
**{
|
|
119
119
|
f'blk.{l}.attn_{x}.weight': f'layers.{l}.attention.w{x}.weight'
|
|
120
120
|
for x in ['q', 'k', 'v']
|
|
121
|
-
for l in range(
|
|
121
|
+
for l in range(n_layers)
|
|
122
122
|
},
|
|
123
123
|
**{
|
|
124
124
|
f'blk.{l}.attn_output.weight': f'layers.{l}.attention.wo.weight'
|
|
125
|
-
for l in range(
|
|
125
|
+
for l in range(n_layers)
|
|
126
126
|
},
|
|
127
127
|
**{
|
|
128
128
|
f'blk.{l}.ffn_norm.weight': f'layers.{l}.ffn_norm.weight'
|
|
129
|
-
for l in range(
|
|
129
|
+
for l in range(n_layers)
|
|
130
130
|
},
|
|
131
131
|
**{
|
|
132
132
|
f'blk.{l}.ffn_{x}.weight': f'layers.{l}.feed_forward.w{y}.weight'
|
|
133
133
|
for x, y in {'gate': '1', 'down': '2', 'up': '3'}.items()
|
|
134
|
-
for l in range(
|
|
134
|
+
for l in range(n_layers)
|
|
135
135
|
},
|
|
136
136
|
'output_norm.weight': 'norm.weight',
|
|
137
137
|
'rope_freqs.weight': 'rope_freqs.weight',
|
|
@@ -269,8 +269,10 @@ def build_transformer(
|
|
|
269
269
|
else:
|
|
270
270
|
linear, embedding, quantize_embeds = nn.Linear, nn.Embedding, False
|
|
271
271
|
|
|
272
|
+
model_params = MODEL_PARAMS[model_size]
|
|
273
|
+
|
|
272
274
|
model = Transformer(
|
|
273
|
-
**
|
|
275
|
+
**model_params['args'],
|
|
274
276
|
linear=linear,
|
|
275
277
|
embedding=embedding,
|
|
276
278
|
max_context=max_context,
|
|
@@ -292,7 +294,7 @@ def build_transformer(
|
|
|
292
294
|
weights = concat_weights(
|
|
293
295
|
[
|
|
294
296
|
load(str(model_path / f'consolidated.{i:02d}.pth'))
|
|
295
|
-
for i in range(
|
|
297
|
+
for i in range(model_params['files'])
|
|
296
298
|
],
|
|
297
299
|
device[0] if isinstance(device, tuple) else device,
|
|
298
300
|
)
|
|
@@ -303,13 +305,16 @@ def build_transformer(
|
|
|
303
305
|
if 'model.embed_tokens.weight' in weights:
|
|
304
306
|
weights = convert_from_huggingface(
|
|
305
307
|
weights,
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
308
|
+
model_params['args']['n_layers'],
|
|
309
|
+
model_params['args']['n_heads'],
|
|
310
|
+
model_params['args']['n_kv_heads'],
|
|
309
311
|
)
|
|
310
312
|
|
|
311
313
|
elif 'token_embd.weight' in weights:
|
|
312
|
-
weights = convert_from_gguf(
|
|
314
|
+
weights = convert_from_gguf(
|
|
315
|
+
weights,
|
|
316
|
+
model_params['args']['n_layers'],
|
|
317
|
+
)
|
|
313
318
|
|
|
314
319
|
weights = fix_bf16(weights)
|
|
315
320
|
|
{ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/backends/tinygrad/models/llama3/transformer.py
RENAMED
|
@@ -130,10 +130,8 @@ class Transformer:
|
|
|
130
130
|
_bsz, seqlen = tokens.shape
|
|
131
131
|
h = self.tok_embeddings(tokens)
|
|
132
132
|
|
|
133
|
-
self.freqs_cis = self.freqs_cis.cast(h.dtype).
|
|
134
|
-
freqs_cis = self.freqs_cis
|
|
135
|
-
(None, (start_pos, start_pos + seqlen), None, None, None),
|
|
136
|
-
)
|
|
133
|
+
self.freqs_cis = self.freqs_cis.cast(h.dtype).kernelize()
|
|
134
|
+
freqs_cis = self.freqs_cis[:, start_pos:start_pos + seqlen, :, :, :]
|
|
137
135
|
|
|
138
136
|
mask = (
|
|
139
137
|
Tensor.full(
|
|
@@ -143,7 +141,7 @@ class Transformer:
|
|
|
143
141
|
device=h.device,
|
|
144
142
|
)
|
|
145
143
|
.triu(start_pos + 1)
|
|
146
|
-
.
|
|
144
|
+
.kernelize()
|
|
147
145
|
) if seqlen > 1 else None
|
|
148
146
|
|
|
149
147
|
for layer in self.layers:
|
|
@@ -152,7 +150,7 @@ class Transformer:
|
|
|
152
150
|
|
|
153
151
|
return sample(
|
|
154
152
|
logits.flatten(), temperature, top_k, top_p, alpha_f, alpha_p,
|
|
155
|
-
).
|
|
153
|
+
).kernelize()
|
|
156
154
|
|
|
157
155
|
def __call__(
|
|
158
156
|
self,
|
|
@@ -172,7 +170,7 @@ class Transformer:
|
|
|
172
170
|
):
|
|
173
171
|
return self.forward_jit(
|
|
174
172
|
tokens,
|
|
175
|
-
Variable('start_pos', 1, self.max_context).bind(start_pos),
|
|
173
|
+
Variable('start_pos', 1, self.max_context - 1).bind(start_pos),
|
|
176
174
|
temperature,
|
|
177
175
|
top_k,
|
|
178
176
|
top_p,
|
|
@@ -70,7 +70,7 @@ def _main() -> None:
|
|
|
70
70
|
content: mc.Content
|
|
71
71
|
|
|
72
72
|
if args.image:
|
|
73
|
-
content = mc.
|
|
73
|
+
content = mc.ImageContent(pimg.open(check.non_empty_str(check.single(args.prompt))))
|
|
74
74
|
|
|
75
75
|
elif args.editor:
|
|
76
76
|
check.arg(not args.prompt)
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
# fmt: off
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
register_type,
|
|
5
|
-
registry_new,
|
|
6
|
-
registry_of,
|
|
7
|
-
)
|
|
3
|
+
##
|
|
8
4
|
|
|
9
5
|
from .chat.formats import ( # noqa
|
|
10
6
|
JSON_RESPONSE_FORMAT,
|
|
@@ -71,23 +67,7 @@ from .chat.types import ( # noqa
|
|
|
71
67
|
ChatResponseOutput,
|
|
72
68
|
)
|
|
73
69
|
|
|
74
|
-
|
|
75
|
-
CompletionRequestOption,
|
|
76
|
-
CompletionRequestOptions,
|
|
77
|
-
CompletionRequest,
|
|
78
|
-
|
|
79
|
-
CompletionResponseOutput,
|
|
80
|
-
CompletionResponseOutputs,
|
|
81
|
-
CompletionResponse,
|
|
82
|
-
|
|
83
|
-
CompletionService,
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
from .configs import ( # noqa
|
|
87
|
-
Config,
|
|
88
|
-
|
|
89
|
-
consume_configs,
|
|
90
|
-
)
|
|
70
|
+
##
|
|
91
71
|
|
|
92
72
|
from .content.content import ( # noqa
|
|
93
73
|
Content,
|
|
@@ -95,13 +75,26 @@ from .content.content import ( # noqa
|
|
|
95
75
|
)
|
|
96
76
|
|
|
97
77
|
from .content.images import ( # noqa
|
|
98
|
-
|
|
78
|
+
ImageContent,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
from .content.list import ( # noqa
|
|
82
|
+
ListContent,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
from .content.metadata import ( # noqa
|
|
86
|
+
ContentMetadata,
|
|
87
|
+
ContentMetadatas,
|
|
99
88
|
)
|
|
100
89
|
|
|
101
90
|
from .content.rendering import ( # noqa
|
|
102
91
|
StringRenderer,
|
|
103
92
|
)
|
|
104
93
|
|
|
94
|
+
from .content.text import ( # noqa
|
|
95
|
+
TextContent,
|
|
96
|
+
)
|
|
97
|
+
|
|
105
98
|
from .content.transforms import ( # noqa
|
|
106
99
|
ContentTransform,
|
|
107
100
|
|
|
@@ -109,10 +102,7 @@ from .content.transforms import ( # noqa
|
|
|
109
102
|
transform_content_strings,
|
|
110
103
|
)
|
|
111
104
|
|
|
112
|
-
|
|
113
|
-
Env,
|
|
114
|
-
EnvKey,
|
|
115
|
-
)
|
|
105
|
+
##
|
|
116
106
|
|
|
117
107
|
from .llms.tokens import ( # noqa
|
|
118
108
|
Token,
|
|
@@ -135,6 +125,8 @@ from .llms.services import ( # noqa
|
|
|
135
125
|
TokenUsageOutput,
|
|
136
126
|
)
|
|
137
127
|
|
|
128
|
+
##
|
|
129
|
+
|
|
138
130
|
from .services import ( # noqa
|
|
139
131
|
Request,
|
|
140
132
|
RequestOption,
|
|
@@ -144,21 +136,7 @@ from .services import ( # noqa
|
|
|
144
136
|
ServiceFacade,
|
|
145
137
|
)
|
|
146
138
|
|
|
147
|
-
|
|
148
|
-
ModelSpecifier,
|
|
149
|
-
ModelName,
|
|
150
|
-
ModelPath,
|
|
151
|
-
|
|
152
|
-
ApiKey,
|
|
153
|
-
|
|
154
|
-
DefaultRequestOptions,
|
|
155
|
-
)
|
|
156
|
-
|
|
157
|
-
from .streaming import ( # noqa
|
|
158
|
-
ResponseGenerator,
|
|
159
|
-
|
|
160
|
-
StreamResponse,
|
|
161
|
-
)
|
|
139
|
+
##
|
|
162
140
|
|
|
163
141
|
from .tools.jsonschema import ( # noqa
|
|
164
142
|
build_tool_spec_json_schema,
|
|
@@ -189,6 +167,8 @@ from .tools.types import ( # noqa
|
|
|
189
167
|
ToolExecRequest,
|
|
190
168
|
)
|
|
191
169
|
|
|
170
|
+
##
|
|
171
|
+
|
|
192
172
|
from .vectors.embeddings import ( # noqa
|
|
193
173
|
EmbeddingRequest,
|
|
194
174
|
EmbeddingRequestOption,
|
|
@@ -235,13 +215,78 @@ from .vectors.types import ( # noqa
|
|
|
235
215
|
Vectorable,
|
|
236
216
|
)
|
|
237
217
|
|
|
218
|
+
##
|
|
219
|
+
|
|
220
|
+
from .completion import ( # noqa
|
|
221
|
+
CompletionRequestOption,
|
|
222
|
+
CompletionRequestOptions,
|
|
223
|
+
CompletionRequest,
|
|
224
|
+
|
|
225
|
+
CompletionResponseOutput,
|
|
226
|
+
CompletionResponseOutputs,
|
|
227
|
+
CompletionResponse,
|
|
228
|
+
|
|
229
|
+
CompletionService,
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
from .configs import ( # noqa
|
|
233
|
+
Config,
|
|
234
|
+
|
|
235
|
+
consume_configs,
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
from .envs import ( # noqa
|
|
239
|
+
Env,
|
|
240
|
+
EnvKey,
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
from .metadata import ( # noqa
|
|
244
|
+
Metadata,
|
|
245
|
+
|
|
246
|
+
MetadataContainer,
|
|
247
|
+
|
|
248
|
+
CommonMetadata,
|
|
249
|
+
|
|
250
|
+
Uuid,
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
from .registry import ( # noqa
|
|
254
|
+
register_type,
|
|
255
|
+
registry_new,
|
|
256
|
+
registry_of,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
from .resources import ( # noqa
|
|
260
|
+
ResourcesRef,
|
|
261
|
+
ResourcesRefNotRegisteredError,
|
|
262
|
+
Resources,
|
|
263
|
+
|
|
264
|
+
ResourceManaged,
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
from .standard import ( # noqa
|
|
268
|
+
ModelSpecifier,
|
|
269
|
+
ModelName,
|
|
270
|
+
ModelPath,
|
|
271
|
+
|
|
272
|
+
ApiKey,
|
|
273
|
+
|
|
274
|
+
DefaultRequestOptions,
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
from .streaming import ( # noqa
|
|
278
|
+
ResponseGenerator,
|
|
279
|
+
|
|
280
|
+
StreamResponse,
|
|
281
|
+
)
|
|
282
|
+
|
|
238
283
|
|
|
239
284
|
##
|
|
240
285
|
|
|
241
286
|
|
|
242
287
|
from omlish.lang.imports import _register_conditional_import # noqa
|
|
243
288
|
|
|
244
|
-
_register_conditional_import('omlish.marshal', '.chat.
|
|
245
|
-
_register_conditional_import('omlish.marshal', '.content.
|
|
246
|
-
_register_conditional_import('omlish.marshal', '.llms.
|
|
247
|
-
_register_conditional_import('omlish.marshal', '.tools.
|
|
289
|
+
_register_conditional_import('omlish.marshal', '.chat._marshal', __package__)
|
|
290
|
+
_register_conditional_import('omlish.marshal', '.content._marshal', __package__)
|
|
291
|
+
_register_conditional_import('omlish.marshal', '.llms._marshal', __package__)
|
|
292
|
+
_register_conditional_import('omlish.marshal', '.tools._marshal', __package__)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import operator
|
|
2
|
+
import typing as ta
|
|
3
|
+
|
|
4
|
+
from omlish import check
|
|
5
|
+
from omlish import dataclasses as dc
|
|
6
|
+
from omlish import marshal as msh
|
|
7
|
+
from omlish import reflect as rfl
|
|
8
|
+
from omlish import typedvalues as tv
|
|
9
|
+
from omlish.funcs import match as mfs
|
|
10
|
+
from omlish.typedvalues.marshal import build_typed_values_marshaler
|
|
11
|
+
from omlish.typedvalues.marshal import build_typed_values_unmarshaler
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
##
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dc.dataclass()
|
|
18
|
+
class _TypedValuesFieldMarshalerFactory(msh.MarshalerFactoryMatchClass):
|
|
19
|
+
tvs_rty: rfl.Type
|
|
20
|
+
|
|
21
|
+
@mfs.simple(lambda _, ctx, rty: True)
|
|
22
|
+
def _build(self, ctx: msh.MarshalContext, rty: rfl.Type) -> msh.Marshaler:
|
|
23
|
+
return build_typed_values_marshaler(ctx, self.tvs_rty)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dc.dataclass()
|
|
27
|
+
class _TypedValuesFieldUnmarshalerFactory(msh.UnmarshalerFactoryMatchClass):
|
|
28
|
+
tvs_rty: rfl.Type
|
|
29
|
+
|
|
30
|
+
@mfs.simple(lambda _, ctx, rty: True)
|
|
31
|
+
def _build(self, ctx: msh.UnmarshalContext, rty: rfl.Type) -> msh.Unmarshaler:
|
|
32
|
+
return build_typed_values_unmarshaler(ctx, self.tvs_rty)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
##
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _tv_field_coercer(
|
|
39
|
+
tvc: type[tv.TypedValue] | tuple[type[tv.TypedValue], ...],
|
|
40
|
+
) -> ta.Callable[[ta.Sequence], tv.TypedValues]:
|
|
41
|
+
if isinstance(tvc, tuple):
|
|
42
|
+
check.arg(all(issubclass(e, tv.TypedValue) for e in tvc))
|
|
43
|
+
else:
|
|
44
|
+
check.issubclass(tvc, tv.TypedValue)
|
|
45
|
+
|
|
46
|
+
def inner(seq):
|
|
47
|
+
return tv.TypedValues(*[
|
|
48
|
+
check.isinstance(e, tvc)
|
|
49
|
+
for e in check.isinstance(seq, ta.Sequence)
|
|
50
|
+
])
|
|
51
|
+
|
|
52
|
+
return inner
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _tv_field_repr(tvs: tv.TypedValues) -> str | None:
|
|
56
|
+
if not tvs:
|
|
57
|
+
return None
|
|
58
|
+
|
|
59
|
+
return repr(list(tvs))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _tv_field_metadata(
|
|
63
|
+
tvc: ta.Any,
|
|
64
|
+
*,
|
|
65
|
+
marshal_name: str | None = None,
|
|
66
|
+
) -> ta.Mapping:
|
|
67
|
+
tvc_rty = rfl.type_(tvc)
|
|
68
|
+
|
|
69
|
+
ct: ta.Any
|
|
70
|
+
if isinstance(tvc_rty, type):
|
|
71
|
+
ct = check.issubclass(tvc, tv.TypedValue)
|
|
72
|
+
elif isinstance(tvc_rty, rfl.Union):
|
|
73
|
+
ct = tuple(check.issubclass(check.not_none(rfl.get_concrete_type(a)), tv.TypedValue) for a in tvc_rty.args)
|
|
74
|
+
else:
|
|
75
|
+
raise TypeError(tvc_rty)
|
|
76
|
+
|
|
77
|
+
tvs_rty = rfl.type_(tv.TypedValues[tvc])
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
**dc.extra_field_params(
|
|
81
|
+
coerce=_tv_field_coercer(ct),
|
|
82
|
+
repr_fn=_tv_field_repr,
|
|
83
|
+
),
|
|
84
|
+
|
|
85
|
+
msh.FieldMetadata: msh.FieldMetadata(
|
|
86
|
+
name=marshal_name,
|
|
87
|
+
options=msh.FieldOptions(
|
|
88
|
+
omit_if=operator.not_,
|
|
89
|
+
),
|
|
90
|
+
marshaler_factory=_TypedValuesFieldMarshalerFactory(tvs_rty),
|
|
91
|
+
unmarshaler_factory=_TypedValuesFieldUnmarshalerFactory(tvs_rty),
|
|
92
|
+
),
|
|
93
|
+
}
|
{ommlds-0.0.0.dev332 → ommlds-0.0.0.dev333}/ommlds/minichain/backends/transformers/sentence.py
RENAMED
|
@@ -4,7 +4,7 @@ import sentence_transformers as stfm
|
|
|
4
4
|
|
|
5
5
|
from ...configs import Config
|
|
6
6
|
from ...configs import consume_configs
|
|
7
|
-
from ...content.images import
|
|
7
|
+
from ...content.images import ImageContent
|
|
8
8
|
from ...standard import ModelPath
|
|
9
9
|
from ...vectors.embeddings import EmbeddingRequest
|
|
10
10
|
from ...vectors.embeddings import EmbeddingResponse
|
|
@@ -40,7 +40,7 @@ class SentenceTransformersEmbeddingService(EmbeddingService):
|
|
|
40
40
|
v = request.v
|
|
41
41
|
if isinstance(v, str):
|
|
42
42
|
obj = v
|
|
43
|
-
elif isinstance(v,
|
|
43
|
+
elif isinstance(v, ImageContent):
|
|
44
44
|
obj = v.i
|
|
45
45
|
else:
|
|
46
46
|
raise TypeError(v)
|