小编Jee*_*thi的帖子

如何使用经过训练的 BERT 模型检查点进行预测?

我使用 SQUAD 2.0 训练了 BERT,并使用BERT-master在输出目录中获得了model.ckpt.data, model.ckpt.meta, model.ckpt.index(F1 score : 81) 以及predictions.json, 等等/run_squad.py

python run_squad.py \
  --vocab_file=$BERT_LARGE_DIR/vocab.txt \
  --bert_config_file=$BERT_LARGE_DIR/bert_config.json \
  --init_checkpoint=$BERT_LARGE_DIR/bert_model.ckpt \
  --do_train=True \
  --train_file=$SQUAD_DIR/train-v2.0.json \
  --do_predict=True \
  --predict_file=$SQUAD_DIR/dev-v2.0.json \
  --train_batch_size=24 \
  --learning_rate=3e-5 \
  --num_train_epochs=2.0 \
  --max_seq_length=384 \
  --doc_stride=128 \
  --output_dir=gs://some_bucket/squad_large/ \
  --use_tpu=True \
  --tpu_name=$TPU_NAME \
  --version_2_with_negative=True
Run Code Online (Sandbox Code Playgroud)

我尝试将model.ckpt.meta, model.ckpt.index,复制model.ckpt.data$BERT_LARGE_DIR目录并按run_squad.py如下方式更改标志以仅预测答案而不使用数据集进行训练:

python run_squad.py \
  --vocab_file=$BERT_LARGE_DIR/vocab.txt \
  --bert_config_file=$BERT_LARGE_DIR/bert_config.json \
  --init_checkpoint=$BERT_LARGE_DIR/model.ckpt \
  --do_train=False \
  --train_file=$SQUAD_DIR/train-v2.0.json \
  --do_predict=True …
Run Code Online (Sandbox Code Playgroud)

python neural-network tensorflow google-cloud-tpu bert-language-model

5
推荐指数
1
解决办法
3812
查看次数

AWS Athena 使用填充了错误数据的创建表从 Epoch 转换为时间戳

我已使用单个 parquet 文件加载 S3 以测试 Athena 查询。

将文件上传到 S3 后,我使用 S3 选择查询来检查数据。

样本:

Status
 Successfully returned 5 records in 460 ms
Bytes returned: 3278 B
{
"test_date":1467936000
}
Run Code Online (Sandbox Code Playgroud)

我使用这个镶木地板文件通过以下查询创建表

CREATE EXTERNAL TABLE `test_table`(
  `test_date` timestamp)
ROW FORMAT SERDE 
  'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe' 
STORED AS INPUTFORMAT 
  'org.apache.hadoop.mapred.TextInputFormat' 
OUTPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
LOCATION
  's3://xxxxxxxxx/'
TBLPROPERTIES (
  'has_encrypted_data'='false')
Run Code Online (Sandbox Code Playgroud)

当我查询表格时,它给了我

    test_date
1   1970-01-17 23:45:36.000
2   1970-01-17 23:45:36.000
3   1970-01-17 23:45:36.000
etc.
Run Code Online (Sandbox Code Playgroud)

但是使用 python 转换 parquet 文件中的原始整数(即 1467936000)给了我正确的日期时间。

>datetime.datetime.fromtimestamp(1467936000)
datetime.datetime(2016, 7, 8, 5, 30)
Run Code Online (Sandbox Code Playgroud)

如何让 Athena 将 Epoch 正确解释为时间戳?

python amazon-s3 epoch parquet amazon-athena

3
推荐指数
1
解决办法
960
查看次数