oneflow-inc / serving Goto Github PK
View Code? Open in Web Editor NEWOneFlow Serving
License: Apache License 2.0
OneFlow Serving
License: Apache License 2.0
按照官方教程示例将模型以图形式保存后,部署至Triton服务中时出现异常。
程序:
import oneflow as flow
import oneflow.nn as nn
from flowvision.models.alexnet import alexnet
class MyGraph(nn.Graph):
def __init__(self, model):
super().__init__()
self.model = model
def build(self, *input):
return self.model(*input)
if __name__ == "__main__":
fake_image = flow.ones((1, 3, 256, 256))
model = alexnet(pretrained=True, progress=True)
model.eval()
graph = MyGraph(model)
out = graph(fake_image)
MODEL_SAVE_DIR = "./alexnet"
import os
if not os.path.exists(MODEL_SAVE_DIR):
os.makedirs(MODEL_SAVE_DIR)
flow.save(graph, MODEL_SAVE_DIR)
oneflow-backend is not accessible
@zzk0 @hjchen2 @mosout Hi, I'm confusing whether SetInputTensors and Execute functions serve for only one request or all the requests simultaneously. If they serve for all the requests, how is parallelism implemented?Could you please give some advice?
// collect input
std::vector<const char*> input_names;
std::vector<oneflow_api::Tensor> input_tensors;
std::vector<BackendMemory*> input_memories;
bool cuda_copy = false;
BackendInputCollector collector(
requests, request_count, &responses, model_state_->TritonMemoryManager(),
model_state_->EnablePinnedInput(), CudaStream());
SetInputTensors(
total_batch_size, requests, request_count, &responses, &collector,
&input_names, &input_tensors, &input_memories, &cuda_copy);
SynchronizeStream(CudaStream(), cuda_copy);
// execute
uint64_t compute_start_ns = 0;
SET_TIMESTAMP(compute_start_ns);
std::vector<oneflow_api::Tensor> output_tensors;
Execute(&responses, request_count, &input_tensors, &output_tensors);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.