Closed alexeyndru closed 8 months ago
Hi @alexeyndru. Can you be more specific about which model you're using and how you're using it? Any code you can share would be helpful to understand what's not working as expected.
I am using Hermes model. This is my Input :
enum Hermes: Predictable {
static var modelID = "nateraw/nous-hermes-llama2-awq" // ---> the model
static let versionID = "c71045fdc98cb810b828c43bc1421dfa6d6f5607105b91587665e3cfddcfda75"
struct Input: Codable {
var prompt: String
var maxNewTokens: Int = 512
var temperature: Double = 0.8
var topP: Double = 0.95
var topK: Int = 50
var presencePenalty: Double = 0
var frequencyPenalty: Double = 0
var promptTemplate: String
enum CodingKeys: String, CodingKey {
case prompt
case maxNewTokens = "max_new_tokens"
case temperature
case topP = "top_p"
case topK = "top_k"
case presencePenalty = "presence_penalty"
case frequencyPenalty = "frequency_penalty"
case promptTemplate = "prompt_template"
}
}
And this is how i try to generate the prediction:
var prediction = try await Hermes.predict(with: client, input: .init(prompt: model.createPrompt(intensity: sliderValue), promptTemplate: "Below is an instruction that describes a task. Write a response that appropriately completes the request. ### Instruction: {prompt} ###"))
if let m = prediction.output?.first {
activityIndicatorVisible = true
message = m
}
try await prediction.wait(with: client)
prediction.output is always nil and under urls there's a value that looks like this: "https://api.replicate.com/v1/predictions/3y5jak3bprv5rx5vbrm6chmg44"
And this is what I see in console:
Task <87522F47-8AA7-454F-9887-995E2F502F12>.<5> request https://api.replicate.com/v1/predictions/rdmjaolbxjm4nkti25v43girwq is NOT allowed to set HSTS for main doc (null)
along with this: Task <87522F47-8AA7-454F-9887-995E2F502F12>.<5> received response, status 200 content U
Thanks @mattt
@alexeyndru Thanks for sharing that. prediction.output
is nil
when the prediction is first created and enqueued to be run. If you move prediction.wait
above the if let m =
line, your code should work as expected.
As for the HSTS warning, I don't know what that is, but it doesn't appear to be specifically related to Replicate. Replicate's API is served exclusively over HTTPS with a strict-transport-security
. Make sure your NSAppTransportSecurity
Info.plist key is configured correctly for the kinds of networking requests your app makes.
I tried to use the library with Hermes model available on Replicate and I get "is NOT allowed to set HSTS for main doc (null)" error. Any idea what the issue is?