Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
import { InferenceSession } from './inference-session.js';
import { OnnxValue } from './onnx-value.js';
 
/**
 * @ignore
 */
export declare namespace SessionHandler {
  type FeedsType = { [name: string]: OnnxValue };
  type FetchesType = { [name: string]: OnnxValue | null };
  type ReturnType = { [name: string]: OnnxValue };
}
 
/**
 * Represents shared SessionHandler functionality
 *
 * @ignore
 */
interface SessionHandler {
  dispose(): Promise<void>;
 
  readonly inputNames: readonly string[];
  readonly outputNames: readonly string[];
 
  readonly inputMetadata: readonly InferenceSession.ValueMetadata[];
  readonly outputMetadata: readonly InferenceSession.ValueMetadata[];
}
 
/**
 * Represent a handler instance of an inference session.
 *
 * @ignore
 */
export interface InferenceSessionHandler extends SessionHandler {
  startProfiling(): void;
  endProfiling(): void;
 
  run(
    feeds: SessionHandler.FeedsType,
    fetches: SessionHandler.FetchesType,
    options: InferenceSession.RunOptions,
    activeLoraAdapters?: readonly LoraAdapterHandler[],
  ): Promise<SessionHandler.ReturnType>;
}
 
/**
 * Represent a handler instance of a LoRA adapter.
 *
 * @ignore
 */
export interface LoraAdapterHandler {
  dispose(): Promise<void>;
}
 
/**
 * Represent a backend that provides implementation of model inferencing.
 *
 * @ignore
 */
export interface Backend {
  /**
   * Initialize the backend asynchronously. Should throw when failed.
   */
  init(backendName: string): Promise<void>;
 
  createInferenceSessionHandler(
    uriOrBuffer: string | Uint8Array,
    options?: InferenceSession.SessionOptions,
  ): Promise<InferenceSessionHandler>;
 
  /**
   * Create a LoRA adapter handler. Optional. A backend that does not implement this method does not support LoRA
   * adapters.
   */
  createLoraAdapterHandler?(uriOrBuffer: string | Uint8Array): Promise<LoraAdapterHandler>;
}
 
export { registerBackend } from './backend-impl.js';