rhoitjadhav commited on
Commit
3394ed2
1 Parent(s): 4207fd5

remove unwanted files

Browse files
Files changed (4) hide show
  1. load_data.py +0 -115
  2. start.sh +0 -40
  3. start_test.sh +0 -12
  4. users.yml +0 -13
load_data.py DELETED
@@ -1,115 +0,0 @@
1
- import os
2
- import sys
3
- import requests
4
- import time
5
- import pandas as pd
6
- import argilla as rg
7
- from datasets import load_dataset
8
- from argilla.labeling.text_classification import Rule, add_rules
9
-
10
-
11
- def load_datasets():
12
- # This is the code that you want to execute when the endpoint is available
13
- print("Argilla is available! Loading datasets")
14
- api_key = sys.argv[-1]
15
- rg.init(api_key=api_key, workspace="admin")
16
-
17
- # load dataset from json
18
- my_dataframe = pd.read_json(
19
- "https://raw.githubusercontent.com/recognai/datasets/main/sst-sentimentclassification.json")
20
-
21
- # convert pandas dataframe to DatasetForTextClassification
22
- dataset_rg = rg.DatasetForTextClassification.from_pandas(my_dataframe)
23
-
24
- # Define labeling schema to avoid UI user modification
25
- settings = rg.TextClassificationSettings(label_schema=["POSITIVE", "NEGATIVE"])
26
- rg.configure_dataset(name="sst-sentiment-explainability", settings=settings)
27
-
28
- # log the dataset
29
- rg.log(
30
- dataset_rg,
31
- name="sst-sentiment-explainability",
32
- tags={
33
- "description": "The sst2 sentiment dataset with predictions from a pretrained pipeline and explanations from Transformers Interpret."
34
- }
35
- )
36
-
37
- dataset = load_dataset("argilla/news-summary", split="train").select(range(100))
38
- dataset_rg = rg.read_datasets(dataset, task="Text2Text")
39
-
40
- # log the dataset
41
- rg.log(
42
- dataset_rg,
43
- name="news-text-summarization",
44
- tags={
45
- "description": "A text summarization dataset with news pieces and their predicted summaries."
46
- }
47
- )
48
-
49
- # Read dataset from Hub
50
- dataset_rg = rg.read_datasets(
51
- load_dataset("argilla/agnews_weak_labeling", split="train"),
52
- task="TextClassification",
53
- )
54
-
55
- # Define labeling schema to avoid UI user modification
56
- settings = rg.TextClassificationSettings(label_schema=["World", "Sports", "Sci/Tech", "Business"])
57
- rg.configure_dataset(name="news-programmatic-labeling", settings=settings)
58
-
59
- # log the dataset
60
- rg.log(
61
- dataset_rg,
62
- name="news-programmatic-labeling",
63
- tags={
64
- "description": "The AG News with programmatic labeling rules (see weak labeling mode in the UI)."
65
- }
66
- )
67
-
68
- # define queries and patterns for each category (using ES DSL)
69
- queries = [
70
- (["money", "financ*", "dollar*"], "Business"),
71
- (["war", "gov*", "minister*", "conflict"], "World"),
72
- (["*ball", "sport*", "game", "play*"], "Sports"),
73
- (["sci*", "techno*", "computer*", "software", "web"], "Sci/Tech"),
74
- ]
75
-
76
- # define rules
77
- rules = [Rule(query=term, label=label) for terms, label in queries for term in terms]
78
-
79
- # add rules to the dataset
80
- add_rules(dataset="news-programmatic-labeling", rules=rules)
81
-
82
- # load dataset from the hub
83
- dataset = load_dataset("argilla/gutenberg_spacy-ner", split="train")
84
-
85
- # read in dataset, assuming its a dataset for token classification
86
- dataset_rg = rg.read_datasets(dataset, task="TokenClassification")
87
-
88
- # Define labeling schema to avoid UI user modification
89
- labels = ["CARDINAL", "DATE", "EVENT", "FAC", "GPE", "LANGUAGE", "LAW", "LOC", "MONEY", "NORP", "ORDINAL", "ORG",
90
- "PERCENT", "PERSON", "PRODUCT", "QUANTITY", "TIME", "WORK_OF_ART"]
91
- settings = rg.TokenClassificationSettings(label_schema=labels)
92
- rg.configure_dataset(name="gutenberg_spacy-ner-monitoring", settings=settings)
93
-
94
- # log the dataset
95
- rg.log(
96
- dataset_rg,
97
- "gutenberg_spacy-ner-monitoring",
98
- tags={
99
- "description": "A dataset containing text from books with predictions from two spaCy NER pre-trained models."
100
- }
101
- )
102
-
103
-
104
- while True:
105
- try:
106
- response = requests.get("http://0.0.0.0:6900/")
107
- if response.status_code == 200:
108
- load_datasets()
109
- break
110
- else:
111
- time.sleep(10)
112
- except Exception as e:
113
- print(e)
114
- time.sleep(10)
115
- pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
start.sh DELETED
@@ -1,40 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -e
4
-
5
- # Changing user
6
- sudo -S su user
7
-
8
- # Update API_KEY and PASSWORD from users.yml
9
- echo "sed"
10
- sudo sed -i 's,API_KEY,'"$API_KEY"',g' /packages/users.yml
11
- sudo sed -i 's,ADMIN_PASSWORD,'"$ADMIN_PASSWORD"',g' /packages/users.yml
12
- sudo sed -i 's,ARGILLA_PASSWORD,'"$ARGILLA_PASSWORD"',g' /packages/users.yml
13
-
14
- # Disable security in elasticsearch configuration
15
- sudo sed -i "s/xpack.security.enabled: true/xpack.security.enabled: false/g" /etc/elasticsearch/elasticsearch.yml
16
- sudo sed -i "s/cluster.initial_master_nodes/#cluster.initial_master_nodes/g" /etc/elasticsearch/elasticsearch.yml
17
- echo "cluster.routing.allocation.disk.threshold_enabled: false" | sudo tee -a /etc/elasticsearch/elasticsearch.yml
18
-
19
- # Create elasticsearch directory and change ownerships
20
- sudo mkdir -p /var/run/elasticsearch
21
- sudo chown -R elasticsearch:elasticsearch /var/run/elasticsearch
22
- sudo chown -R user:user /load_data.py
23
-
24
- # Start elasticsearch
25
- echo "reload"
26
- sudo systemctl daemon-reload
27
- echo "enable"
28
- sudo systemctl enable elasticsearch.service
29
- echo "starting"
30
- sudo systemctl start elasticsearch.service
31
- echo "started"
32
-
33
- # Load data
34
- echo "load data"
35
- pip3 install datasets
36
- python3.9 /load_data.py "$API_KEY" &
37
-
38
- # Start argilla
39
- echo "start argilla"
40
- uvicorn argilla:app --host "0.0.0.0"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
start_test.sh DELETED
@@ -1,12 +0,0 @@
1
- set -e
2
-
3
- # Changing user
4
- sudo -S su user
5
-
6
- sudo systemctl start elasticsearch
7
-
8
- # Load data
9
- python3.9 /load_data.py &
10
-
11
- # Start argilla
12
- uvicorn argilla:app --host "0.0.0.0"
 
 
 
 
 
 
 
 
 
 
 
 
 
users.yml DELETED
@@ -1,13 +0,0 @@
1
- - username: "admin"
2
- api_key: API_KEY
3
- full_name: Hugging Face
4
- email: hfdemo@argilla.io
5
- hashed_password: ADMIN_PASSWORD
6
- workspaces: [ ]
7
-
8
- - username: "argilla"
9
- api_key: API_KEY
10
- full_name: Hugging Face
11
- email: hfdemo@argilla.io
12
- hashed_password: ARGILLA_PASSWORD
13
- workspaces: [ "admin" ]