Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
removeModel,
} from '../../../../../packages/llama/src/storage'
import type { Availability, SetupAdapter } from '../../config/providers.common'
import { isModelDownloaded } from '../../utils/storage'
import { isLlamaModelDownloaded } from '../../utils/llamaStorageUtils'

export const createLlamaLanguageSetupAdapter = (
hfModelId: string,
Expand All @@ -34,7 +34,7 @@ export const createLlamaLanguageSetupAdapter = (
},
builtIn: false,
isAvailable(): Availability {
const downloaded = isModelDownloaded(hfModelId)
const downloaded = isLlamaModelDownloaded(hfModelId)
return downloaded ? 'yes' : 'availableForDownload'
},
async download(onProgress) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@react-native-ai/llama'

import type { Availability, SetupAdapter } from '../../config/providers.common'
import { isModelDownloaded } from '../../utils/storage'
import { isLlamaModelDownloaded } from '../../utils/llamaStorageUtils'

interface LlamaSpeechSetupOptions {
modelId: string
Expand Down Expand Up @@ -42,15 +42,15 @@ export const createLlamaSpeechSetupAdapter = ({
builtIn: false,
isAvailable(): Availability {
const [modelReady, vocoderReady] = [
isModelDownloaded(hfModelId),
isModelDownloaded(vocoderId),
isLlamaModelDownloaded(hfModelId),
isLlamaModelDownloaded(vocoderId),
]
return modelReady && vocoderReady ? 'yes' : 'availableForDownload'
},
async download(onProgress) {
const [modelReady, vocoderReady] = [
isModelDownloaded(hfModelId),
isModelDownloaded(vocoderId),
isLlamaModelDownloaded(hfModelId),
isLlamaModelDownloaded(vocoderId),
]
if (!modelReady || !vocoderReady) {
await downloadModel(hfModelId, (progress) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getModelPath } from '@react-native-ai/llama/src/storage'
import { File } from 'expo-file-system'

export function isModelDownloaded(modelId: string): boolean {
export function isLlamaModelDownloaded(modelId: string): boolean {
let path = getModelPath(modelId)

// expo-file-system requires that this URI starts with the file:// protocol
Expand Down