提交 d5064e86 作者: 朱学凯

add token type ids

上级 e92d1555
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4"> <module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.6 (py3.6)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.6 (py3.6)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="subword-nmt" />
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (py3.6)" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6 (py3.6)" project-jdk-type="Python SDK" />
</project> </project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/CPI.iml" filepath="$PROJECT_DIR$/.idea/CPI.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/CPI.iml" filepath="$PROJECT_DIR$/.idea/CPI.iml" />
</modules> </modules>
</component> </component>
</project> </project>
\ No newline at end of file
Index: .idea/workspace.xml ++ /dev/null
Index: .idea/workspace.xml
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+><?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ChangeListManager\">\n <list default=\"true\" id=\"f877ac68-9cea-46d8-9125-207eebe5b5d6\" name=\"Default Changelist\" comment=\"\">\n <change beforePath=\"$PROJECT_DIR$/.idea/workspace.xml\" beforeDir=\"false\" afterPath=\"$PROJECT_DIR$/.idea/workspace.xml\" afterDir=\"false\" />\n <change beforePath=\"$PROJECT_DIR$/run_interaction.py\" beforeDir=\"false\" afterPath=\"$PROJECT_DIR$/run_interaction.py\" afterDir=\"false\" />\n </list>\n <option name=\"SHOW_DIALOG\" value=\"false\" />\n <option name=\"HIGHLIGHT_CONFLICTS\" value=\"true\" />\n <option name=\"HIGHLIGHT_NON_ACTIVE_CHANGELIST\" value=\"false\" />\n <option name=\"LAST_RESOLUTION\" value=\"IGNORE\" />\n </component>\n <component name=\"Git.Settings\">\n <option name=\"RECENT_GIT_ROOT_PATH\" value=\"$PROJECT_DIR$\" />\n </component>\n <component name=\"ProjectId\" id=\"1qpu2Wq6VU5TQVQOm73pQEwAahA\" />\n <component name=\"ProjectLevelVcsManager\">\n <ConfirmationsSetting value=\"1\" id=\"Add\" />\n </component>\n <component name=\"ProjectViewState\">\n <option name=\"hideEmptyMiddlePackages\" value=\"true\" />\n <option name=\"showLibraryContents\" value=\"true\" />\n </component>\n <component name=\"PropertiesComponent\">\n <property name=\"ASKED_ADD_EXTERNAL_FILES\" value=\"true\" />\n <property name=\"RunOnceActivity.OpenProjectViewOnStart\" value=\"true\" />\n <property name=\"RunOnceActivity.ShowReadmeOnStart\" value=\"true\" />\n <property name=\"WebServerToolWindowFactoryState\" value=\"false\" />\n <property name=\"restartRequiresConfirmation\" value=\"false\" />\n </component>\n <component name=\"RunManager\">\n <configuration name=\"run_interaction\" type=\"PythonConfigurationType\" factoryName=\"Python\" temporary=\"true\" nameIsGenerated=\"true\">\n <module name=\"CPI\" />\n <option name=\"INTERPRETER_OPTIONS\" value=\"\" />\n <option name=\"PARENT_ENVS\" value=\"true\" />\n <envs>\n <env name=\"PYTHONUNBUFFERED\" value=\"1\" />\n </envs>\n <option name=\"SDK_HOME\" value=\"\" />\n <option name=\"WORKING_DIRECTORY\" value=\"$PROJECT_DIR$\" />\n <option name=\"IS_MODULE_SDK\" value=\"true\" />\n <option name=\"ADD_CONTENT_ROOTS\" value=\"true\" />\n <option name=\"ADD_SOURCE_ROOTS\" value=\"true\" />\n <EXTENSION ID=\"PythonCoverageRunConfigurationExtension\" runner=\"coverage.py\" />\n <option name=\"SCRIPT_NAME\" value=\"$PROJECT_DIR$/run_interaction.py\" />\n <option name=\"PARAMETERS\" value=\"\" />\n <option name=\"SHOW_COMMAND_LINE\" value=\"false\" />\n <option name=\"EMULATE_TERMINAL\" value=\"false\" />\n <option name=\"MODULE_MODE\" value=\"false\" />\n <option name=\"REDIRECT_INPUT\" value=\"false\" />\n <option name=\"INPUT_FILE\" value=\"\" />\n <method v=\"2\" />\n </configuration>\n <recent_temporary>\n <list>\n <item itemvalue=\"Python.run_interaction\" />\n </list>\n </recent_temporary>\n </component>\n <component name=\"SpellCheckerSettings\" RuntimeDictionaries=\"0\" Folders=\"0\" CustomDictionaries=\"0\" DefaultDictionary=\"application-level\" UseSingleDictionary=\"true\" transferred=\"true\" />\n <component name=\"TaskManager\">\n <task active=\"true\" id=\"Default\" summary=\"Default task\">\n <changelist id=\"f877ac68-9cea-46d8-9125-207eebe5b5d6\" name=\"Default Changelist\" comment=\"\" />\n <created>1617788646167</created>\n <option name=\"number\" value=\"Default\" />\n <option name=\"presentableId\" value=\"Default\" />\n <updated>1617788646167</updated>\n <workItem from=\"1617788647548\" duration=\"5550000\" />\n </task>\n <servers />\n </component>\n <component name=\"TypeScriptGeneratedFilesManager\">\n <option name=\"version\" value=\"3\" />\n </component>\n <component name=\"Vcs.Log.Tabs.Properties\">\n <option name=\"TAB_STATES\">\n <map>\n <entry key=\"MAIN\">\n <value>\n <State />\n </value>\n </entry>\n </map>\n </option>\n </component>\n <component name=\"com.intellij.coverage.CoverageDataManagerImpl\">\n <SUITE FILE_PATH=\"coverage/CPI$run_interaction.coverage\" NAME=\"run_interaction Coverage Results\" MODIFIED=\"1617888322915\" SOURCE_PROVIDER=\"com.intellij.coverage.DefaultCoverageFileProvider\" RUNNER=\"coverage.py\" COVERAGE_BY_TEST_ENABLED=\"true\" COVERAGE_TRACING_ENABLED=\"false\" WORKING_DIRECTORY=\"$PROJECT_DIR$\" />\n </component>\n</project>
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
--- a/.idea/workspace.xml (revision d2a304581cb05de7f85d60774094ec940d9ff199)
+++ b/.idea/workspace.xml (date 1618051977139)
@@ -3,7 +3,6 @@
<component name="ChangeListManager">
<list default="true" id="f877ac68-9cea-46d8-9125-207eebe5b5d6" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/run_interaction.py" beforeDir="false" afterPath="$PROJECT_DIR$/run_interaction.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -65,7 +64,7 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1617788646167</updated>
- <workItem from="1617788647548" duration="5550000" />
+ <workItem from="1617788647548" duration="5869000" />
</task>
<servers />
</component>
<changelist name="Uncommitted_changes_before_Update_at_2021_4_11,_11_03_上午_[Default_Changelist]" date="1618110223042" recycled="true" deleted="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2021_4_11,_11_03_上午_[Default_Changelist]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Update at 2021/4/11, 11:03 上午 [Default Changelist]" />
</changelist>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="f877ac68-9cea-46d8-9125-207eebe5b5d6" name="Default Changelist" comment=""> <list default="true" id="d29948e3-1642-45ab-9fe2-087a876b83b3" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/pre_test.sh" beforeDir="false" afterPath="$PROJECT_DIR$/pre_test.sh" afterDir="false" /> <change afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/Project_Default.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/run_interaction.py" beforeDir="false" afterPath="$PROJECT_DIR$/run_interaction.py" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/CPI.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/CPI.iml" afterDir="false" />
</list> <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<option name="SHOW_DIALOG" value="false" /> <change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <change beforePath="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2021_4_11,_11_03_上午_[Default_Changelist]/shelved.patch" beforeDir="false" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <change beforePath="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Update_at_2021_4_11__11_03___Default_Changelist_.xml" beforeDir="false" />
<option name="LAST_RESOLUTION" value="IGNORE" /> <change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
</component> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<component name="Git.Settings"> <change beforePath="$PROJECT_DIR$/dataset.py" beforeDir="false" afterPath="$PROJECT_DIR$/dataset.py" afterDir="false" />
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <change beforePath="$PROJECT_DIR$/modeling_bert.py" beforeDir="false" afterPath="$PROJECT_DIR$/modeling_bert.py" afterDir="false" />
<option name="UPDATE_TYPE" value="REBASE" /> <change beforePath="$PROJECT_DIR$/run_interaction.py" beforeDir="false" afterPath="$PROJECT_DIR$/run_interaction.py" afterDir="false" />
</component> </list>
<component name="ProjectId" id="1qpu2Wq6VU5TQVQOm73pQEwAahA" /> <option name="SHOW_DIALOG" value="false" />
<component name="ProjectLevelVcsManager"> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<ConfirmationsSetting value="1" id="Add" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
</component> <option name="LAST_RESOLUTION" value="IGNORE" />
<component name="ProjectViewState"> </component>
<option name="hideEmptyMiddlePackages" value="true" /> <component name="Git.Settings">
<option name="showLibraryContents" value="true" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="PropertiesComponent"> <component name="ProjectId" id="1rCop1rMOjMHNiaO2kfyMOb9F7W" />
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" /> <component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" /> <component name="ProjectViewState">
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" /> <option name="showLibraryContents" value="true" />
<property name="restartRequiresConfirmation" value="false" /> </component>
</component> <component name="PropertiesComponent">
<component name="RecentsManager"> <property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
<key name="MoveFile.RECENT_KEYS"> <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<recent name="$PROJECT_DIR$/experment_result/learning_rate" /> <property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
</key> <property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
</component> <property name="WebServerToolWindowFactoryState" value="false" />
<component name="RunManager" selected="Python.run_interaction"> <property name="restartRequiresConfirmation" value="false" />
<configuration name="eval" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <property name="settings.editor.selected.configurable" value="com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable" />
<module name="CPI" /> </component>
<option name="INTERPRETER_OPTIONS" value="" /> <component name="RunManager" selected="Python.run_interaction">
<option name="PARENT_ENVS" value="true" /> <configuration name="dataset" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<envs> <module name="CPI" />
<env name="PYTHONUNBUFFERED" value="1" /> <option name="INTERPRETER_OPTIONS" value="" />
</envs> <option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" /> <envs>
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <env name="PYTHONUNBUFFERED" value="1" />
<option name="IS_MODULE_SDK" value="true" /> </envs>
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="SDK_HOME" value="" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <option name="IS_MODULE_SDK" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/eval.py" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="PARAMETERS" value="" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SHOW_COMMAND_LINE" value="false" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/dataset.py" />
<option name="MODULE_MODE" value="false" /> <option name="PARAMETERS" value="" />
<option name="REDIRECT_INPUT" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="INPUT_FILE" value="" /> <option name="EMULATE_TERMINAL" value="false" />
<method v="2" /> <option name="MODULE_MODE" value="false" />
</configuration> <option name="REDIRECT_INPUT" value="false" />
<configuration name="run_interaction" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true"> <option name="INPUT_FILE" value="" />
<module name="CPI" /> <method v="2" />
<option name="INTERPRETER_OPTIONS" value="" /> </configuration>
<option name="PARENT_ENVS" value="true" /> <configuration name="run_interaction" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<envs> <module name="CPI" />
<env name="PYTHONUNBUFFERED" value="1" /> <option name="INTERPRETER_OPTIONS" value="" />
</envs> <option name="PARENT_ENVS" value="true" />
<option name="SDK_HOME" value="" /> <envs>
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" /> <env name="PYTHONUNBUFFERED" value="1" />
<option name="IS_MODULE_SDK" value="true" /> </envs>
<option name="ADD_CONTENT_ROOTS" value="true" /> <option name="SDK_HOME" value="" />
<option name="ADD_SOURCE_ROOTS" value="true" /> <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" /> <option name="IS_MODULE_SDK" value="true" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/run_interaction.py" /> <option name="ADD_CONTENT_ROOTS" value="true" />
<option name="PARAMETERS" value="" /> <option name="ADD_SOURCE_ROOTS" value="true" />
<option name="SHOW_COMMAND_LINE" value="false" /> <EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="EMULATE_TERMINAL" value="false" /> <option name="SCRIPT_NAME" value="$PROJECT_DIR$/run_interaction.py" />
<option name="MODULE_MODE" value="false" /> <option name="PARAMETERS" value="" />
<option name="REDIRECT_INPUT" value="false" /> <option name="SHOW_COMMAND_LINE" value="false" />
<option name="INPUT_FILE" value="" /> <option name="EMULATE_TERMINAL" value="false" />
<method v="2" /> <option name="MODULE_MODE" value="false" />
</configuration> <option name="REDIRECT_INPUT" value="false" />
<recent_temporary> <option name="INPUT_FILE" value="" />
<list> <method v="2" />
<item itemvalue="Python.run_interaction" /> </configuration>
<item itemvalue="Python.eval" /> <recent_temporary>
</list> <list>
</recent_temporary> <item itemvalue="Python.run_interaction" />
</component> <item itemvalue="Python.dataset" />
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" /> </list>
<component name="TaskManager"> </recent_temporary>
<task active="true" id="Default" summary="Default task"> </component>
<changelist id="f877ac68-9cea-46d8-9125-207eebe5b5d6" name="Default Changelist" comment="" /> <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<created>1617788646167</created> <component name="TaskManager">
<option name="number" value="Default" /> <task active="true" id="Default" summary="Default task">
<option name="presentableId" value="Default" /> <changelist id="d29948e3-1642-45ab-9fe2-087a876b83b3" name="Default Changelist" comment="" />
<updated>1617788646167</updated> <created>1618489611823</created>
<workItem from="1617788647548" duration="5550000" /> <option name="number" value="Default" />
</task> <option name="presentableId" value="Default" />
<servers /> <updated>1618489611823</updated>
</component> <workItem from="1618489616148" duration="6353000" />
<component name="TypeScriptGeneratedFilesManager"> </task>
<option name="version" value="3" /> <servers />
</component> </component>
<component name="Vcs.Log.Tabs.Properties"> <component name="TypeScriptGeneratedFilesManager">
<option name="TAB_STATES"> <option name="version" value="3" />
<map> </component>
<entry key="MAIN"> <component name="Vcs.Log.Tabs.Properties">
<value> <option name="TAB_STATES">
<State /> <map>
</value> <entry key="MAIN">
</entry> <value>
</map> <State />
</option> </value>
</component> </entry>
<component name="com.intellij.coverage.CoverageDataManagerImpl"> </map>
<SUITE FILE_PATH="coverage/CPI$run_interaction.coverage" NAME="run_interaction Coverage Results" MODIFIED="1618475585639" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" /> </option>
<SUITE FILE_PATH="coverage/CPI$eval.coverage" NAME="eval Coverage Results" MODIFIED="1618326256952" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" /> </component>
<SUITE FILE_PATH="coverage/CPI$draft.coverage" NAME="draft Coverage Results" MODIFIED="1617456765793" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" /> <component name="com.intellij.coverage.CoverageDataManagerImpl">
</component> <SUITE FILE_PATH="coverage/CPI$run_interaction.coverage" NAME="run_interaction Coverage Results" MODIFIED="1618496487501" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/CPI$dataset.coverage" NAME="dataset Coverage Results" MODIFIED="1618494392648" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
</component>
</project> </project>
\ No newline at end of file
...@@ -136,12 +136,13 @@ class Data_Encoder(data.Dataset): ...@@ -136,12 +136,13 @@ class Data_Encoder(data.Dataset):
# tokenization # tokenization
d = self.dbpe.process_line(self.smile[index].strip()).split() d = self.dbpe.process_line(self.smile[index].strip()).split()
p = self.sps[index].strip().split(',') p = self.sps[index].strip().split(',')
y = np.float32(self.affinity[index].strip()) y = np.float64(self.affinity[index].strip())
input_seq = [self.begin_id] + d + [self.sep_id] + p + [self.sep_id] input_seq = [self.begin_id] + d + [self.sep_id] + p + [self.sep_id]
token_type_ids = np.concatenate((np.zeros((len(d) + 2), dtype=np.int), np.ones((len(p) + 1), dtype=np.int)))
token_type_ids = np.pad(token_type_ids, (0, self.max_len-len(input_seq)), 'constant', constant_values=0)
input, input_mask = seq2emb_encoder(input_seq, self.max_len, self.vocab) input, input_mask = seq2emb_encoder(input_seq, self.max_len, self.vocab)
return torch.from_numpy(input).long(), torch.from_numpy(token_type_ids).long(), y
return input, y
if __name__ == "__main__": if __name__ == "__main__":
......
...@@ -202,7 +202,6 @@ class BertEmbeddings(nn.Module): ...@@ -202,7 +202,6 @@ class BertEmbeddings(nn.Module):
if inputs_embeds is None: if inputs_embeds is None:
inputs_embeds = self.word_embeddings(input_ids) inputs_embeds = self.word_embeddings(input_ids)
token_type_embeddings = self.token_type_embeddings(token_type_ids) token_type_embeddings = self.token_type_embeddings(token_type_ids)
embeddings = inputs_embeds + token_type_embeddings embeddings = inputs_embeds + token_type_embeddings
if self.position_embedding_type == "absolute": if self.position_embedding_type == "absolute":
position_embeddings = self.position_embeddings(position_ids) position_embeddings = self.position_embeddings(position_ids)
......
...@@ -7,7 +7,7 @@ from modeling_bert import BertAffinityModel ...@@ -7,7 +7,7 @@ from modeling_bert import BertAffinityModel
from torch.utils.tensorboard import SummaryWriter from torch.utils.tensorboard import SummaryWriter
import os import os
from tqdm import tqdm from tqdm import tqdm
torch.set_default_tensor_type(torch.DoubleTensor)
def get_task(task_name): def get_task(task_name):
if task_name.lower() == 'train': if task_name.lower() == 'train':
...@@ -63,14 +63,14 @@ def train(args, model, dataset): ...@@ -63,14 +63,14 @@ def train(args, model, dataset):
print('begin training') print('begin training')
# training # training
for epoch in range(args.epochs): for epoch in range(args.epochs):
for i, (input, affinity) in enumerate(data_generator): for i, (input, token_type_ids, affinity) in enumerate(data_generator):
# use cuda # use cuda
# input model # input model
if torch.cuda.is_available(): if torch.cuda.is_available():
pred_affinity = model(input.cuda().long()) pred_affinity = model(input_ids=input.cuda(), token_type_ids=token_type_ids.cuda())
loss = loss_fct(pred_affinity, affinity.cuda().unsqueeze(-1)) loss = loss_fct(pred_affinity, affinity.cuda().unsqueeze(-1))
else: else:
pred_affinity = model(input.long()) pred_affinity = model(input_ids=input, token_type_ids=token_type_ids)
loss = loss_fct(pred_affinity, affinity.unsqueeze(-1)) loss = loss_fct(pred_affinity, affinity.unsqueeze(-1))
step += 1 step += 1
writer.add_scalar('loss', loss, global_step=step) writer.add_scalar('loss', loss, global_step=step)
...@@ -175,12 +175,11 @@ if __name__ == '__main__': ...@@ -175,12 +175,11 @@ if __name__ == '__main__':
# local test # local test
# args.task = 'train' args.task = 'train'
# args.savedir='local_test_train' args.savedir='local_test_train'
# args.epochs = 10 args.epochs = 10
# args.lr = 1e-7 args.lr = 1e-5
# args.config = './config/config_layer_3.json' args.config = './config/config_layer_3.json'
# args.shuffle = True
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论