Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor KV Storage and Setup Models data to be stored #17

Merged
merged 15 commits into from
Jan 18, 2025

Conversation

sroussey
Copy link
Owner

Very much work in process. Stuff is broken. But time to have the list of models not (always) hard coded.

@sroussey sroussey changed the title Model-repository Refactor KV Storage and Setup Models data to be stored Jan 16, 2025
- Introduced `validateTableAndSchema` function in `common_sql_helpers.ts` to enforce naming conventions and prevent schema conflicts.
- Integrated validation in `SqliteKVRepository` and `PostgresKVRepository` constructors to ensure proper table and schema setup during initialization.
@sroussey sroussey changed the base branch from bindings to main January 16, 2025 17:31
…t handling

- Added a `search` method to `KVRepository` and its implementations, allowing for partial key lookups.
- Updated constructors to accept a `searchable` parameter, enabling dynamic configuration of searchable fields.
- Enhanced documentation across various repository classes to clarify usage and parameters.
- Refactored event emission for put, get, delete, and clearall operations to improve consistency and usability.
- Removed the `common_sql_helpers.ts` file and integrated its validation logic into a new `BaseSqlKVRepository` class for better code organization.
Copy link

netlify bot commented Jan 17, 2025

Deploy Preview for loquacious-valkyrie-d5baf1 ready!

Name Link
🔨 Latest commit b6c8d28
🔍 Latest deploy log https://app.netlify.com/sites/loquacious-valkyrie-d5baf1/deploys/678bfd52ce7afb0008b831aa
😎 Deploy Preview https://deploy-preview-17--loquacious-valkyrie-d5baf1.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

WIP -- using a mock registery that is sync only, so not using the storage system even though files are here now, as i need to change the sync part of the task system to either be async and named something else, or pre-download model info.

- Changed model identifiers from "Xenova/LaMini-Flan-T5-783M" to "ONNX Xenova/LaMini-Flan-T5-783M q8" across multiple files to standardize model naming.
- Introduced a new `ModelRegistry` to manage model instances and their associations with tasks, enhancing the model management system.
- Updated task registration functions to utilize the new model registry, ensuring tasks are correctly linked to their respective models.
- Refactored various components to improve integration with the new model registry, including adjustments in task execution and model retrieval logic.
- Enhanced documentation and type definitions for better clarity and usability.
The reactiveness is key, not the fact that there is no async code, and we will need async code in reactive stuff soon.
@sroussey sroussey marked this pull request as ready for review January 18, 2025 18:41
@sroussey sroussey requested a review from Copilot January 18, 2025 18:42
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 82 out of 97 changed files in this pull request and generated 1 comment.

Files not reviewed (15)
  • examples/web/package.json: Language not supported
  • examples/web/tsconfig.json: Language not supported
  • package.json: Language not supported
  • packages/ai-provider/src/hf-transformers/model/ONNXModelSamples.ts: Evaluated as low risk
  • packages/ai-provider/src/hf-transformers/bindings/all_sqlite.ts: Evaluated as low risk
  • packages/ai-provider/src/hf-transformers/bindings/all_inmemory.ts: Evaluated as low risk
  • examples/web/src/main.tsx: Evaluated as low risk
  • packages/ai-provider/src/ggml/model/GgmlLocalModel.ts: Evaluated as low risk
  • examples/web/src/RunGraphFlow.tsx: Evaluated as low risk
  • docs/developers/03_extending.md: Evaluated as low risk
  • examples/web/src/QueueSatus.tsx: Evaluated as low risk
  • packages/ai-provider/src/hf-transformers/bindings/registerTasks.ts: Evaluated as low risk
  • packages/ai-provider/src/hf-transformers/model/ONNXTransformerJsModel.ts: Evaluated as low risk
  • docs/developers/01_getting_started.md: Evaluated as low risk
  • packages/ai-provider/src/hf-transformers/browser.ts: Evaluated as low risk
Comments suppressed due to low confidence (2)

packages/ai-provider/src/hf-transformers/provider/HuggingFaceLocal_TaskRun.ts:5

  • The variable name 'progess' is misspelled. It should be 'progress'.
const progess = status.status === "progress" ? Math.round(status.progress) : 0;

packages/ai-provider/src/hf-transformers/provider/HuggingFaceLocal_TaskRun.ts:173

  • The fallback to 'true' for 'model.normalize' might change the behavior if 'model.normalize' is 'undefined'. Confirm if this is intended.
const vector = new ElVector(hfVector.data, model.normalize ?? true);


program.version("1.0.0").description("A CLI to run Ellmers.");

AddBaseCommands(program);

await registerHuggingfaceLocalModels();
Copy link
Preview

Copilot AI Jan 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'await' keyword is used outside of an async function, which will cause a syntax error. Wrap the code in an async function or use '.then()' for the promises.

Suggested change
await registerHuggingfaceLocalModels();
(async () => { await registerHuggingfaceLocalModels(); await registerMediaPipeTfJsLocalModels(); })();

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@sroussey
Copy link
Owner Author

Failed tests are a bug in current version of bun

@sroussey sroussey merged commit f0de635 into main Jan 18, 2025
4 of 5 checks passed
@sroussey sroussey deleted the model-repository branch January 18, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant