微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用光线调谐时,配置中定义的值返回非浮点值

如何解决使用光线调谐时,配置中定义的值返回非浮点值

我刚开始使用 Ray Tune。 我定义了我的射线配置如下:

ray_config = {
        "estimator/dropout_rate": tune.uniform(0.0,0.3),"estimator/d_model": tune.choice([64]),"estimator/num_encoder_layers": tune.choice([3]),"estimator/context_length": tune.choice([4,8,12]),"trainer/batch_size": tune.choice([256]),"trainer/learning_rate": tune.uniform(0.0002,0.01),"trainer/weight_decay": tune.uniform(1e-06,1e-03)
    }

所以,我试着用这个配置来运行我的曲调。

tune.run(run_or_experiment=executor_run(hpo_params),metric="MAE",mode="max",num_samples=40,# number of trial models
         config=hpo_params,fail_fast=True)

但是,当我在 executor_run 函数中看到配置值时,它没有浮点数或整数类型。

'estimator/dropout_rate': <ray.tune.sample.Flo...d87cf7070>

我该如何解决这个问题? :(

解决方法

您必须通过 Shader "Unlit/MapPinShader" { Properties { _MainTex ("Texture",2D) = "white" {} } SubShader { Tags { "RenderType"="Transparent" "Queue"="Transparent" } LOD 100 Pass { ZTest Always ZWrite On Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM #pragma vertex vert #pragma fragment frag // make fog work #pragma multi_compile_fog #include "UnityCG.cginc" struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; }; struct v2f { float2 uv : TEXCOORD0; UNITY_FOG_COORDS(1) float4 vertex : SV_POSITION; }; sampler2D _MainTex; float4 _MainTex_ST; v2f vert (appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv,_MainTex); UNITY_TRANSFER_FOG(o,o.vertex); return o; } fixed4 frag (v2f i) : SV_Target { // sample the texture fixed4 col = tex2D(_MainTex,i.uv); // apply fog UNITY_APPLY_FOG(i.fogCoord,col); return col; } ENDCG } } } (不带括号)。如果保留括号,函数将立即执行。您真正想要做的是传递一个引用,然后 Ray Tune 可以在远程工作者上执行该引用。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。