MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / createLoraConfig

Function createLoraConfig

inference/deploy.ts:106–149  ·  view source on GitHub ↗
(
  baseConfig: PartialDeep<LoraConfig>,
  options: { gpuType: "a10" | "a100_40g" },
)

Source from the content-addressed store, hash-verified

104};
105
106const createLoraConfig = (
107 baseConfig: PartialDeep<LoraConfig>,
108 options: { gpuType: "a10" | "a100_40g" },
109): LoraConfig => {
110 const maxRequests = baseConfig.engine_config?.engine_kwargs?.max_num_seqs;
111
112 if (maxRequests === undefined) {
113 throw new Error("max_num_seqs is required");
114 }
115
116 const withDefaults = cloneDeep(baseConfig);
117
118 withDefaults.multiplex_config ??= { max_num_models_per_replica: maxRequests };
119
120 withDefaults.engine_config = {
121 ...withDefaults.engine_config,
122 hf_model_id: withDefaults.engine_config?.hf_model_id ?? withDefaults.engine_config?.model_id,
123 };
124
125 const acceleratorConfig = {
126 [`accelerator_type_${options.gpuType}`]: 0.01,
127 };
128 withDefaults.scaling_config = withDefaults.scaling_config ??= {
129 resources_per_worker: acceleratorConfig,
130 ...(withDefaults?.scaling_config ?? {}),
131 };
132
133 withDefaults.deployment_config = {
134 ...withDefaults.deployment_config,
135
136 max_concurrent_queries: withDefaults.deployment_config?.max_concurrent_queries ?? maxRequests,
137 ray_actor_options: { resources: acceleratorConfig },
138 };
139
140 withDefaults.engine_config = {
141 ...withDefaults.engine_config,
142 engine_kwargs: {
143 ...withDefaults.engine_config?.engine_kwargs,
144 max_loras: maxRequests,
145 },
146 };
147
148 return LoraConfigSchema.parse(withDefaults);
149};
150
151const argv = await yargs(hideBin(process.argv))
152 .options({

Callers 2

a10ModelFunction · 0.85
deploy.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected