Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FedEator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
sepia-pub
DELIGHT
FedEator
Commits
48454ced
Commit
48454ced
authored
1 month ago
by
huongdm1896
Browse files
Options
Downloads
Patches
Plain Diff
update client code
parent
a8a0eccf
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Flower_v1/client_2.py
+11
-5
11 additions, 5 deletions
Flower_v1/client_2.py
with
11 additions
and
5 deletions
Flower_v1/client_2.py
+
11
−
5
View file @
48454ced
...
...
@@ -9,18 +9,24 @@ import numpy as np
import
sys
import
random
# list up
physical_devices
=
tf
.
config
.
list_physical_devices
(
'
GPU
'
)
if
physical_devices
:
if
len
(
physical_devices
)
>
0
:
# Only use 1st GPU
tf
.
config
.
set_visible_devices
(
physical_devices
[
0
],
'
GPU
'
)
# Avoid over mem
tf
.
config
.
experimental
.
set_memory_growth
(
physical_devices
[
0
],
True
)
print
(
"
GPU detected and memory growth enabled.
"
)
print
(
"
GPU detected and memory growth enabled.
Using GPU:
"
,
physical_devices
[
0
].
name
)
else
:
print
(
"
No GPU detected, using CPU.
"
)
# Set random seed for reproducibility
def
set_random_seed
(
seed
):
random
.
seed
(
seed
)
# Python random module seed
np
.
random
.
seed
(
seed
)
# Numpy random seed
tf
.
random
.
set_seed
(
seed
)
# TensorFlow random seed
random
.
seed
(
seed
)
np
.
random
.
seed
(
seed
)
tf
.
random
.
set_seed
(
seed
)
# Set a specific seed value
set_random_seed
(
42
)
...
...
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