remote: add HuggingFaceModelDetails data class
This commit is contained in:
parent
4ff924b273
commit
3370bd409c
|
|
@ -18,7 +18,7 @@ interface HuggingFaceApiService {
|
||||||
): List<HuggingFaceModel>
|
): List<HuggingFaceModel>
|
||||||
|
|
||||||
@GET("api/models/{modelId}")
|
@GET("api/models/{modelId}")
|
||||||
suspend fun getModelDetails(@Path("modelId") modelId: String): HuggingFaceModel
|
suspend fun getModelDetails(@Path("modelId") modelId: String): HuggingFaceModelDetails
|
||||||
|
|
||||||
@GET("{modelId}/resolve/main/{filePath}")
|
@GET("{modelId}/resolve/main/{filePath}")
|
||||||
@Streaming
|
@Streaming
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.example.llama.data.remote
|
||||||
|
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
data class HuggingFaceModelDetails(
|
||||||
|
val _id: String,
|
||||||
|
val id: String,
|
||||||
|
val modelId: String,
|
||||||
|
|
||||||
|
val author: String,
|
||||||
|
val createdAt: Date?,
|
||||||
|
val lastModified: Date?,
|
||||||
|
|
||||||
|
val library_name: String?,
|
||||||
|
val pipeline_tag: String?,
|
||||||
|
val tags: List<String>?,
|
||||||
|
|
||||||
|
val private: Boolean?,
|
||||||
|
val disabled: Boolean?,
|
||||||
|
val gated: Boolean?,
|
||||||
|
|
||||||
|
val likes: Int?,
|
||||||
|
val trendingScore: Int?, // TODO-han.yin: ??
|
||||||
|
val downloads: Int?,
|
||||||
|
|
||||||
|
val usedStorage: Long?,
|
||||||
|
val sha: String?,
|
||||||
|
|
||||||
|
val cardData: CardData?,
|
||||||
|
val siblings: List<Sibling>?,
|
||||||
|
val widgetData: List<WidgetData>?,
|
||||||
|
|
||||||
|
val gguf: Gguf?,
|
||||||
|
) {
|
||||||
|
data class Sibling(
|
||||||
|
val rfilename: String,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Gguf(
|
||||||
|
val total: Long?,
|
||||||
|
val architecture: String?,
|
||||||
|
val context_length: Int?,
|
||||||
|
val chat_template: String?,
|
||||||
|
val bos_token: String?,
|
||||||
|
val eos_token: String?,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class CardData(
|
||||||
|
val base_model: String?,
|
||||||
|
val language: List<String>?,
|
||||||
|
val license: String?,
|
||||||
|
val pipeline_tag: String?,
|
||||||
|
val tags: List<String>?,
|
||||||
|
)
|
||||||
|
|
||||||
|
data class WidgetData(
|
||||||
|
val text: String
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -16,7 +16,7 @@ interface HuggingFaceRemoteDataSource {
|
||||||
limit: Int? = 20
|
limit: Int? = 20
|
||||||
): List<HuggingFaceModel>
|
): List<HuggingFaceModel>
|
||||||
|
|
||||||
suspend fun getModelDetails(modelId: String): HuggingFaceModel
|
suspend fun getModelDetails(modelId: String): HuggingFaceModelDetails
|
||||||
|
|
||||||
suspend fun downloadModelFile(modelId: String, filePath: String, outputFile: File): Result<File>
|
suspend fun downloadModelFile(modelId: String, filePath: String, outputFile: File): Result<File>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import com.example.llama.data.local.entity.ModelEntity
|
||||||
import com.example.llama.data.model.GgufMetadata
|
import com.example.llama.data.model.GgufMetadata
|
||||||
import com.example.llama.data.model.ModelInfo
|
import com.example.llama.data.model.ModelInfo
|
||||||
import com.example.llama.data.remote.HuggingFaceModel
|
import com.example.llama.data.remote.HuggingFaceModel
|
||||||
|
import com.example.llama.data.remote.HuggingFaceModelDetails
|
||||||
import com.example.llama.data.remote.HuggingFaceRemoteDataSource
|
import com.example.llama.data.remote.HuggingFaceRemoteDataSource
|
||||||
import com.example.llama.data.repository.ModelRepository.ImportProgressTracker
|
import com.example.llama.data.repository.ModelRepository.ImportProgressTracker
|
||||||
import com.example.llama.monitoring.StorageMetrics
|
import com.example.llama.monitoring.StorageMetrics
|
||||||
|
|
@ -89,7 +90,7 @@ interface ModelRepository {
|
||||||
/**
|
/**
|
||||||
* Obtain the model details from HuggingFace
|
* Obtain the model details from HuggingFace
|
||||||
*/
|
*/
|
||||||
suspend fun getHuggingFaceModelDetails(modelId: String): HuggingFaceModel
|
suspend fun getHuggingFaceModelDetails(modelId: String): HuggingFaceModelDetails
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Download and import a HuggingFace model
|
* Download and import a HuggingFace model
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue