Skip to content

Commit 366debb

Browse files
authored
Merge pull request #18 from sb-ai-lab/dev
Fix the bag with incorrect saving of file
2 parents cd6b311 + 3c9fe0a commit 366debb

File tree

9 files changed

+22
-19
lines changed

9 files changed

+22
-19
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
test.ipnb
22
venv/*
3+
.venv/*
34
my_emission_file.csv
45
.DS_Store
56
PyPiUpdate.md
-105 KB
Binary file not shown.

dist/eco2ai-0.3.9.tar.gz

-106 KB
Binary file not shown.

eco2ai/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from .emission_track import (
22
Tracker,
33
track,
4+
__version__
5+
46
)
57

68
from eco2ai.tools.tools_cpu import (
@@ -22,4 +24,4 @@
2224
set_params,
2325
get_params,
2426
summary,
25-
)
27+
)

eco2ai/data/config.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"project_name": "mnist_training", "experiment_description": "Training MNIST Model", "file_name": "emission.csv", "measure_period": 10, "pue": 1}
1+
{"project_name": "YourProjectName", "experiment_description": "training the <your model> model", "file_name": "my_emission.csv", "measure_period": 1, "pue": 1}

eco2ai/emission_track.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
FROM_mWATTS_TO_kWATTH = 1000 * 1000 * 3600
3232
FROM_kWATTH_TO_MWATTH = 1000
33-
33+
__version__ = '0.3.12'
3434

3535
class IncorrectMethodSequenceError(Exception):
3636
pass
@@ -382,7 +382,7 @@ def _construct_attributes_dict(
382382
attributes_dict["project_name"] = [f"{self.project_name}"]
383383
attributes_dict["experiment_description"] = [f"{self.experiment_description}"]
384384
attributes_dict["epoch"] = [
385-
"epoch: " + str(self._current_epoch) + self._parameters_to_save if self._mode == "training" else "N/A"
385+
"epoch: " + str(self._current_epoch) + str(self._parameters_to_save) if self._mode == "training" else "N/A"
386386
]
387387
attributes_dict["start_time"] = [f"{time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(self._start_time))}"]
388388
attributes_dict["duration(s)"] = [f"{time.time() - self._start_time}"]
@@ -484,11 +484,11 @@ def _write_to_csv(
484484
for element in attributes_dict.values():
485485
attributes_array += element
486486

487-
# Ensure consistent types
488-
attributes_array = [
489-
self.align_value_to_dtype(val, dtype)
490-
for val, dtype in zip(attributes_array, attributes_dataframe.dtypes)
491-
]
487+
# # Ensure consistent types
488+
# attributes_array = [
489+
# self.align_value_to_dtype(val, dtype)
490+
# for val, dtype in zip(attributes_array, attributes_dataframe.dtypes)
491+
# ]
492492

493493
if attributes_dataframe[attributes_dataframe["id"] == self._id].shape[0] == 0:
494494
# Adding a new row

eco2ai/tools/tools_cpu.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def number_of_cpu(ignore_warnings=True):
244244
processor_string = dictionary['Џа®жҐбб®а(л)']
245245
if 'Процессор(ы)' in dictionary:
246246
processor_string = dictionary['Процессор(ы)']
247-
cpu_num = int(re.findall('- (\d)\.', processor_string)[0])
247+
cpu_num = int(re.findall(r'- (\d)\.', processor_string)[0])
248248
except:
249249
if not ignore_warnings:
250250
warnings.warn(
@@ -297,15 +297,15 @@ def transform_cpu_name(cpu_name):
297297
298298
"""
299299
# dropping all the waste tokens and patterns:
300-
cpu_name = re.sub('(\(R\))|(®)|(™)|(\(TM\))|(@.*)|(\S*GHz\S*)|(\[.*\])|( \d-Core)|(\(.*\))', '', cpu_name)
300+
cpu_name = re.sub(r'(\(R\))|(®)|(™)|(\(TM\))|(@.*)|(\S*GHz\S*)|(\[.*\])|( \d-Core)|(\(.*\))', '', cpu_name)
301301

302302
# dropping all the waste words:
303303
array = re.split(" ", cpu_name)
304304
for i in array[::-1]:
305305
if ("CPU" in i) or ("Processor" in i) or (i == ''):
306306
array.remove(i)
307307
cpu_name = " ".join(array)
308-
patterns = re.findall("(\S*\d+\S*)", cpu_name)
308+
patterns = re.findall(r"(\S*\d+\S*)", cpu_name)
309309
for i in re.findall(
310310
"(Ryzen Threadripper)|(Ryzen)|(EPYC)|(Athlon)|(Xeon Gold)|(Xeon Bronze)|(Xeon Silver)|(Xeon Platinum)|(Xeon)|(Core)|(Celeron)|(Atom)|(Pentium)",
311311
cpu_name
@@ -336,15 +336,15 @@ def transform_cpu_name_2(cpu_name):
336336
337337
"""
338338
# dropping all the waste tokens and patterns:
339-
cpu_name = re.sub('(\(R\))|(®)|(™)|(\(TM\))|(@.*)|(\S*GHz\S*)|(\[.*\])|( \d-Core)|(\(.*\))', '', cpu_name)
339+
cpu_name = re.sub(r'(\(R\))|(®)|(™)|(\(TM\))|(@.*)|(\S*GHz\S*)|(\[.*\])|( \d-Core)|(\(.*\))', '', cpu_name)
340340

341341
# dropping all the waste words:
342342
array = re.split(" ", cpu_name)
343343
for i in array[::-1]:
344344
if ("CPU" in i) or ("Processor" in i) or (i == ''):
345345
array.remove(i)
346346
cpu_name = " ".join(array)
347-
patterns = re.findall("(\S*\d+\S*)", cpu_name)
347+
patterns = re.findall(r"(\S*\d+\S*)", cpu_name)
348348
for i in re.findall(
349349
"(Ryzen Threadripper)|(Ryzen)|(EPYC)|(Athlon)|(Xeon Gold)|(Xeon Bronze)|(Xeon Silver)|(Xeon Platinum)|(Xeon)|(Core)|(Celeron)|(Atom)|(Pentium)",
350350
cpu_name
@@ -373,7 +373,7 @@ def get_patterns(cpu_name):
373373
Array with all the patterns
374374
375375
"""
376-
patterns = re.findall("(\S*\d+\S*)", cpu_name)
376+
patterns = re.findall(r"(\S*\d+\S*)", cpu_name)
377377
for i in re.findall(
378378
"(Ryzen Threadripper)|(Ryzen)|(EPYC)|(Athlon)|(Xeon Gold)|(Xeon Bronze)|(Xeon Silver)|(Xeon Platinum)|(Xeon)|(Core)|(Celeron)|(Atom)|(Pentium)",
379379
cpu_name

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "eco2ai"
3-
version = "0.3.11"
3+
version = "0.3.12"
44
description = "emission tracking library"
55
authors = ["AI Lab",
66
"Vladimir Lazarev <lazarev@airi.net>",

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
setup(
1414
name = 'eco2ai',
15-
version = '0.3.11',
16-
author=["Vladimir Lazarev", 'Nikita Zakharenko', 'Semyon Budyonny', 'Leonid Zhukov'],
15+
author=["Vladimir Lazarev", 'Nikita Zakharenko', 'Alexey Korovin', 'Semyon Budyonny', 'Leonid Zhukov'],
1716
description = long_description,
1817
packages = ['eco2ai'],
1918
install_requires=DEPENDENCIES,
@@ -24,5 +23,6 @@
2423
"data/carbon_index.csv"
2524
]
2625
},
27-
include_package_data=True
26+
include_package_data=True,
27+
version=__version__
2828
)

0 commit comments

Comments
 (0)