Skip to content

Commit

Permalink
Merge branch 'main' into feature/github_actions_update
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Schreckengaust <[email protected]>
  • Loading branch information
scottschreckengaust authored Nov 16, 2023
2 parents 1bc638a + f4aa8c7 commit dd5befe
Show file tree
Hide file tree
Showing 7 changed files with 1,327 additions and 1,121 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ort-toolkit.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions .ort.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
curations:
packages:
- id: "PyPI::numpy:1.26.2"
curations:
comment: "The https://github.com/numpy/numpy/blob/v1.26.2/LICENSE.txt, as a\
\ permissive license similar to the BSD 2-Clause License, but with a 3rd clause\
\ that prohibits others from using the name of the copyright holder or its\
\ contributors to promote derived products without written consent."
concluded_license: "BSD-3-Clause"
declared_license_mapping:
BSD License: "BSD-3-Clause"
- id: "PyPI::pypdf2:3.0.1"
curations:
comment: "The https://github.com/py-pdf/pypdf/blob/3.0.0/LICENSE, is a\
\ three-clause BSD."
concluded_license: "BSD-3-Clause"
declared_license_mapping:
BSD License: "BSD-3-Clause"
- id: "PyPI::pandas:2.1.3"
curations:
comment: "From https://github.com/pandas-dev/pandas/blob/v2.1.3/LICENSE,\
\ A permissive license similar to the BSD 2-Clause License,\
\ but with a 3rd clause that prohibits others from using the name\
\ of the copyright holder or its contributors to promote derived products\
\ without written consent."
concluded_license: "BSD-3-Clause"
declared_license_mapping:
BSD License: "BSD-3-Clause"
- id: "NPM::case:1.6.3"
curations:
comment: "From https://github.com/nbubna/Case/blob/1.6.3/LICENSE:\
\ A short and simple permissive license with conditions only requiring\
\ preservation of copyright and license notices. Licensed works,\
\ modifications, and larger works may be distributed\
\ under different terms and without source code."
concluded_license: "MIT-0"
declared_license_mapping:
BSD License: "MIT-0"
6 changes: 5 additions & 1 deletion projenrc/github-workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ export function buildOrtToolkitWorkflow(project: AwsCdkConstructLibrary) {
},
{
name: 'Run GitHub Action for ORT',
uses: 'oss-review-toolkit/ort-ci-github-action@v1',
uses: 'oss-review-toolkit/ort-ci-github-action@7f23c1f8d169dad430e41df223d3b8409c7a156e',
with: {
'allow-dynamic-versions': 'true',
'ort-cli-args': '-P ort.forceOverwrite=true -P ort.enableRepositoryPackageConfigurations=true -P ort.enableRepositoryPackageCurations=true --stacktrace',
},
},
],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
import * as fs from 'fs';
import * as path from 'path';
import * as zlib from 'zlib';
import { GenerateUtils } from './generate-utils';
import { JumpStartConstants } from '../private/jumpstart-constants';

Expand Down Expand Up @@ -64,8 +65,8 @@ interface ModelsData {
}

const JUMPSTART_CACHE_PATH = path.join(__dirname, './.cache/jumpstart-models-cache.json');

const JUMPSTART_MODEL_PATH = path.join(__dirname, '../jumpstart-model.ts');
const JUMPSTART_MODELS_PATH = path.join(__dirname, '../jumpstart-models.json');

