Skip to content

Commit

Permalink
fix pytorch version check.
Browse files Browse the repository at this point in the history
  • Loading branch information
sczhou committed Nov 5, 2022
1 parent fa547b7 commit 8e5f81b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ If our work is useful for your research, please consider citing:

### License

This project is licensed under <a rel="license" href="https://github.com/sczhou/CodeFormer/blob/master/LICENSE">S-Lab License 1.0</a>. Redistribution and use for non-commercial purposes should follow this license.
This project is licensed under <a rel="license" href="https://github.com/sczhou/CodeFormer/blob/master/LICENSE">NTU S-Lab License 1.0</a>. Redistribution and use should follow this license.

### Acknowledgement

Expand Down
7 changes: 3 additions & 4 deletions basicsr/archs/vqgan_arch.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ def forward(self, z):

mean_distance = torch.mean(d)
# find closest encodings
# min_encoding_indices = torch.argmin(d, dim=1).unsqueeze(1)
min_encoding_scores, min_encoding_indices = torch.topk(d, 1, dim=1, largest=False)
min_encoding_indices = torch.argmin(d, dim=1).unsqueeze(1)
# min_encoding_scores, min_encoding_indices = torch.topk(d, 1, dim=1, largest=False)
# [0-1], higher score, higher confidence
min_encoding_scores = torch.exp(-min_encoding_scores/10)
# min_encoding_scores = torch.exp(-min_encoding_scores/10)

min_encodings = torch.zeros(min_encoding_indices.shape[0], self.codebook_size).to(z)
min_encodings.scatter_(1, min_encoding_indices, 1)
Expand All @@ -66,7 +66,6 @@ def forward(self, z):
"perplexity": perplexity,
"min_encodings": min_encodings,
"min_encoding_indices": min_encoding_indices,
"min_encoding_scores": min_encoding_scores,
"mean_distance": mean_distance
}

Expand Down
2 changes: 1 addition & 1 deletion facelib/detection/yolov5face/face_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
scale_coords_landmarks,
)

IS_HIGH_VERSION = tuple(map(int, torch.__version__.split('+')[0].split('.')[:3])) >= (1, 9, 0)
IS_HIGH_VERSION = tuple(map(int, torch.__version__.split('+')[0].split('.')[:2])) >= (1, 9, 0)


def isListempty(inList):
Expand Down

0 comments on commit 8e5f81b

Please sign in to comment.