refactor: Change model constants to preset objects#477
Conversation
…mentation to reflect these changes
…dependentCharacters from model in VerticalOCRModule
a7332ab to
21f9178
Compare
| }) { | ||
| async load( | ||
| model: { | ||
| modelName: AvailableModels; |
There was a problem hiding this comment.
Just a note here: it seems counterintuitive to me why we're doing this modelName thing here, but we don't do it for LLMs or other models.
There was a problem hiding this comment.
modelName is required for S2T to select the right strategy
| modelSource: model.modelSource, | ||
| tokenizerSource: model.tokenizerSource, | ||
| tokenizerConfigSource: model.tokenizerConfigSource, |
There was a problem hiding this comment.
Can't we unpack model here?
| _model, | ||
| model.modelName, | ||
| model.encoderSource, | ||
| model.decoderSource, | ||
| model.tokenizerSource, |
There was a problem hiding this comment.
Im not sure if i like the naming here, at a first glance i can't figure out the difference between _model and model, i guess this also applies to other code.
There was a problem hiding this comment.
useRef will be used inside this hook, so the variable name will be updated to something like moduleRef
| const DETECTOR_CRAFT_800_MODEL = `${URL_PREFIX}-detector-craft/${VERSION_TAG}/xnnpack/xnnpack_craft_800.pte`; | ||
| const DETECTOR_CRAFT_320_MODEL = `${URL_PREFIX}-detector-craft/${VERSION_TAG}/xnnpack/xnnpack_craft_320.pte`; | ||
|
|
||
| const createHFRecognizerDownloadUrl = (alphabet: string, size: number) => |
There was a problem hiding this comment.
can we narrow down the types here?
There was a problem hiding this comment.
Im changing this in my PR so i guess you can revert it :D
## Description Change model constants to preset objects ### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update (improves or adds clarity to existing documentation) ### Tested on - [x] iOS - [ ] Android ### Checklist - [x] I have performed a self-review of my code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have updated the documentation accordingly - [x] My changes generate no new warnings --------- Co-authored-by: Mateusz Sluszniak <sluszmat@amazon.com>
Description
Change model constants to preset objects
Type of change
Tested on
Checklist