const ALLOWED_FRAMEWORKS = [
'huggingface',
Expand Down Expand Up @@ -163,6 +164,8 @@ function generateCode() {
const data = JSON.parse(fs.readFileSync(JUMPSTART_CACHE_PATH, 'utf8'));

let modelsStr = '';
let specs: Record<string, any> = {};

for (const modelId of Object.keys(data)) {
for (const version of Object.keys(data[modelId])) {
const modelName = `${GenerateUtils.replaceAll(modelId, '-', '_')}_${GenerateUtils.replaceAll(
Expand Down Expand Up @@ -224,8 +227,8 @@ function generateCode() {
delete spec.prepackedArtifactKey;
}

modelsStr +=
' ' + `public static readonly ${modelName} = this.of(${JSON.stringify(spec)});\n`;
specs[modelName] = spec;
modelsStr += ' ' + `public static readonly ${modelName} = this.of('${modelName}');\n`;
}
}

Expand All @@ -241,6 +244,8 @@ function generateCode() {
* OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
import * as zlib from 'zlib';
import * as data from './jumpstart-models.json';
export interface IInstanceAliase {
region: string;
Expand Down Expand Up @@ -269,18 +274,25 @@ export interface IJumpStartModelSpec {
export class JumpStartModel {
${modelsStr}
public static of(
spec: IJumpStartModelSpec
): JumpStartModel {
return new JumpStartModel(spec);
public static of(name: string): JumpStartModel {
return new JumpStartModel(name);
}
constructor(private readonly spec: IJumpStartModelSpec) {}
constructor(private readonly name: string) {}
public bind(): IJumpStartModelSpec {
return this.spec;
const bufferSource = (data as { data: number[] }).data;
const buffer = Buffer.from(bufferSource);
const bufferStr = zlib.inflateRawSync(buffer);
const json = JSON.parse(bufferStr.toString());
return json[this.name];
}
}`;

GenerateUtils.writeFileSyncWithDirs(
JUMPSTART_MODELS_PATH,
JSON.stringify(zlib.deflateRawSync(JSON.stringify(specs)).toJSON()),
);
GenerateUtils.writeFileSyncWithDirs(JUMPSTART_MODEL_PATH, fileStr);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export class DeepLearningContainerImage extends ContainerImage {
public static readonly DJL_INFERENCE_0_24_0_DEEPSPEED0_10_0_CU118 = this.fromDeepLearningContainerImage('djl-inference', '0.24.0-deepspeed0.10.0-cu118');
public static readonly DJL_INFERENCE_0_24_0_FASTERTRANSFORMER5_3_0_CU118 = this.fromDeepLearningContainerImage('djl-inference', '0.24.0-fastertransformer5.3.0-cu118');
public static readonly DJL_INFERENCE_0_24_0_NEURONX_SDK2_14_1 = this.fromDeepLearningContainerImage('djl-inference', '0.24.0-neuronx-sdk2.14.1');
public static readonly DJL_INFERENCE_0_25_0_DEEPSPEED0_11_0_CU118 = this.fromDeepLearningContainerImage('djl-inference', '0.25.0-deepspeed0.11.0-cu118');
public static readonly DJL_INFERENCE_0_25_0_NEURONX_SDK2_15_0 = this.fromDeepLearningContainerImage('djl-inference', '0.25.0-neuronx-sdk2.15.0');
public static readonly HUGGINGFACE_PYTORCH_INFERENCE_1_10_2_TRANSFORMERS4_17_0_CPU_PY38_UBUNTU20_04 = this.fromDeepLearningContainerImage('huggingface-pytorch-inference', '1.10.2-transformers4.17.0-cpu-py38-ubuntu20.04');
public static readonly HUGGINGFACE_PYTORCH_INFERENCE_1_10_2_TRANSFORMERS4_17_0_GPU_PY38_CU113_UBUNTU20_04 = this.fromDeepLearningContainerImage('huggingface-pytorch-inference', '1.10.2-transformers4.17.0-gpu-py38-cu113-ubuntu20.04');
public static readonly HUGGINGFACE_PYTORCH_INFERENCE_1_13_1_TRANSFORMERS4_26_0_CPU_PY39_UBUNTU20_04 = this.fromDeepLearningContainerImage('huggingface-pytorch-inference', '1.13.1-transformers4.26.0-cpu-py39-ubuntu20.04');
Expand Down
2,367 changes: 1,256 additions & 1,111 deletions src/patterns/gen-ai/aws-model-deployment-sagemaker/jumpstart-model.ts

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit dd5befe

Please sign in to comment.