-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Have 'terraform apply' successfully deploying label studio to hugging…
…face spaces in the 'gcp-modular' directory - created a 'label-studio-hf-module'. Made changes to add options in constants and enums for the new label studio component, and updated logic to allow 'huggingface' to be accepted as a provider at the component level
- Loading branch information
1 parent
cc15953
commit 4167290
Showing
10 changed files
with
190 additions
and
3 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
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
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,27 @@ | ||
provider "huggingface-spaces" { | ||
# alias = "strickvl" | ||
token = var.huggingface_token | ||
} | ||
|
||
# using the labelstudio huggingface module to create a label studio space on huggingface | ||
|
||
module "label_studio_hf" { | ||
source = "../modules/label-studio-hf-module" | ||
# providers = { | ||
# huggingface-spaces.strickvl = huggingface-spaces.strickvl | ||
# } | ||
count = var.enable_annotator ? 1 : 0 | ||
huggingface_token = var.huggingface_token | ||
enable_annotator = var.enable_annotator | ||
} | ||
|
||
output "module_huggingface_token" { | ||
value = length(module.label_studio_hf) > 0 ? module.label_studio_hf[0].huggingface_token_passed : "" | ||
sensitive = true | ||
} | ||
|
||
output "token_hash" { | ||
value = sha256(module.label_studio_hf[0].huggingface_token_passed) | ||
sensitive = true | ||
} | ||
|
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
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
13 changes: 13 additions & 0 deletions
13
src/mlstacks/terraform/modules/label-studio-hf-module/label-studio.tf
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,13 @@ | ||
resource "huggingface-spaces_space" "ls_space" { | ||
provider = huggingface-spaces | ||
name = "label-studio-hf-module-${formatdate("YYYYMMDD", timestamp())}" | ||
private = false | ||
sdk = "docker" | ||
template = "LabelStudio/LabelStudio" | ||
|
||
hardware = var.label_studio_hardware | ||
sleep_time = var.label_studio_sleep_time | ||
storage = "small" | ||
} | ||
|
||
|
41 changes: 41 additions & 0 deletions
41
src/mlstacks/terraform/modules/label-studio-hf-module/outputs.tf
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,41 @@ | ||
data "huggingface-spaces_space" "ls_space_data" { | ||
id = huggingface-spaces_space.ls_space.id | ||
} | ||
|
||
output "label_studio_id" { | ||
value = huggingface-spaces_space.ls_space.id | ||
} | ||
|
||
output "label_studio_name" { | ||
value = data.huggingface-spaces_space.ls_space_data.name | ||
} | ||
|
||
output "label_studio_author" { | ||
value = data.huggingface-spaces_space.ls_space_data.author | ||
} | ||
|
||
output "label_studio_last_modified" { | ||
value = data.huggingface-spaces_space.ls_space_data.last_modified | ||
} | ||
|
||
output "label_studio_likes" { | ||
value = data.huggingface-spaces_space.ls_space_data.likes | ||
} | ||
|
||
output "label_studio_private" { | ||
value = data.huggingface-spaces_space.ls_space_data.private | ||
} | ||
|
||
output "label_studio_sdk" { | ||
value = data.huggingface-spaces_space.ls_space_data.sdk | ||
} | ||
|
||
output "label_studio_hardware" { | ||
value = data.huggingface-spaces_space.ls_space_data.hardware | ||
} | ||
|
||
output "huggingface_token_passed" { | ||
value = var.huggingface_token | ||
} | ||
|
||
|
9 changes: 9 additions & 0 deletions
9
src/mlstacks/terraform/modules/label-studio-hf-module/providers.tf
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,9 @@ | ||
terraform { | ||
required_providers { | ||
huggingface-spaces = { | ||
source = "strickvl/huggingface-spaces" | ||
version = ">= 0.0.4" | ||
# configuration_aliases = [huggingface-spaces.strickvl] | ||
} | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
src/mlstacks/terraform/modules/label-studio-hf-module/variables.tf
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,69 @@ | ||
variable "huggingface_token" { | ||
type = string | ||
description = "The Hugging Face API token." | ||
sensitive = true | ||
} | ||
|
||
variable "enable_annotator" { | ||
type = bool | ||
description = "Enable annotator for the Label Studio instance." | ||
default = false | ||
} | ||
|
||
variable "enable_persistent_storage" { | ||
type = bool | ||
description = "Enable persistent storage for the Label Studio instance." | ||
default = false | ||
} | ||
|
||
variable "persistent_storage_size" { | ||
type = string | ||
description = "The size of the persistent storage for the Label Studio instance." | ||
default = "small" | ||
} | ||
|
||
variable "label_studio_disable_signup_without_link" { | ||
type = bool | ||
description = "Disable the signup without link for the Label Studio instance." | ||
default = false | ||
} | ||
|
||
variable "label_studio_username" { | ||
type = string | ||
description = "The username for the Label Studio instance." | ||
default = "[email protected]" | ||
sensitive = true | ||
} | ||
|
||
variable "label_studio_password" { | ||
type = string | ||
description = "The password for the Label Studio instance." | ||
default = "mlstacks" | ||
sensitive = true | ||
} | ||
|
||
variable "label_studio_hardware" { | ||
type = string | ||
description = "The hardware for the Label Studio instance." | ||
default = "cpu-basic" | ||
} | ||
|
||
variable "label_studio_template" { | ||
type = string | ||
description = "The template for the Label Studio instance." | ||
default = "LabelStudio/LabelStudio" | ||
} | ||
|
||
variable "label_studio_sleep_time" { | ||
type = string | ||
description = "The sleep time in seconds for the Label Studio instance. (gc_timeout)" | ||
default = "3600" | ||
} | ||
|
||
variable "label_studio_private" { | ||
type = bool | ||
description = "The private flag for the Label Studio instance." | ||
default = false | ||
} | ||
|
||
|
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