Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -39,7 +39,7 @@ preprocess = Compose([
|
|
39 |
])
|
40 |
|
41 |
@st.cache_data
|
42 |
-
def clip_optimized_latent(text, seed, iterations=25, lr=
|
43 |
seed = int(seed)
|
44 |
text_input = clip.tokenize([text]).to(device)
|
45 |
|
@@ -48,7 +48,7 @@ def clip_optimized_latent(text, seed, iterations=25, lr=1e-2):
|
|
48 |
latent_vector.requires_grad = True
|
49 |
latent_vector = [latent_vector]*model.get_max_latents()
|
50 |
params = [torch.nn.Parameter(latent_vector[i], requires_grad=True) for i in range(len(latent_vector))]
|
51 |
-
optimizer = Adam(params, lr=lr
|
52 |
|
53 |
#with torch.no_grad():
|
54 |
# text_features = clip_model.encode_text(text_input)
|
|
|
39 |
])
|
40 |
|
41 |
@st.cache_data
|
42 |
+
def clip_optimized_latent(text, seed, iterations=25, lr=0.1):
|
43 |
seed = int(seed)
|
44 |
text_input = clip.tokenize([text]).to(device)
|
45 |
|
|
|
48 |
latent_vector.requires_grad = True
|
49 |
latent_vector = [latent_vector]*model.get_max_latents()
|
50 |
params = [torch.nn.Parameter(latent_vector[i], requires_grad=True) for i in range(len(latent_vector))]
|
51 |
+
optimizer = Adam(params, lr=lr)
|
52 |
|
53 |
#with torch.no_grad():
|
54 |
# text_features = clip_model.encode_text(text_input)
|