-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6830bfc
commit ffc5db5
Showing
5 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{# Kanushka's code #} | ||
# Spacy Installation Instruction | ||
{% if os == 'Windows' %} | ||
{% if platform == 'x86' %} | ||
{% if package_manager == 'pip' %} | ||
{% if hardware == 'CPU' %} | ||
{% if configuration == 'virtual env' %} | ||
{% if pipeline == 'efficiency' %} | ||
`pip install -U spacy` | ||
{% else %} | ||
> [!IMPORTANT] | ||
> Error! | ||
{% endif %} | ||
{% endif %} | ||
{% endif %} | ||
{% endif %} | ||
{% else %} | ||
{% if package_manager == 'conda' %} | ||
{% if hardware == 'CPU' %} | ||
{% if configuration == 'virtual env' %} | ||
{% if pipeline == 'efficiency' %} | ||
`conda install -c conda-forge spacy` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
$schema: https://json-schema.org/draft/2020-12/schema | ||
$id: https://github.com/instructions-d-installation/installation-instruction/examples/spacy/schema_spacy.yml | ||
title: Spacy Install Schema | ||
description: This is a schema which is used for constructing interactive installation instructions. | ||
type: object | ||
$comment: by Kanushka Gupta | ||
properties: | ||
os: | ||
enum: | ||
- macOs/OSX | ||
- Windows | ||
- Linux | ||
platform: | ||
enum: | ||
- x86 | ||
- ARM/M1 | ||
package_manager: | ||
enum: | ||
- pip | ||
- conda | ||
- from source | ||
hardware: | ||
enum: | ||
- CPU | ||
- GPU | ||
enum: | ||
- CUDA 8.0 | ||
- CUDA 9.0 | ||
- CUDA 9.1 | ||
- CUDA 9.2 | ||
- CUDA 10.0 | ||
- CUDA 10.1 | ||
- CUDA 10.2 | ||
- CUDA 11.0 | ||
- CUDA 11.1 | ||
- CUDA 11.2 - 11.x | ||
- CUDA 12.x | ||
configuration: | ||
enum: | ||
- virtual env | ||
- train models | ||
pipeline: | ||
enum: | ||
- efficiency | ||
- accuracy | ||
|
||
required: | ||
- os | ||
- platform | ||
- package_manager | ||
- hardware | ||
- configuration | ||
- pipeline |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
os: Windows | ||
platform: x86 | ||
package_manager: pip | ||
hardware: CPU | ||
configuration: virtual env | ||
pipeline: efficiency |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
os: Windows | ||
platform: x86 | ||
package_manager: conda | ||
hardware: GPU | ||
configuration: virtual env | ||
pipeline: efficiency |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
try: | ||
from yaml import CLoader as Loader, CDumper as Dumper, load | ||
except ImportError: | ||
from yaml import Loader, Dumper | ||
|
||
from jsonschema import validate | ||
|
||
from jinja2 import Template | ||
|
||
|
||
|
||
def load_yml(path: str) -> dict: | ||
with open(path, 'r') as file: | ||
input_str = file.read() | ||
|
||
return load(input_str, Loader=Loader) | ||
|
||
def load_template(path: str) -> Template: | ||
with open(path, 'r') as file: | ||
template_str = file.read() | ||
|
||
return Template(template_str) | ||
|
||
|
||
|
||
|
||
schema = load_yml('instruction_spacy.schema.yml') | ||
input = load_yml('user_input_2.yml') | ||
|
||
|
||
print("Test valid input.") | ||
validate(input, schema) | ||
print("It worked!") | ||
|
||
|
||
|
||
template = load_template("instruction_spacy.md.jinja") | ||
|
||
instructions = template.render(input) | ||
print(instructions) |