Recently, I've been working on the application of Transformer to fine-grained images.
Solving the problem with the vit source code
KeyError: 'Transformer/encoderblock_0/MultiHeadDotProductAttention_1/query\kernel is not a file in the archive'
This is a problem when merging paths with os.path.join
Solution.
1. In the modeling.py file
Add '/' to the following paths:
ATTENTION_Q = "MultiHeadDotProductAttention_1/query/"
ATTENTION_K = "MultiHeadDotProductAttention_1/key/"
ATTENTION_V = "MultiHeadDotProductAttention_1/value/"
ATTENTION_OUT = "MultiHeadDotProductAttention_1/out/"
FC_0 = "MlpBlock_3/Dense_0/"
FC_1 = "MlpBlock_3/Dense_1/"
ATTENTION_NORM = "LayerNorm_0/"
MLP_NORM = "LayerNorm_2/"
2. In the vit_modeling_resnet.py file
ResNetV2 class Add '/' after each 'block' and 'unit'
self.body = nn.Sequential(OrderedDict([
('block1/', nn.Sequential(OrderedDict(
[('unit1/', PreActBottleneck(cin=width, cout=width*4, cmid=width))] +
[(f'unit{i:d}/', PreActBottleneck(cin=width*4, cout=width*4, cmid=width)) for i in range(2, block_units[0] + 1)],
))),
('block2/', nn.Sequential(OrderedDict(
[('unit1/', PreActBottleneck(cin=width*4, cout=width*8, cmid=width*2, stride=2))] +
[(f'unit{i:d}/', PreActBottleneck(cin=width*8, cout=width*8, cmid=width*2)) for i in range(2, block_units[1] + 1)],
))),
('block3/', nn.Sequential(OrderedDict(
[('unit1/', PreActBottleneck(cin=width*8, cout=width*16, cmid=width*4, stride=2))] +
[(f'unit{i:d}/', PreActBottleneck(cin=width*16, cout=width*16, cmid=width*4)) for i in range(2, block_units[2] + 1)],
))),
]))
Tag Archives: Daily BUG
ERROR: Rancher must be ran with the –privileged flag when running outside of Kubernetes
According to the document on the official website of rancher 2.4, only one Linux host is required. Remember that a single node rancher server can be quickly deployed. Of course, this can only be used for testing. Deployment is very convenient. Just start dcoker on the host, and then start a container:
sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher
After the test, it is found that the container is constantly restarted after startup, and there is no way to enter the UI, prompting a network error.
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bfd5c52a1ce7 rancher/rancher "entrypoint.sh" 12 hours ago Restarting (1) 3 seconds ago elated_heisenberg
View log:
[root@k8s-node02 ~]# docker logs --tail 3 bfd5c52a1ce7
ERROR: Rancher must be ran with the --privileged flag when running outside of Kubernetes
ERROR: Rancher must be ran with the --privileged flag when running outside of Kubernetes
ERROR: Rancher must be ran with the --privileged flag when running outside of Kubernetes
If an error is found, it is said that — privileged is required to increase privileges
turn off the lifting appliance — privileged to try:
docker run -d --restart=unless-stopped --privileged -p 80:80 -p 443:443 rancher/rancher
Found it
ERROR: command failed: npm install –loglevel error
There was a problem installing vue3.0. The problem still exists after exiting and reinstalling.
Solution: execute the following code to clear the NPM cache
npm cache clean –force
[Solved] Error creating bean with name ‘org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0‘:
Error:
Error creating bean with name’org.springframework.web.servlet.handler.SimpleUrlHandlerMapping0’: Instantiation of bean failed;
Error Message:
05-Sep-2021 16:44:18.866 Message [http-apr-8080-exec-8]
org.springframework.web.servlet.FrameworkServlet.initServletBean Initializing Servlet 'springmvc'
05-Sep-2021 16:44:18.974 Warning [http-apr-8080-exec-8] org.springframework.context.support.AbstractApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.handler.SimpleUrlHandlerMapping]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.core.log.LogDelegateFactory.getHiddenLog(Ljava/lang/String;)Lorg/apache/commons/logging/Log;
Cause analysis:
bean instantiation failed
Solution:
There are three ways:
1. Comment out the following comments.
2.Servlet API dependency is missing. Add the following dependencies
<dependency>
<groupId>tomcat</groupId>
<artifactId>servlet-api</artifactId>
<version>5.5.23</version>
</dependency>
3.the web project created has the wrong prototype selected
Error reading JSON file: json.decoder.JSONDecodeError : Extra data: line 6 column 2 (char 1329)
: When reading JSON file data, because the specified JSON file contains more than one JSON format data, so the error.
Top35: pychar reports an error when connecting to MySQL server returns invalid timezone. Need to set ‘servertimezone’ property
Top35: Server returns invalid timezone. Need to set ‘ServerTimezone’ property.
Error content error cause solution
Content of the error
Error reason
Server returns invalid timezone. Need to set ‘ServerTimezone’ property.
The server returning an invalid time zone needs to set the ‘ServerTimeZone’ property.
reasons: MySQL driver jar package the default time zone was UTC
the UTC is the representative of a global standard time, but we use time is Beijing time zone that is east eight area, UTC eight hours ahead.
The solution
Joining together?ServerTimeZon =UTC