admin管理员组

文章数量:1290265

I am trying to train a classifier model. I am following instructions which outline to use the format bellow. whenever I go to then train my model, docker returns this error. I am unsure what I need to do to fix this.

CLASS_SAMPLES_SPECIFIC='[ \ 
    {"SAMPLES": 6473, "CLASS": "BB"}, \ 
    {"SAMPLES": 5262, "CLASS": "BC"}, \ 
    {"SAMPLES": 4624, "CLASS": "BI"}, \ 
    {"SAMPLES": 1287, "CLASS": "CH"}, \ 
    {"SAMPLES": 7143, "CLASS": "CY"}, \ 
    {"SAMPLES": 11516, "CLASS": "DR"}, \ 
    {"SAMPLES": 12, "CLASS": "FS"}, \ 
    {"SAMPLES": 4975, "CLASS": "GF"}, \ 
    {"SAMPLES": 5915, "CLASS": "GS"}, \ 
    {"SAMPLES": 5315, "CLASS": "HC"}, \ 
    {"SAMPLES": 5121, "CLASS": "MO"}, \ 
    {"SAMPLES": 1731, "CLASS": "MUD"}, \ 
    {"SAMPLES": 5232, "CLASS": "OP"}, \ 
    {"SAMPLES": 435, "CLASS": "PO"}, \ 
    {"SAMPLES": 5921, "CLASS": "RB"}, \ 
    {"SAMPLES": 6832, "CLASS": "RC"}, \ 
    {"SAMPLES": 3028, "CLASS": "RF"}, \ 
    {"SAMPLES": 3172, "CLASS": "RS"}, \ 
    {"SAMPLES": 5200, "CLASS": "SK"}, \ 
    {"SAMPLES": 5501, "CLASS": "TU"} \ 
]' 

the error returned is :

docker: invalid env file (C:\Users\radia\OneDrive\Desktop\volume\env\training_env.env): variable '{"SAMPLES": 6473, "CLASS": "BB"},\ ' contains whitespaces.

I tried to remove all white spaces but continued to get the error. I believe it is a formatting issue.

I am trying to train a classifier model. I am following instructions which outline to use the format bellow. whenever I go to then train my model, docker returns this error. I am unsure what I need to do to fix this.

CLASS_SAMPLES_SPECIFIC='[ \ 
    {"SAMPLES": 6473, "CLASS": "BB"}, \ 
    {"SAMPLES": 5262, "CLASS": "BC"}, \ 
    {"SAMPLES": 4624, "CLASS": "BI"}, \ 
    {"SAMPLES": 1287, "CLASS": "CH"}, \ 
    {"SAMPLES": 7143, "CLASS": "CY"}, \ 
    {"SAMPLES": 11516, "CLASS": "DR"}, \ 
    {"SAMPLES": 12, "CLASS": "FS"}, \ 
    {"SAMPLES": 4975, "CLASS": "GF"}, \ 
    {"SAMPLES": 5915, "CLASS": "GS"}, \ 
    {"SAMPLES": 5315, "CLASS": "HC"}, \ 
    {"SAMPLES": 5121, "CLASS": "MO"}, \ 
    {"SAMPLES": 1731, "CLASS": "MUD"}, \ 
    {"SAMPLES": 5232, "CLASS": "OP"}, \ 
    {"SAMPLES": 435, "CLASS": "PO"}, \ 
    {"SAMPLES": 5921, "CLASS": "RB"}, \ 
    {"SAMPLES": 6832, "CLASS": "RC"}, \ 
    {"SAMPLES": 3028, "CLASS": "RF"}, \ 
    {"SAMPLES": 3172, "CLASS": "RS"}, \ 
    {"SAMPLES": 5200, "CLASS": "SK"}, \ 
    {"SAMPLES": 5501, "CLASS": "TU"} \ 
]' 

the error returned is :

docker: invalid env file (C:\Users\radia\OneDrive\Desktop\volume\env\training_env.env): variable '{"SAMPLES": 6473, "CLASS": "BB"},\ ' contains whitespaces.

I tried to remove all white spaces but continued to get the error. I believe it is a formatting issue.

Share Improve this question asked Feb 20 at 6:51 user29722274user29722274 1 1
  • If you do need embedded whitespace, Using multi-line value in .env file in docker-compose suggests it needs to be \n C-style escaped newlines in a single physical line. The value looks like JSON, though, and that whitespace may not be necessary. (Could another path like a bind-mounted file or a curl -d HTTP request body be a better way to provide this data?) – David Maze Commented Feb 20 at 11:22
Add a comment  | 

1 Answer 1

Reset to default 0

As described under the .env file syntax, each line in an .env file contains a key-value pair. You can't split them up over multiple lines like you do. This is also why it complains about the second line in your file and not the first.

Put the entire value on one line like this

CLASS_SAMPLES_SPECIFIC='[{"SAMPLES": 6473, "CLASS": "BB"},{"SAMPLES": 5262, "CLASS": "BC"},{"SAMPLES": 4624, "CLASS": "BI"},{"SAMPLES": 1287, "CLASS": "CH"},{"SAMPLES": 7143, "CLASS": "CY"},{"SAMPLES": 11516, "CLASS": "DR"},{"SAMPLES": 12, "CLASS": "FS"},{"SAMPLES": 4975, "CLASS": "GF"},{"SAMPLES": 5915, "CLASS": "GS"},{"SAMPLES": 5315, "CLASS": "HC"},{"SAMPLES": 5121, "CLASS": "MO"},{"SAMPLES": 1731, "CLASS": "MUD"},{"SAMPLES": 5232, "CLASS": "OP"},{"SAMPLES": 435, "CLASS": "PO"},{"SAMPLES": 5921, "CLASS": "RB"},{"SAMPLES": 6832, "CLASS": "RC"},{"SAMPLES": 3028, "CLASS": "RF"},{"SAMPLES": 3172, "CLASS": "RS"},{"SAMPLES": 5200, "CLASS": "SK"},{"SAMPLES": 5501, "CLASS": "TU"}]' 

本文标签: environment variablesdocker invalid env file contains white spacesStack Overflow