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

feat: use webgpu for FlowerCaptioner #135

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
da58b6a
changed xenova/transfomers to huggingface/transformers
cristianglezm Sep 21, 2024
07b42fb
Bump @huggingface/transformers from 3.0.0-alpha.15 to 3.0.0
cristianglezm Oct 19, 2024
a997334
adapted to use webgpu or cpu if gpu not available.
cristianglezm Oct 19, 2024
d190362
added code to test local onnx model.
cristianglezm Oct 21, 2024
7a37611
update TODO.md
cristianglezm Oct 21, 2024
ae28ca9
added default value to pagination component prop anchor
cristianglezm Oct 26, 2024
612429c
Bump @huggingface/transformers from 3.0.0 to 3.0.1
cristianglezm Oct 28, 2024
6c78a68
added ModelOptions to AIStore
cristianglezm Nov 3, 2024
e2958fc
fixed mobile style error for errorModal.
cristianglezm Nov 3, 2024
35c8300
check if Captioner model is loaded instead of loadModel option in on.
cristianglezm Nov 3, 2024
d1aaadd
added CacheManager component
cristianglezm Nov 3, 2024
f9d5040
added ModelOptions component for settings
cristianglezm Nov 3, 2024
8ad84e9
updated TODO
cristianglezm Nov 3, 2024
980cfdd
updated TODO
cristianglezm Nov 5, 2024
1e0a510
added reload fn to CacheManager
cristianglezm Nov 5, 2024
32ed797
Bump @huggingface/transformers from 3.0.1 to 3.0.2
cristianglezm Nov 7, 2024
1328a7a
refactored settings
cristianglezm Nov 10, 2024
4b75a19
refactored Captioner worker
cristianglezm Nov 14, 2024
b1c100a
updated TODO
cristianglezm Nov 14, 2024
bd31db5
fixed DescriptionModal overflowing window
cristianglezm Nov 16, 2024
4135e7b
updated TODO
cristianglezm Nov 18, 2024
5bbe2d5
fixed model reload bug
cristianglezm Nov 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
## TODO

* [x] cache manager (to delete models files)
* [x] make model options component for settings
* [x] refactor settings - split into components
- [x] AppOptions
- [x] CreationParams
- [x] mutationsRates
- [x] AppActions
- [x] make new layout for settings
* [x] change xenova/transformers to huggingface/transformers
* [ ] test all models
- fp32 works on CPU(it takes ~13s), GPU(it takes ~1m30s)
- fp16 gives exception
- q8 works on CPU (Firefox, Chrome, Edge)
- q8 gives garbled output on Chrome and Edge (GPU)
- int8 gives error on session creation (Can't create a session. ERROR_CODE: 9, ERROR_MESSAGE: Could not find an implementation for ConvInteger(10) node with name '/embeddings/patch_embeddings/projection/Conv_quant')
- uint8 works on CPU
- q4 works on CPU (it takes ~24s)
- q4f16 gives exception.
- bnb4 - works on CPU (it takes ~24s)
* [ ] fix not working on Chrome or Edge GPU
* [ ] Firefox webGPU not supported yet. (wait for it)

* [ ] refactor - split store into stores
2,219 changes: 951 additions & 1,268 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@cristianglezm/flower-evolver-wasm": "^1.0.6",
"@xenova/transformers": "^2.17.2",
"@huggingface/transformers": "^3.0.2",
"axios": "^1.7.7",
"dexie": "^4.0.10",
"mitt": "^3.0.1",
Expand Down
61 changes: 23 additions & 38 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,54 +12,21 @@

<script setup>

import { onMounted, inject } from 'vue';
import { onMounted, inject, onUnmounted } from 'vue';
import ProgressModal from './components/ProgressModal.vue';
import MultiProgressNodal from './components/MultiProgressModal.vue';
import DescriptionModal from './components/DescriptionModal.vue';
import AppTitle from './components/AppTitle.vue';
import AppMenu from './components/AppMenu.vue';
import AppFooter from './components/AppFooter.vue';
import { useRoute } from 'vue-router';
import { Captioner } from './store/AIStore/AI';
import { useFlowersStore } from './store';
import { useAIStore } from './store/AIStore';

const routes = useRoute();
const emitter = inject('emitter');
const store = useFlowersStore();

emitter.on('loadModel', () => {
setTimeout(() => {
emitter.emit('requestMultiProgressBar', {
status: "setup",
title: "downloading or loading model for describing flowers",
onLoad: async () => {
Captioner.getInstance((data) => {
switch(data.status){
case "initiate":{
let event = {
status: "init",
name: data.file,
progress: 0,
total: 100
};
emitter.emit('requestMultiProgressBar', event);
}
break;
case "progress":{
let event = {
status: "update",
name: data.file,
progress: data.progress
};
emitter.emit('requestMultiProgressBar', event);
}
break;
}
});
}
});
}, 2000);
});
const AIStore = useAIStore();

const isLocal = () => {
return routes.path === '/Local' ||
Expand All @@ -68,10 +35,28 @@ const isLocal = () => {
routes.path === '/Settings';
};
onMounted(() => {
emitter.on('App#loadModel', () => {
setTimeout(() => {
emitter.emit('requestMultiProgressBar', {
status: "setup",
title: "downloading or loading model for describing flowers",
onLoad: async () => {
AIStore.requestModelLoad();
}
});
}, 2000);
});
AIStore.channel.on('App#ToEmitter', (e) => {
emitter.emit(e.eventName, e.event);
});
if(store.settings.loadModel){
emitter.emit('loadModel');
emitter.emit('App#loadModel');
}
})
});
onUnmounted(() => {
AIStore.channel.off('App#ToEmitter');
emitter.off("App#loadModel");
});

/*!
* @license SIL Open Font License 1.1 - Copyright (c) 2023, GitHub
Expand Down
Loading