mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-07-21 12:09:40 +00:00
Rename tmp dir to sample_data; remove print statements
This commit is contained in:
parent
73275f07b7
commit
e64961697a
10 changed files with 9 additions and 11 deletions
|
@ -323,19 +323,19 @@
|
||||||
"source": [
|
"source": [
|
||||||
"# Upload the files from the local folder\n",
|
"# Upload the files from the local folder\n",
|
||||||
"hf_api.upload_folder(\n",
|
"hf_api.upload_folder(\n",
|
||||||
" folder_path=\"./tmp/sample_squad_data/training\",\n",
|
" folder_path=\"./sample_data/sample_squad_data/training\",\n",
|
||||||
" path_in_repo=\"training\",\n",
|
" path_in_repo=\"training\",\n",
|
||||||
" repo_id=repo_id,\n",
|
" repo_id=repo_id,\n",
|
||||||
" repo_type=\"dataset\",\n",
|
" repo_type=\"dataset\",\n",
|
||||||
")\n",
|
")\n",
|
||||||
"hf_api.upload_folder(\n",
|
"hf_api.upload_folder(\n",
|
||||||
" folder_path=\"./tmp/sample_squad_data/validation\",\n",
|
" folder_path=\"./sample_data/sample_squad_data/validation\",\n",
|
||||||
" path_in_repo=\"validation\",\n",
|
" path_in_repo=\"validation\",\n",
|
||||||
" repo_id=repo_id,\n",
|
" repo_id=repo_id,\n",
|
||||||
" repo_type=\"dataset\",\n",
|
" repo_type=\"dataset\",\n",
|
||||||
")\n",
|
")\n",
|
||||||
"hf_api.upload_folder(\n",
|
"hf_api.upload_folder(\n",
|
||||||
" folder_path=\"./tmp/sample_squad_data/testing\",\n",
|
" folder_path=\"./sample_data/sample_squad_data/testing\",\n",
|
||||||
" path_in_repo=\"testing\",\n",
|
" path_in_repo=\"testing\",\n",
|
||||||
" repo_id=repo_id,\n",
|
" repo_id=repo_id,\n",
|
||||||
" repo_type=\"dataset\",\n",
|
" repo_type=\"dataset\",\n",
|
||||||
|
@ -405,7 +405,7 @@
|
||||||
"import json\n",
|
"import json\n",
|
||||||
"import pprint\n",
|
"import pprint\n",
|
||||||
"\n",
|
"\n",
|
||||||
"with open(\"./tmp/sample_squad_data/testing/testing.jsonl\", \"r\") as f:\n",
|
"with open(\"./sample_data/sample_squad_data/testing/testing.jsonl\", \"r\") as f:\n",
|
||||||
" examples = [json.loads(line) for line in f]\n",
|
" examples = [json.loads(line) for line in f]\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Get the user prompt from the last example\n",
|
"# Get the user prompt from the last example\n",
|
||||||
|
@ -864,19 +864,19 @@
|
||||||
"source": [
|
"source": [
|
||||||
"# Upload the files from the local folder\n",
|
"# Upload the files from the local folder\n",
|
||||||
"hf_api.upload_folder(\n",
|
"hf_api.upload_folder(\n",
|
||||||
" folder_path=\"./tmp/sample_squad_messages/training\",\n",
|
" folder_path=\"./sample_data/sample_squad_messages/training\",\n",
|
||||||
" path_in_repo=\"training\",\n",
|
" path_in_repo=\"training\",\n",
|
||||||
" repo_id=repo_id,\n",
|
" repo_id=repo_id,\n",
|
||||||
" repo_type=\"dataset\",\n",
|
" repo_type=\"dataset\",\n",
|
||||||
")\n",
|
")\n",
|
||||||
"hf_api.upload_folder(\n",
|
"hf_api.upload_folder(\n",
|
||||||
" folder_path=\"./tmp/sample_squad_messages/validation\",\n",
|
" folder_path=\"./sample_data/sample_squad_messages/validation\",\n",
|
||||||
" path_in_repo=\"validation\",\n",
|
" path_in_repo=\"validation\",\n",
|
||||||
" repo_id=repo_id,\n",
|
" repo_id=repo_id,\n",
|
||||||
" repo_type=\"dataset\",\n",
|
" repo_type=\"dataset\",\n",
|
||||||
")\n",
|
")\n",
|
||||||
"hf_api.upload_folder(\n",
|
"hf_api.upload_folder(\n",
|
||||||
" folder_path=\"./tmp/sample_squad_messages/testing\",\n",
|
" folder_path=\"./sample_data/sample_squad_messages/testing\",\n",
|
||||||
" path_in_repo=\"testing\",\n",
|
" path_in_repo=\"testing\",\n",
|
||||||
" repo_id=repo_id,\n",
|
" repo_id=repo_id,\n",
|
||||||
" repo_type=\"dataset\",\n",
|
" repo_type=\"dataset\",\n",
|
||||||
|
@ -936,7 +936,7 @@
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"with open(\"./tmp/sample_squad_messages/testing/testing.jsonl\", \"r\") as f:\n",
|
"with open(\"./sample_data/sample_squad_messages/testing/testing.jsonl\", \"r\") as f:\n",
|
||||||
" examples = [json.loads(line) for line in f]\n",
|
" examples = [json.loads(line) for line in f]\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# get the user and assistant messages from the last example\n",
|
"# get the user and assistant messages from the last example\n",
|
||||||
|
@ -1486,7 +1486,7 @@
|
||||||
"# Create dataset and upload test data\n",
|
"# Create dataset and upload test data\n",
|
||||||
"hf_api.create_repo(guardrails_repo_id, repo_type=\"dataset\")\n",
|
"hf_api.create_repo(guardrails_repo_id, repo_type=\"dataset\")\n",
|
||||||
"hf_api.upload_folder(\n",
|
"hf_api.upload_folder(\n",
|
||||||
" folder_path=\"./tmp/sample_content_safety_test_data\",\n",
|
" folder_path=\"./sample_data/sample_content_safety_test_data\",\n",
|
||||||
" path_in_repo=\"\",\n",
|
" path_in_repo=\"\",\n",
|
||||||
" repo_id=guardrails_repo_id,\n",
|
" repo_id=guardrails_repo_id,\n",
|
||||||
" repo_type=\"dataset\",\n",
|
" repo_type=\"dataset\",\n",
|
||||||
|
|
|
@ -140,8 +140,6 @@ class NeMoGuardrails:
|
||||||
"config_id": self.config_id,
|
"config_id": self.config_id,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
print("request_data")
|
|
||||||
print(request_data)
|
|
||||||
response = await self._guardrails_post(path="/v1/guardrail/checks", data=request_data)
|
response = await self._guardrails_post(path="/v1/guardrail/checks", data=request_data)
|
||||||
|
|
||||||
if response["status"] == "blocked":
|
if response["status"] == "blocked":
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue