Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Projet Bachelor
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
projet_2024
Projet Bachelor
Commits
79bddd7f
Commit
79bddd7f
authored
9 months ago
by
lucien.noel
Browse files
Options
Downloads
Patches
Plain Diff
utilise le venv pour tester le programme
parent
172c3de3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.py
+15
-15
15 additions, 15 deletions
main.py
parameter_finder.py
+11
-3
11 additions, 3 deletions
parameter_finder.py
with
26 additions
and
18 deletions
main.py
+
15
−
15
View file @
79bddd7f
...
...
@@ -83,18 +83,18 @@ if __name__ == '__main__':
###############################################################################
# Génère une mélodie
###############################################################################
if
corpus
.
parser
.
min_bpm
>
corpus
.
parser
.
max_bpm
:
min_temp
=
corpus
.
parser
.
min_bpm
corpus
.
parser
.
min_bpm
=
corpus
.
parser
.
max_bpm
corpus
.
parser
.
max_bpm
=
min_temp
bpm
=
np
.
random
.
randint
(
corpus
.
parser
.
min_bpm
,
corpus
.
parser
.
max_bpm
+
1
)
mg
.
generate
(
model
=
model
,
ntokens
=
ntokens
,
corpus
=
corpus
,
nb_words
=
nb_words
,
temperature
=
temperature
,
device
=
device
,
data_path
=
data_path
,
bpm
=
bpm
)
#
if corpus.parser.min_bpm > corpus.parser.max_bpm:
#
min_temp = corpus.parser.min_bpm
#
corpus.parser.min_bpm = corpus.parser.max_bpm
#
corpus.parser.max_bpm = min_temp
#
bpm = np.random.randint(corpus.parser.min_bpm, corpus.parser.max_bpm + 1)
#
mg.generate(
#
model=model,
#
ntokens=ntokens,
#
corpus=corpus,
#
nb_words=nb_words,
#
temperature=temperature,
#
device=device,
#
data_path=data_path,
#
bpm=bpm
#
)
This diff is collapsed.
Click to expand it.
parameter_finder.py
+
11
−
3
View file @
79bddd7f
...
...
@@ -3,6 +3,7 @@ import subprocess
import
itertools
import
time
import
re
import
os
lr
=
[
'
0.1
'
,
'
1
'
,
'
100
'
]
epochs
=
[
'
20
'
,
'
50
'
,
'
100
'
]
...
...
@@ -15,6 +16,15 @@ nhid = ['100', '200', '500']
nlayers
=
[
'
2
'
,
'
6
'
,
'
10
'
]
if
__name__
==
'
__main__
'
:
venv_path
=
'
venv
'
# Path to the virtual environment's bin or Scripts directory
if
os
.
name
==
'
nt
'
:
# For Windows
venv_python
=
os
.
path
.
join
(
venv_path
,
'
Scripts
'
,
'
python
'
)
else
:
# For Unix or MacOS
venv_python
=
os
.
path
.
join
(
venv_path
,
'
bin
'
,
'
python
'
)
best_ppl
=
None
best_config
=
''
nb_tests
=
0
...
...
@@ -24,7 +34,7 @@ if __name__ == '__main__':
nb_tests
+=
1
print
(
"
Start config :
"
,
res_name
)
start_time
=
time
.
time
()
res
=
subprocess
.
run
([
'
python
'
,
'
main.py
'
,
res
=
subprocess
.
run
([
venv_
python
,
'
main.py
'
,
'
--lr
'
,
lr_i
,
'
--epochs
'
,
epoch_i
,
'
--batch_size
'
,
batch_size_i
,
...
...
@@ -53,8 +63,6 @@ if __name__ == '__main__':
print
(
res_name
,
test_ppl
,
"
time :
"
,
end_time
-
start_time
)
else
:
print
(
"
ERROR:
"
,
res_stdout
,
res_stderr
)
if
nb_tests
>=
15
:
break
print
(
"
nb tests :
"
,
nb_tests
)
print
(
"
best config :
"
,
best_config
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment