mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-04-24 00:12:08 +00:00
- Refactor code to allow supporting multiple versions of the generate.proto at the same time - Add v3/generate.proto (ISO to generate.proto for now but allow for future changes without impacting v2 backends) - Add Schedule trait to abstract queuing and batching mechanisms that will be different in the future - Add SchedulerV2/V3 impl
32 lines
1.1 KiB
Rust
32 lines
1.1 KiB
Rust
use std::fs;
|
|
|
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
println!("cargo:rerun-if-changed=../../proto/**");
|
|
|
|
fs::create_dir_all("src/v2/pb").unwrap_or(());
|
|
let mut config = prost_build::Config::new();
|
|
config.protoc_arg("--experimental_allow_proto3_optional");
|
|
|
|
tonic_build::configure()
|
|
.build_client(true)
|
|
.build_server(false)
|
|
.out_dir("src/v2/pb")
|
|
.include_file("mod.rs")
|
|
.compile_with_config(config, &["../../proto/generate.proto"], &["../../proto"])
|
|
.unwrap_or_else(|e| panic!("protobuf compilation failed: {e}"));
|
|
|
|
fs::create_dir_all("src/v3/pb").unwrap_or(());
|
|
let mut config = prost_build::Config::new();
|
|
config.protoc_arg("--experimental_allow_proto3_optional");
|
|
|
|
tonic_build::configure()
|
|
.build_client(true)
|
|
.build_server(false)
|
|
.out_dir("src/v3/pb")
|
|
.include_file("mod.rs")
|
|
.compile_with_config(config, &["../../proto/v3/generate.proto"], &["../../proto"])
|
|
.unwrap_or_else(|e| panic!("protobuf compilation failed: {e}"));
|
|
|
|
Ok(())
|
|
}
|