Skip to content

Commit

Permalink
chore: Style transfer models uploaded to hf repo (#58)
Browse files Browse the repository at this point in the history
## Description
Style transfer models are now fetched from hf repository, depending on
device OS it's using coreml or xnnpack model, also binary files were
removed from example app

### Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] 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
- [x] Android

### Testing instructions
<!-- Provide step-by-step instructions on how to test your changes.
Include setup details if necessary. -->

### Screenshots
<!-- Add screenshots here, if applicable -->

### Related issues
<!-- Link related issues here using #issue-number -->

### Checklist
- [x] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have updated the documentation accordingly
- [ ] My changes generate no new warnings

### Additional notes
<!-- Include any additional information, assumptions, or context that
reviewers might need to understand this PR. -->
  • Loading branch information
NorbertKlockiewicz authored Dec 17, 2024
1 parent 7484a31 commit 8d0089a
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 9 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 0 additions & 6 deletions examples/computer-vision/models/style_transfer.ts

This file was deleted.

8 changes: 5 additions & 3 deletions examples/computer-vision/screens/StyleTransferScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import Spinner from 'react-native-loading-spinner-overlay';
import { BottomBar } from '../components/BottomBar';
import { candy } from '../models/style_transfer';
import { getImageUri } from '../utils';
import { useStyleTransfer } from 'react-native-executorch';
import {
useStyleTransfer,
STYLE_TRANSFER_CANDY,
} from 'react-native-executorch';
import { View, StyleSheet, Image } from 'react-native';

export const StyleTransferScreen = ({
Expand All @@ -13,7 +15,7 @@ export const StyleTransferScreen = ({
setImageUri: (imageUri: string) => void;
}) => {
const model = useStyleTransfer({
modulePath: candy,
modulePath: STYLE_TRANSFER_CANDY,
});

const handleCameraPress = async (isCamera: boolean) => {
Expand Down
24 changes: 24 additions & 0 deletions src/constants/modelUrls.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//LLM's

import { Platform } from 'react-native';

export const LLAMA3_2_3B_URL =
'https://huggingface.co/software-mansion/react-native-executorch-llama-3.2/resolve/v0.1.0/llama-3.2-3B/original/llama3_2_3B_bf16.pte';
export const LLAMA3_2_3B_QLORA_URL =
Expand All @@ -14,3 +18,23 @@ export const LLAMA3_2_1B_TOKENIZER =
'https://huggingface.co/software-mansion/react-native-executorch-llama-3.2/resolve/v0.1.0/llama-3.2-1B/original/tokenizer.bin';
export const LLAMA3_2_3B_TOKENIZER =
'https://huggingface.co/software-mansion/react-native-executorch-llama-3.2/resolve/v0.1.0/llama-3.2-3B/original/tokenizer.bin';

//Style transfer
export const STYLE_TRANSFER_CANDY =
Platform.OS === 'ios'
? 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy/resolve/v0.2.0/coreml/style_transfer_candy_coreml.pte'
: 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy/resolve/v0.2.0/xnnpack/style_transfer_candy_xnnpack.pte';

export const STYLE_TRANSFER_MOSAIC =
Platform.OS === 'ios'
? 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-mosaic/resolve/main/coreml/style_transfer_mosaic_coreml.pte'
: 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-mosaic/resolve/main/xnnpack/style_transfer_mosaic_xnnpack.pte';

export const STYLE_TRANSFER_RAIN_PRINCESS =
Platform.OS === 'ios'
? 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-rain-princess/resolve/main/coreml/style_transfer_rain_princess_coreml.pte'
: 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-rain-princess/resolve/main/xnnpack/style_transfer_rain_princess_xnnpack.pte';
export const STYLE_TRANSFER_UDNIE =
Platform.OS === 'ios'
? 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-udnie/resolve/main/coreml/style_transfer_udnie_coreml.pte'
: 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-udnie/resolve/main/xnnpack/style_transfer_udnie_xnnpack.pte';

0 comments on commit 8d0089a

Please sign in to comment.