Skip to content

Commit 8d0089a

Browse files
chore: Style transfer models uploaded to hf repo (#58)
## 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. -->
1 parent 7484a31 commit 8d0089a

11 files changed

+29
-9
lines changed
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.

examples/computer-vision/models/style_transfer.ts

-6
This file was deleted.

examples/computer-vision/screens/StyleTransferScreen.tsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import Spinner from 'react-native-loading-spinner-overlay';
22
import { BottomBar } from '../components/BottomBar';
3-
import { candy } from '../models/style_transfer';
43
import { getImageUri } from '../utils';
5-
import { useStyleTransfer } from 'react-native-executorch';
4+
import {
5+
useStyleTransfer,
6+
STYLE_TRANSFER_CANDY,
7+
} from 'react-native-executorch';
68
import { View, StyleSheet, Image } from 'react-native';
79

810
export const StyleTransferScreen = ({
@@ -13,7 +15,7 @@ export const StyleTransferScreen = ({
1315
setImageUri: (imageUri: string) => void;
1416
}) => {
1517
const model = useStyleTransfer({
16-
modulePath: candy,
18+
modulePath: STYLE_TRANSFER_CANDY,
1719
});
1820

1921
const handleCameraPress = async (isCamera: boolean) => {

src/constants/modelUrls.ts

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//LLM's
2+
3+
import { Platform } from 'react-native';
4+
15
export const LLAMA3_2_3B_URL =
26
'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';
37
export const LLAMA3_2_3B_QLORA_URL =
@@ -14,3 +18,23 @@ export const LLAMA3_2_1B_TOKENIZER =
1418
'https://huggingface.co/software-mansion/react-native-executorch-llama-3.2/resolve/v0.1.0/llama-3.2-1B/original/tokenizer.bin';
1519
export const LLAMA3_2_3B_TOKENIZER =
1620
'https://huggingface.co/software-mansion/react-native-executorch-llama-3.2/resolve/v0.1.0/llama-3.2-3B/original/tokenizer.bin';
21+
22+
//Style transfer
23+
export const STYLE_TRANSFER_CANDY =
24+
Platform.OS === 'ios'
25+
? 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy/resolve/v0.2.0/coreml/style_transfer_candy_coreml.pte'
26+
: 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-candy/resolve/v0.2.0/xnnpack/style_transfer_candy_xnnpack.pte';
27+
28+
export const STYLE_TRANSFER_MOSAIC =
29+
Platform.OS === 'ios'
30+
? 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-mosaic/resolve/main/coreml/style_transfer_mosaic_coreml.pte'
31+
: 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-mosaic/resolve/main/xnnpack/style_transfer_mosaic_xnnpack.pte';
32+
33+
export const STYLE_TRANSFER_RAIN_PRINCESS =
34+
Platform.OS === 'ios'
35+
? 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-rain-princess/resolve/main/coreml/style_transfer_rain_princess_coreml.pte'
36+
: 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-rain-princess/resolve/main/xnnpack/style_transfer_rain_princess_xnnpack.pte';
37+
export const STYLE_TRANSFER_UDNIE =
38+
Platform.OS === 'ios'
39+
? 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-udnie/resolve/main/coreml/style_transfer_udnie_coreml.pte'
40+
: 'https://huggingface.co/software-mansion/react-native-executorch-style-transfer-udnie/resolve/main/xnnpack/style_transfer_udnie_xnnpack.pte';

0 commit comments

Comments
 (0)