You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when i use this code to test katib (ReadME.md example)
import kubeflow.katib as katib
# Step 1. Create an objective function.
def objective(parameters):
# Import required packages.
import time
time.sleep(5)
# Calculate objective function.
result = 4 * int(parameters["a"]) - float(parameters["b"]) ** 2
# Katib parses metrics in this format: <metric-name>=<metric-value>.
print(f"result={result}")
# Step 2. Create HyperParameter search space.
parameters = {
"a": katib.search.int(min=10, max=20),
"b": katib.search.double(min=0.1, max=0.2)
}
# Step 3. Create Katib Experiment.
katib_client = katib.KatibClient()
name = "tune-experiment"
katib_client.tune(
name=name,
objective=objective,
parameters=parameters,
objective_metric_name="result",
max_trial_count=12
)
# Step 4. Get the best HyperParameters.
print(katib_client.get_optimal_hyperparameters(name))
What did you expect to happen?
python run_katib.py
I get this error:
Traceback (most recent call last):
File "run_katib.py", line 1, in <module>
import kubeflow.katib as katib
File "/root/.local/lib/python3.8/site-packages/kubeflow/katib/__init__.py", line 73, in <module>
from kubeflow.katib.api.katib_client import KatibClient
File "/root/.local/lib/python3.8/site-packages/kubeflow/katib/api/katib_client.py", line 30, in <module>
class KatibClient(object):
File "/root/.local/lib/python3.8/site-packages/kubeflow/katib/api/katib_client.py", line 36, in KatibClient
namespace: str = utils.get_default_target_namespace(),
File "/root/.local/lib/python3.8/site-packages/kubeflow/katib/utils/utils.py", line 37, in get_default_target_namespace
return get_current_k8s_namespace()
File "/root/.local/lib/python3.8/site-packages/kubeflow/katib/utils/utils.py", line 30, in get_current_k8s_namespace
with open("/var/run/secrets/kubernetes.io/serviceaccount/namespace", "r") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/var/run/secrets/kubernetes.io/serviceaccount/namespace'
Environment
Kubernetes version:
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short. Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.12", GitCommit:"ef70d260f3d036fc22b30538576bbf6b36329995", GitTreeState:"clean", BuildDate:"2023-03-15T13:37:18Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
Kustomize Version: v4.5.4
Server Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.12", GitCommit:"ef70d260f3d036fc22b30538576bbf6b36329995", GitTreeState:"clean", BuildDate:"2023-03-15T13:30:13Z", GoVersion:"go1.19.7", Compiler:"gc", Platform:"linux/amd64"}
Usually, this folder should indicate the namespace where you run your Pod's container: /var/run/secrets/kubernetes.io/serviceaccount/namespace
But, since you run this script from local machine, this directly should not exist.
Do you know how did you create the /var/run/secrets/kubernetes.io/ directory ?
What happened?
when i use this code to test katib (ReadME.md example)
What did you expect to happen?
python run_katib.py
I get this error:
Environment
Kubernetes version:
Katib controller version:
Katib Python SDK version:
Impacted by this bug?
Give it a 👍 We prioritize the issues with most 👍
The text was updated successfully, but these errors were encountered: